Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Class not found in Build Path runs
Class not found in Build Path runs [message #208241] Wed, 06 February 2008 23:14 Go to next message
Eclipse User
Originally posted by: web-100.elephantstask.com

Using Eclipse J2EE 3.3 to build a web application. Tomcat 5.5.25. I have
servlet mapping defined in the deployment descriptor which refers to a
servlet that does not exist in the project source code and does not exist
in any of the jar files on the build path. It once was inside a project
that existed in the same workspace, but to avoid confusion, I took the
project out of the workspace. But somehow this servlet is executing in my
web application. How can this be? Any help is appreciated.
Re: Class not found in Build Path runs [message #208263 is a reply to message #208241] Thu, 07 February 2008 13:37 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1309
Registered: July 2009
Senior Member
lillian wrote:
> Using Eclipse J2EE 3.3 to build a web application. Tomcat 5.5.25. I
> have servlet mapping defined in the deployment descriptor which refers
> to a servlet that does not exist in the project source code and does not
> exist in any of the jar files on the build path. It once was inside a
> project that existed in the same workspace, but to avoid confusion, I
> took the project out of the workspace. But somehow this servlet is
> executing in my web application. How can this be? Any help is
> appreciated.
>

If your servlet declaration includes "<load-on-startup>", then you would
get this exception when the web application is started. If you have
removed the servlet class, it wouldn't hurt to at least comment out the
corresponding servlet declaration and mapping in the web.xml.

Cheers,
Larry
Re: Class not found in Build Path runs [message #208288 is a reply to message #208263] Thu, 07 February 2008 16:42 Go to previous messageGo to next message
Eclipse User
Originally posted by: web-100.elephantstask.com

Hi Larry, Thank you for your response. I do appreciate it.

The load-on-startup option is not being used for any of my servlets at
this time. Yes I could comment out the servlet in the descriptor file,
but I suppose the interesting question is, how is the virtual machine
loading this class? Where is the class file? I can't find it in any of
the Tomcat folders, it's not in the workspace.. Is it cached somewhere? I
can't find it on the classpath, unless there is some area that have not
checked. I don't see any reference to it on my build path..

Before migrating over to eclipse I was testing this application manually
inside of Tomcat. So it may have been 'left over' from that.. But what
does that mean? How do I find it cached somewhere? Hmm.. I had created
a project that contained the file in the same workspace, but didn't create
any explicit references to it on the build path for the web app I am
running. So when it was apparently working, I eliminated the project
folder from the workspace entirely, just for clarification hoping to
generate an error but it still works.

Thanks again for taking the time to respond.
Re: Class not found in Build Path runs [message #208293 is a reply to message #208288] Thu, 07 February 2008 17:37 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1309
Registered: July 2009
Senior Member
lillian wrote:
> Hi Larry, Thank you for your response. I do appreciate it.
> The load-on-startup option is not being used for any of my servlets at
> this time. Yes I could comment out the servlet in the descriptor file,
> but I suppose the interesting question is, how is the virtual machine
> loading this class?

The exception is saying that the VM isn't able to load the class because
it can't find it.

> Where is the class file?

The VM doesn't know either.

> I can't find it in any of
> the Tomcat folders, it's not in the workspace..

This is consistent with the exception.

> Is it cached somewhere?

Apparently not.

> I can't find it on the classpath, unless there is some area that have
> not checked. I don't see any reference to it on my build path..

Also, consistent with the exception.

> Before migrating over to eclipse I was testing this application manually
> inside of Tomcat. So it may have been 'left over' from that.. But what
> does that mean? How do I find it cached somewhere? Hmm.. I had
> created a project that contained the file in the same workspace, but
> didn't create any explicit references to it on the build path for the
> web app I am running. So when it was apparently working, I eliminated
> the project folder from the workspace entirely, just for clarification
> hoping to generate an error but it still works.
> Thanks again for taking the time to respond.
>

The question isn't where is the class, since it's gone. The question is
who is still trying to use it, which implies that use of the class
hasn't been completely removed from the webapp. Is there a stacktrace
associated with the exception? It might provide some clues as to who is
still trying to use the class. Does the exception occur when the server
starts up or when the browser sends a request to the server?

Cheers,
Larry
Re: Class not found in Build Path runs [message #208301 is a reply to message #208293] Thu, 07 February 2008 18:14 Go to previous messageGo to next message
Eclipse User
Originally posted by: web-100.elephantstask.com

Hello again Larry. You've clearly misunderstood my problem. Indeed there
was NO exception being generated. The servlet was responding to the
request, though it shouldn't have been doing so.

All the same, I have resolved the issue. I have reinstalled Tomcat, and
reregistered the new tomcat instance within eclipse and now the issue is
resolved. Attempting to issue the get request with the url that has been
mapped to the missing servlet generates the 500. That is what should
happen. Clearly there was a jar file, or old web app instance inside
Tomcat which was being used, but I don't know how that was happening.

Thanks again for your time.
Re: Class not found in Build Path runs [message #208309 is a reply to message #208301] Thu, 07 February 2008 18:43 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1309
Registered: July 2009
Senior Member
lillian wrote:
> Hello again Larry. You've clearly misunderstood my problem. Indeed
> there was NO exception being generated. The servlet was responding to
> the request, though it shouldn't have been doing so.
>
> All the same, I have resolved the issue. I have reinstalled Tomcat, and
> reregistered the new tomcat instance within eclipse and now the issue is
> resolved. Attempting to issue the get request with the url that has
> been mapped to the missing servlet generates the 500. That is what
> should happen. Clearly there was a jar file, or old web app instance
> inside Tomcat which was being used, but I don't know how that was
> happening.
> Thanks again for your time.
>
Sorry for misunderstanding that "class not found" was expected but not
happening.

Note that if you have a utility project checked on the J2EE Module
Dependencies page in the project Properties dialog, it does not have to
be included on the Libraries tab of the Java Build Path page. It will
be included in the "build path" thanks to the "Web App Libraries"
library container and will continue to be included in the published
webapp. Not knowing how your workspace and server are configured, it's
hard to say how the class would have remained available after the
utility project was removed from the workspace. With the typical
setting, the class would only appear in a jar in the WEB-INF/lib at the
publish destination for the webapp.

Cheers,
Larry
Re: Class not found in Build Path runs [message #208321 is a reply to message #208309] Thu, 07 February 2008 21:14 Go to previous message
Eclipse User
Originally posted by: web-100.elephantstask.com

Larry Isaacs wrote:

> Sorry for misunderstanding that "class not found" was expected but not
> happening.

Ah the subject... That's what you were seeing. I can understand why you
thought I was referring to an exception. I should have said "I" could not
locate a class. Poor choice of subject on my part.

> Note that if you have a utility project checked on the J2EE Module
> Dependencies page in the project Properties dialog, it does not have to
> be included on the Libraries tab of the Java Build Path page. It will
> be included in the "build path" thanks to the "Web App Libraries"
> library container and will continue to be included in the published
> webapp. Not knowing how your workspace and server are configured, it's
> hard to say how the class would have remained available after the
> utility project was removed from the workspace. With the typical
> setting, the class would only appear in a jar in the WEB-INF/lib at the
> publish destination for the webapp.

Thanks for explaining a bit about the J2EE Module dependencies page. I
may have made some settings there originally, and indeed that may have
been the problem. I don't know. But I do like that feature, and I am
using it having reorganized my project settings, the workspace and build
path etc. Very convenient. I do think it is probably a good thing to be
using a Fresh instance of Tomcat as I am setting up eclipse for web
development. As I mentioned, I had been working with Tomcat manually for
a time before using eclipse. I think it may be advisable to start with a
fresh Tomcat instance for Eclipse work.

Anyway I'm up and running for now. I've got things working the way I
need. Thanks for your feedback. I like eclipse quite a bit. It
certainly makes development easier and I am glad that the problem I was
having wasn't an eclipse issue at least not directly. Not if a Tomcat
reinstall clears it up.
Previous Topic:Goto Matching Bracket not working for JSP or JS file..?
Next Topic:Using Java to Consume Web Service
Goto Forum:
  


Current Time: Thu Oct 23 10:24:45 GMT 2014

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

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