Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Source Not Found and JDOMException
Source Not Found and JDOMException [message #191086] Wed, 04 April 2007 17:52 Go to next message
Ben Sisson is currently offline Ben SissonFriend
Messages: 202
Registered: July 2009
Senior Member
I am writing a web application using Eclipse 3.2 and Tomcat 5.5.15.
Within my Eclipse workspace I have a set of JSP files and servlets that
make up the web applicaiton.

The applicaiton has been running fine for some time but I need to add some
functionality. The functionality is used to process and XML file (schema)
that is uploaded using the INPUT TYPE=FILE parameter. I recieve the file
just fine and am able to extract it from the data and write it to a file
within the servlet just fine. I then pass the file name, as a string, to
another class (code contained below) that is only going to create a JDOM
document from the file.

The class that calls this other class is a servlet using the doPost()
method because of the size of the XML files being passed. The code that
creates the instance is as follows:

SchemaHold sh = new SchemaHold();
sh.parseSchema(fileName);

When this codes runs it immediately displays the "source not found"
message. If I continute to run the code the following message is written
to the Console:

Apr 4, 2007 1:48:19 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet DiscoveryMetadataPoolUpload threw
exception
java.lang.NoClassDefFoundError: org/jdom/JDOMException
at
com.database.metadata.pool.DiscoveryMetadataPoolUpload.doPos t(DiscoveryMetadataPoolUpload.java:113)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:148)
at
org.apache.coyote.http11.Http11AprProcessor.process(Http11Ap rProcessor.java:831)

I believe that the error is related to the JDOM processing in some way but
am not sure how. I don't get flagged for any errors and I have a refence
to my jdom.jar in both my windows class path as well as within the project
properties library.

import java.io.IOException;
import org.jdom.Document;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

public class SchemaHold
{
public SchemaHold()
{
}
public void parseSchema(String fileName)
{
try
{
SAXBuilder parser = new SAXBuilder();
Document thisDoc = parser.build(fileName);
}
catch (JDOMException e)
{
System.out.println("JDOMException: " + e.getMessage());
}
catch (IOException e)
{
System.out.println("IOException: " + e.getMessage());
}
}
}
Re: Source Not Found and JDOMException [message #191095 is a reply to message #191086] Wed, 04 April 2007 18:47 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
You don't explicitly say, but I assume you are using a Dynamic Web
Project and a WTP defined Tomcat server. If so, the best way to include
jdom.jar is to place a copy in the WebContent/WEB-INF/lib folder of your
project or include a reference to it on the J2EE Module Dependencies
page in the Project Properties dialog. This will make jdom.jar
available when running the project in a server. Having the jar on the
windows classpath or just on the project's build classpath won't
accomplish this.

Cheers,
Larry

Ben wrote:
> I am writing a web application using Eclipse 3.2 and Tomcat 5.5.15.
> Within my Eclipse workspace I have a set of JSP files and servlets that
> make up the web applicaiton.
> The applicaiton has been running fine for some time but I need to add
> some functionality. The functionality is used to process and XML file
> (schema) that is uploaded using the INPUT TYPE=FILE parameter. I
> recieve the file just fine and am able to extract it from the data and
> write it to a file within the servlet just fine. I then pass the file
> name, as a string, to another class (code contained below) that is only
> going to create a JDOM document from the file.
> The class that calls this other class is a servlet using the doPost()
> method because of the size of the XML files being passed. The code that
> creates the instance is as follows:
>
> SchemaHold sh = new SchemaHold();
> sh.parseSchema(fileName);
>
> When this codes runs it immediately displays the "source not found"
> message. If I continute to run the code the following message is
> written to the Console:
>
> Apr 4, 2007 1:48:19 PM org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet DiscoveryMetadataPoolUpload threw
> exception
> java.lang.NoClassDefFoundError: org/jdom/JDOMException
> at
> com.database.metadata.pool.DiscoveryMetadataPoolUpload.doPos t(DiscoveryMetadataPoolUpload.java:113)
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:252)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:173)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:213)
>
> at
> org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:178)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:126)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:105)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:107)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:148)
> at
> org.apache.coyote.http11.Http11AprProcessor.process(Http11Ap rProcessor.java:831)
>
>
> I believe that the error is related to the JDOM processing in some way
> but am not sure how. I don't get flagged for any errors and I have a
> refence to my jdom.jar in both my windows class path as well as within
> the project properties library.
> import java.io.IOException;
> import org.jdom.Document;
> import org.jdom.JDOMException;
> import org.jdom.input.SAXBuilder;
>
> public class SchemaHold {
> public SchemaHold() {
> }
> public void parseSchema(String fileName)
> {
> try
> {
> SAXBuilder parser = new SAXBuilder();
> Document thisDoc = parser.build(fileName);
> }
> catch (JDOMException e)
> {
> System.out.println("JDOMException: " + e.getMessage());
> }
> catch (IOException e)
> {
> System.out.println("IOException: " + e.getMessage());
> }
> }
> }
>
>
Re: Source Not Found and JDOMException [message #191103 is a reply to message #191095] Wed, 04 April 2007 19:13 Go to previous messageGo to next message
Ben Sisson is currently offline Ben SissonFriend
Messages: 202
Registered: July 2009
Senior Member
Larry,

I want to thank you so much for you help. You assumption was correct that
it is a Dynamic Web Project. I added the jdom.jar to the J2EE Module
Dependencies and that corrected the issue. However, I have a follow-up
question. I had originally added the same jars into the Properties->Build
Path->Libraries where it created a copy of the jdom.jar in the project.
Why did adding it to the J2EE Module Dependencies work and adding it to
the project Library not work?

I have added jars that had dependencies before to the libary as external
jars and not had this problem. For future reference I would like to
understand the differences between the J2EE Module Dependencies and adding
the jar to the Project.

Thanks,
Ben
Re: Source Not Found and JDOMException [message #191111 is a reply to message #191103] Wed, 04 April 2007 20:07 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
The PDE, which handles the project Library feature, doesn't handle J2EE
issues like J2EE project's being hosted on by server as opposed to being
executed directly like Java applications. The PDE also doesn't know how
to include a project's Library jars in the server's classpath hierarchy.

WTP could automatically include project Libraries in the webapp's
WEB-INF/lib. However, it doesn't know for sure if it should or
shouldn't because it doesn't know the full story of what is present by
default in the server's classpath hierarchy. Thus, WTP needs you to say
which jars are needed by your project just at build time (i.e. added as
a Library) or needed at runtime too (i.e. added to the WEB-INF/lib or in
J2EE Module Dependencies, which also includes the jar as a Library). If
you had placed jdom.jar in Tomcat's "shared/lib" (under catalina.base),
adding it to the project as just a Library would have been the correct
thing to do.

Cheers,
Larry

Ben wrote:
> Larry,
>
> I want to thank you so much for you help. You assumption was correct
> that it is a Dynamic Web Project. I added the jdom.jar to the J2EE
> Module Dependencies and that corrected the issue. However, I have a
> follow-up question. I had originally added the same jars into the
> Properties->Build Path->Libraries where it created a copy of the
> jdom.jar in the project. Why did adding it to the J2EE Module
> Dependencies work and adding it to the project Library not work?
> I have added jars that had dependencies before to the libary as external
> jars and not had this problem. For future reference I would like to
> understand the differences between the J2EE Module Dependencies and
> adding the jar to the Project.
>
> Thanks,
> Ben
>
Previous Topic:Multiple "WebContent" folders
Next Topic:[Plugin Dev]Get source folder of the Dynamic Web Project
Goto Forum:
  


Current Time: Thu Apr 25 09:00:37 GMT 2024

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

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

Back to the top