Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Missing classes in WST Tomcat server execution(tomcat server ClassNotFound)
icon5.gif  Missing classes in WST Tomcat server execution [message #505111] Sun, 27 December 2009 01:29 Go to next message
Hacking Bear is currently offline Hacking BearFriend
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] Sun, 27 December 2009 02:01 Go to previous messageGo to next message
Hacking Bear is currently offline Hacking BearFriend
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 14:34 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
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: Sat Apr 20 09:47:38 GMT 2024

Powered by FUDForum. Page generated in 0.03467 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top