• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Tomcat Help?

G

globalgold

Guest
I hope someone can help us, we have been having alsorts of issues with tomcat.

1. I want to use JNDI to access a JDBC datasource so that I can read and write to MySQL.

2. I have my full-blown web app working on my development machine but the same code doesn't work on my plesk server.

3. In order to try to narrow down the problem, I've made a very small test application called "jdbctest". This has a single web page (index.jsp) which uses the JSTL <sql:... > tags to access the database using JNDI.

4. To set up the JNDI datasource, I created a context.xml file and put it in the META-INF directory of my web app. This seems to be all I need to do on my development machine. I don't need to edit the conf/server.xml of Tomcat itself (and I don't really want to have to do that in any case).

5. I haven't put a resource-ref element in my WEB-INF/web.xml because again it works fine on my development machine (and when I tried it in my full-blown web app, it doesn't work anyway).

6. So, having created the web app and associated WAR file, I uploaded it using Plesk. But this unhelpfully just tells me that there is a problem with the web app (BTW when I log in to Plesk my browser warns me that the SSL certificate is out of date or for the wrong domain, did you know?)

7. Since it didn't work in Plesk I copied it (using ssh) into the normal /usr/share/tomcat5/webapps directory. This time it got deployed and unpacked properly.

8. Logging in to the Tomcat admin console I can open the tree, find my jdbctest application, look at the Resources | Data Sources and indeed there is my JNDI datasource (jdbc/wink). So that suggests to me that everything should be set up OK and I should be able to uses the datasource. (So the config is right at least?)

9. Going to the front page however shows the error: DataSource invalid: "java.sql.SQLException: No suitable driver". Again this suggests that the configuration is right, but that the MySQL driver isn't on the classpath.

10. However, I had already copied mysql-connector-java-3.1.6-bin.jar (which is the jar I use on my dev machine) into tomcat5/common/lib and checked that common/lib already includes commons-dbcp.jar and commons-pool.jar (which it does--though as links, so I don't know for sure if they are being loaded correctly).

11. I tried copying the mysql-connector-java-3.1.6-bin.jar into the local webapp WEB-INF/lib directory and reloading it from the manager application but it doesn't make any difference.

I really need to get this application up and running as soon as possible. I have had it ready for quite some time, but have so far spent the whole of this week trying to get it running on the plesk server.

I have some other problems with the Tomcat set up:

a) Tomcat is set up with four domains. The manager app only seems to list applications in localhost, so I can't seee what's going on with or reload applications in the other domains. How do I do this (Plesk only shows things uploaded using its interface--and uploading is very slow and generally doesn't work anyway: they don't get deployed properly)

b) I want to have a web app accessible *only* one a https URL However, it also seems to be available as on a http, Not just https. How do I prevent this?

c) Since I don't seem to be able to use Plesk to upload applications successfully, I have been modifying the vhost.conf file and adding in links to direct traffic through Apache to Tomcat. This works EXCEPT that it only directs traffic to localhost apps. So if I want to have a specific URL then I have to put the jdbctest web app in the normal webapps directory, if I put it in the PSA webapps directory then it isn't found. But this means that jdbctest is also available using another URL on my server, which I definitely don't want!

Sorry for the long winded post
Thanks
 
Sounds like you have Admin access
to your server. If that is the case,
save yourself tons of trouble and
try NGASI AppServer Manager available at
http://www.ngasi.com
 
Same Issues

We having difficulties accessing the MySQL database through JNDI also. We even hardcode DB details into web.xml and this doesn't work.

>>> Did you get a resolution to this issue?

We don't think Plesk is suitable for JAVA applications as there are too many installation issues and no support for resolving them.

Maybe someone from this forum can prove us wrong but at this stage we cannot get any JAVA application working and are disappointed that we have invested alot of time and money setting this environment up to no avail.

Cheers
Gabriel
 
I would not ditch Plesk quite yet.
It is a pretty good general purpose
web control panel. However if you
want serious java support, try the
addon tool mentioned in the previous post.
 
Back
Top