This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdk 1.5.0.22 problem

 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I had created a Project in tomcat 6.0 and jdk 1.6 . It was working fine. after that i wanted to change the server to tomcat 5.0.27 as

our hosting supports tomcat 5.0.27. So I created a new Project with jdk 1.5 and tomcat 5.0.27 settings and copied all the html, jsp

and java files from the previous project into the new project. Now, the problem is I am unable to run files in the new project. it's

giving me the following errors - 'Module cannot be deployed' and 'java.lang.Nullpointer' exception.

what should I do? I have limited time.

Regards,

Ashneet
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please TellTheDetails. Where are you getting the NullPointerException. Can you show a stacktrace?
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:Please TellTheDetails. Where are you getting the NullPointerException. Can you show a stacktrace?


java.lang.NullPointerException
at org.apache.jsp.index_jsp._jspService(index_jsp.java:60)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:619)
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your index.jsp file look like? You are calling a method or accessing a member variable somewhere in the jsp on a variable that is null. Carefully look at the code of the jsp to see what might be null there.

It's possible that this doesn't have anything to do with the version of Tomcat and Java that you're using; maybe you have forgotten to set some configuration property.
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:What does your index.jsp file look like? You are calling a method or accessing a member variable somewhere in the jsp on a variable that is null. Carefully look at the code of the jsp to see what might be null there.

It's possible that this doesn't have anything to do with the version of Tomcat and Java that you're using; maybe you have forgotten to set some configuration property.


Actually when I run the same code in jdk 6, it doesnt give any errors, but if i run in jdk 5 it gives error.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start Windows Explorer.
Go to folder "C:\Program Files\Apache Software Foundation\Tomcat 5.0" (or wherever you installed Tomcat).
Go to sub folder "work\Catalina\localhost".
Go to the sub folder for your web application.
Go to sub folder "org\apache\jsp".
Open file "index_jsp.java". Show us what line 60 is.

With Tomcat, each JSP file gets translated into a Java source file and then compiled. The folder I've directed you to is where these source and class files are stored. The index_jsp.java file is the translated Java source file of your index.jsp file. Inside the _jspService method you will see the code you put in your JSP file. Since the exception showed that the error is on line 60, that's the line you should evaluate.
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Start Windows Explorer.
Go to folder "C:\Program Files\Apache Software Foundation\Tomcat 5.0" (or wherever you installed Tomcat).
Go to sub folder "work\Catalina\localhost".
Go to the sub folder for your web application.
Go to sub folder "org\apache\jsp".
Open file "index_jsp.java". Show us what line 60 is.

With Tomcat, each JSP file gets translated into a Java source file and then compiled. The folder I've directed you to is where these source and class files are stored. The index_jsp.java file is the translated Java source file of your index.jsp file. Inside the _jspService method you will see the code you put in your JSP file. Since the exception showed that the error is on line 60, that's the line you should evaluate.


Object objUser = session.getAttribute("username");
String strUser = objUser.toString(); ---> this is the 60th line. i guess, session.getAttribute is returning a null value.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears so. Now you need to figure out why there is no such attribute. Is the session perhaps new where you expect an existing one?
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:It appears so. Now you need to figure out why there is no such attribute. Is the session perhaps new where you expect an existing one?


The nullpointer exeption is solved. it was the index page, and the username was coming from nowhere. i changed the name of the file and recompiled through command prompt. now other error is coming -

Exception Occurred java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it.

I dont have any idea how to solve this.

Regards,

Ashneet
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Specify -Djava.awt.headless=true as parameter for running Tomcat.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic