This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes jdk 1.5.0.22 problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "jdk 1.5.0.22 problem" Watch "jdk 1.5.0.22 problem" New topic
Author

jdk 1.5.0.22 problem

ash neet
Ranch Hand

Joined: Dec 21, 2010
Posts: 33
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

Joined: Oct 25, 2008
Posts: 2700

Please TellTheDetails. Where are you getting the NullPointerException. Can you show a stacktrace?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
ash neet
Ranch Hand

Joined: Dec 21, 2010
Posts: 33
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

Joined: Aug 16, 2005
Posts: 14193
    
  20

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
ash neet
Ranch Hand

Joined: Dec 21, 2010
Posts: 33
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

Joined: Oct 27, 2005
Posts: 19697
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
ash neet
Ranch Hand

Joined: Dec 21, 2010
Posts: 33
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

Joined: Oct 27, 2005
Posts: 19697
    
  20

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

Joined: Dec 21, 2010
Posts: 33
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

Joined: Oct 27, 2005
Posts: 19697
    
  20

Specify -Djava.awt.headless=true as parameter for running Tomcat.
 
GeeCON Prague 2014
 
subject: jdk 1.5.0.22 problem