Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Missing classes in WST Tomcat server execution(tomcat server ClassNotFound)
icon5.gif  Missing classes in WST Tomcat server execution [message #505111] Sat, 26 December 2009 20:29 Go to next message
Hacking Bear is currently offline Hacking Bear
Messages: 14
Registered: July 2009
Junior Member
Hi,

I have created a tomcat server in my WST Server view and add my web project over there. However, when the server starts it seems to have classpath screwed up.

WST creates the run target with the tomcat's boostrap.jar and tools.jar. Its arguments also look correct to me:

-Dcatalina.base=" N:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\ tmp0 " -Dcatalina.home="D:\tomcat" -Dwtp.deploy=" N:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\ tmp0\wtpwebapps " -Djava.endorsed.dirs="D:\tomcat\endorsed"

(I found that the wtpwebapps contains a copy of all my web project files including WEB-INF/lib but no WEB-INF/classes which is the output folder of my web project.)

Upon start, tomcat obviously know my web app as it is trying to find out my context listener class and fails. Then if I add my web project, along with its dependent projects, to the run target's classpath, it would complain javax.servlet.http.HttpSessionListener not found implying it couldn't load the servlet-api.jar

What did I do wrong? What would the correct server run-target classpath look like?


SEVERE: Error configuring application listener of class com.myweb.ServerInitializer
java.lang.ClassNotFoundException: com.myweb.ServerInitializer
at org.apache.catalina.loader.WebappClassLoader.loadClass(Webap pClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(Webap pClassLoader.java:1233)
at org.apache.catalina.core.StandardContext.listenerStart(Stand ardContext.java:3877)
at org.apache.catalina.core.StandardContext.start(StandardConte xt.java:4429)
Re: Missing classes in WST Tomcat server execution [message #505113 is a reply to message #505111] Sat, 26 December 2009 21:01 Go to previous messageGo to next message
Hacking Bear is currently offline Hacking Bear
Messages: 14
Registered: July 2009
Junior Member
I know the partial answer. I have to copy over the WEB-INF/classes of my project and also I need to add the dependent projects (but not the web project itself to the run target.)

Copying classes fodler is obviously not acceptable as i don't know if I'm running on the old classes or newly compiled classes when my java files are modified.

Any clue on these problems?

Thanks
Re: Missing classes in WST Tomcat server execution [message #505696 is a reply to message #505113] Mon, 04 January 2010 09:34 Go to previous message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1296
Registered: July 2009
Senior Member
Hacking Bear wrote:
> I know the partial answer. I have to copy over the WEB-INF/classes of my
> project and also I need to add the dependent projects (but not the web
> project itself to the run target.)
>
> Copying classes fodler is obviously not acceptable as i don't know if
> I'm running on the old classes or newly compiled classes when my java
> files are modified.
>
> Any clue on these problems?
>
> Thanks

Eclipse supports and strongly encourages the separation of source and
build artifacts, such as compiled class files. WTP's Dynamic Web
Project fully supports this. By default, Java source is located under
the "src" folder in the project. The Java output folder defaults to
"build/classes". When the web project is published to a server, the
content under "build/classes" will be copied to the "WEB-INF/classes"
folder of the webapp. Thus, you don't need to do anything special to
get your Java classes under "WEB-INF/classes" in the published webapp.

Is there a reason you have redirected the Java output folder to what I
assume is the "WebContent\WEB-INF\classes" folder? There is some
support for this in WTP, called "single root", but if not configured
correctly, you can get the behavior you are seeing. My picture of
exactly what your project currently looks like and its dependencies
isn't clear enough to speculate further.

Cheers,
Larry
Previous Topic:relative path for web app
Next Topic:Refactoring in .jsp files
Goto Forum:
  


Current Time: Thu Jul 24 09:19:11 EDT 2014

Powered by FUDForum. Page generated in 0.01861 seconds