aspose file tools*
The moose likes Tomcat and the fly likes where to put java classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "where to put java classes" Watch "where to put java classes" New topic
Author

where to put java classes

Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Hi all !
I am using tomcat 4.1. I am importing my java class in jsp but i get an internal server error. I'm putting my classes in .../web-inf/classes directory. This approach does work with tomcat 3.2 and i am able to run my jsp.
I also tried putting my class in ..\tomcat4.1\server\lib, but still things are not working.
I need a some help with this.
Regards
Danish
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

The WEB-INF/classes directory should also work in Tomcat 4.x

What is the error you are getting?
Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Hi !
Thanks for replying, I am getting following error. But this java class and jsp is working fine with tomcat 3.2 when i put java class in WEB-INF/classes directory.
Regards
Danish

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] C:\tomcat4.1\work\Standalone\localhost\wbizzcard\hello_jsp.java:7: '.' expected
[javac] import UserBean;
[javac] ^
[javac] C:\tomcat4.1\work\Standalone\localhost\wbizzcard\hello_jsp.java:13: cannot resolve symbol
[javac] symbol : class UserBean
[javac] location: class org.apache.jsp.hello_jsp
[javac] UserBean bean=null;
[javac] ^
[javac] C:\tomcat4.1\work\Standalone\localhost\wbizzcard\hello_jsp.java:52: cannot resolve symbol
[javac] symbol : class UserBean
[javac] location: class org.apache.jsp.hello_jsp
[javac] bean=new UserBean("danish86","hello");
[javac] ^
[javac] 3 errors
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)
[ May 01, 2003: Message edited by: Danish Shaukat ]
Nitin Barhanpurkar
Greenhorn

Joined: Apr 01, 2003
Posts: 8
Try using package.
Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Hi !
It works with packages
All classes in .../WEB-INF/classes are automatically added in class path of web application.
Thanks Nitin.
Regards
Danish
Majid Khan
Ranch Hand

Joined: Oct 02, 2000
Posts: 92
Can you explain in detail.
I tried with packaging the class files ....
still I face the same problem.
Also what do you mean by the last line
All classes in ....
thanks
Majid
Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Hi Majid,
Got your email.
You also need to have a web.xml file to make your servlets work on tomcat 4.1. Just search this forum and you will find a way how to write it.
Apart from ths every thing is straight forward as explained in previous posts.

Regards
Danish
[ May 28, 2003: Message edited by: Danish Shaukat ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where to put java classes