aspose file tools*
The moose likes Tomcat and the fly likes Problems with moving app from Netbeans to Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problems with moving app from Netbeans to Tomcat" Watch "Problems with moving app from Netbeans to Tomcat" New topic
Author

Problems with moving app from Netbeans to Tomcat

aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
hi all,
When I run my applicaton on netbeans it runs fine.
When I move it in tomcat (by moving the content of the build directory) in tomcatHome/webapps/myApp I got a nullpointer exception in line 1 indicated bellow:


the result set in still null in Tomcat ?
anybody knows why ??
thank you.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Where did you put the JDBC driver?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
C:\jdk1.5.0_06\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar
and I have this on the path environment variable.
What can be wrong ?

thank you....
regards,
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Are you sure that's the JRE directory Tomcat is looking in?

As a policy, unless I'm using container managed connection pooling, I always pack all of the needed libraries inside the web application ({your webapp/WEB-INF/lib/{needed jar files}. Then, I put the jars in Tomcat/shared/lib.
aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
Thank you.
How can I know what is the directory Tomcat is looking in?

I am developping the application in netBeans IDE (easier) and then to deploy it I just move it to Tomcat. (by simply moving the content of build directory)

Is this a bad idea.
Is there any other alternatives on how to move?

regards,
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This has really become Tomcat specific so I'm going to move the thread to Apache Tomcat.
Will pick up there....
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What OS are you using and how did you install Tomcat?
aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
I am using Windows XP professional.
I installed tomcat 5.5.17 by double clicking on the .exe installation file.

regards,
Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hi,
Try to run the select query seperately in the databse and check if it returns any rows. Moreover please post the stack trace to help you better.


Regards,
Sivaraman.L
aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
well the same application using Netbeans (when I click build) it runs correctly .
so the query is correct.

here is the stack trace:
java.lang.NullPointerException
signupServlet.processRequest(signupServlet.java:53)
signupServlet.doPost(signupServlet.java:132)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

I think it's the driver.
How can I make sure Tomcat is reaching the driver ??
thank you.

regards,
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by aymane chetibi:

I think it's the driver.
How can I make sure Tomcat is reaching the driver ??
thank you.

regards,



The best way, in my opinion, is to put it under {your app}/WEB-INF/lib unless you are using container managed connection pooling, in which case, you need to make the driver available to Tocmat itself.
If that's the case, put it in
{tomcat home}/common/lib
aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
yes it's working ...
thank you sooo much.


regards,
 
jQuery in Action, 2nd edition
 
subject: Problems with moving app from Netbeans to Tomcat