Accessing DbManager in jetty server

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

vivek
Posts: 6
Joined: 18 Jan 2014, 06:43

Accessing DbManager in jetty server

Postby vivek » 18 Jan 2014, 09:49

Initially driverManagerSource is used for MySQL DB connection, Now it have to be changed to DbManager connection in servlet,
the following error is shown in jsp once the servlet is accessed.

<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /cc_acc_service/ccservice.do. Reason:
<pre> it/gotoandplay/smartfoxserver/db/DbManager</pre></p><h3>Caused by:</h3><pre>java.lang.NoClassDefFoundError: it/gotoandplay/smartfoxserver/db/DbManager.

Can you please guide me to access DbManager inside the jetty server.
Also provide necessary jar for accessing DbManager jetty server.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Accessing DbManager in jetty server

Postby Lapo » 20 Jan 2014, 20:48

Sounds like a classpath/classloader issue.
You shouldn't have problems because servlets should be able to see any of the server classes.

Have you tried accessing the class from a JSP page? Maybe there's some issue with the deployment of your servlet. Difficult to say without any further data.

thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
vivek
Posts: 6
Joined: 18 Jan 2014, 06:43

Re: Accessing DbManager in jetty server

Postby vivek » 22 Jan 2014, 11:30

It is working fine in db connection using DriverManagerDataSource .
But when I change the connection to DbManager for accessing DB connection, which is used in smartFoxServer, it fails to access the DbManager.
Also not have clear configuration for accessing from jetty server.

Can you walkthrough how to use DbManager instead of DriverManagerDataSource for getting DB connections in jetty Server?

Thanks
Vivek. :?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Accessing DbManager in jetty server

Postby Lapo » 23 Jan 2014, 12:54

There shouldn't be any particular problem using the DBManager.
All you need to do is creating a webapp under your IDE (Netbeans / Eclipse etc...), add the jysfs.jar library as dependency and use the DBManager class in your code.

Then you deploy the webapp as a regular .war file, copy it to the webapps/ folder in the SFS file structure and start the server.
I have tested these simple steps and it works just fine.

NOTE: in the war file you don't need to pack the jysfs.jar file. The SFS lib is already visible in the main classpath and so will be the database driver if you have deployed it in the SFS lib/ folder.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
vivek
Posts: 6
Joined: 18 Jan 2014, 06:43

Re: Accessing DbManager in jetty server

Postby vivek » 27 Jan 2014, 12:28

I've tried what you have suggested, I have getting the following error while calling "DbManager db= new DbManager(DB_DRIVER,DB_URL,DB_USER,DB_PWD,"casino",10,21,"wait",10);".

The error is "it/gotoandplay/smartfoxserver/db/DbManager</pre></p><h3>Caused by:</h3><pre>java.lang.NoClassDefFoundError: it/gotoandplay/smartfoxserver/db/DbManager".

If this is a jar problem can you tell me the necessary jars to be placed inside server.
Even after placing the jysfs.jar inside jetty lib path, the same error occurs.....

Can you provide me a solution for this.....


Thanks
Vivek.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Accessing DbManager in jetty server

Postby Lapo » 28 Jan 2014, 12:17

That doesn't right to me and it is not expected.
I have done the same test and it works just fine. No need to add any jar files anywhere.

Have you modified the classpath in the server's launch script? That's the only idea it comes to mind.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 54 guests