JNDI Datasources from Glassfish to Tomcat (plesk)
Posted on 2011-05-05
I have a JSP application which was developed in netbeans for glassfish. It works 100% and has no problems. Recently, I was told that we were scrapping glassfish for tomcat, and to migrate our glassfish app over. Simple enough I thought.
So far nothing works. I have changed the project type to tomcat under netbeans, it compiles and uploads to tomcat just fine, however, NONE OF THE DATASOURCES WORK.
I did some more reading on tomcat, and realized that the datasources have to be configured using server.xml. I made the changes, and saved. The app still doesnt work.
Upon investigating on google I found otu that since we are running tomcat on plesk, the datasources cannot be stored in server.xml, but need to be put somewhere else. It didnt however tell me where else to put it.
I am sick of looking, and figured it would be easier to just ask. Im sure someone out there has already gone through this headache in one form or another.
So my question is: "Can someone out there give me an example of how to create JNDI datasources under Tomcat in plesk?"
As an example I refer to the datasources in my servlets like this:
context = new InitialContext();
ds = (DataSource) context.lookup("jdbc/tracking_pool");
The database is MySQL 5.
A working example is worth 500 points.