Reputation: 211
I have inherited an eclipse project which has a couple of dependencies. There is no documentation and the maintainer is no longer available. Some of them were referenced in the project setup and I could just download the correct jars and add them. There are no further references in the build path. But now I see that there are still imports in the source code which are unresolved, like
import org.apache.cxf.*;
import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpServletRequest;
Here is the .project:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Server</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
and .classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/sqljdbc4.jar">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="org.eclipse.jst.ws.cxf.core.CXF_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"/>
<classpathentry kind="lib" path="C:/Users/xxxx/Desktop/Server/src/libs/fontbox-1.8.16.jar"/>
<classpathentry kind="lib" path="C:/Users/xxxx/Desktop/Server/src/libs/pdfbox-1.8.16.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Users/xxxx/Desktop/Server/src/libs/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="C:/Users/xxxx/Desktop/Server/src/libs/commons-lang-2.6.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Regarding the Application Server, I checked with test environment, there is nothing special configured for Tomcat.
My questions are :
Upvotes: 0
Views: 522
Reputation: 1863
The javax.servlet is versione 2.5 in Tomcat 6 from your configuration:
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"/>.
and your application should simply depend on the jars included in Tomcat.
For the CXF I think you should first add a CXF runtime to your Eclipse under: Preferences > WebServices > CXF.2 Preferences > CXF Runtime. The specific version cannot be deducted from what you reported. You can look here: https://cxf.apache.org/download.html
You should consider upgrading Java, Tomcat and CXF to newer versions, since Tomcat 6 is old and in end of life since 2017.
Note: when you build your project the required CXF jars should end up in /WEB-INF/lib in you war. If you run in a Server in Eclipse they will be placed in a temproary folder, something like:
[WORKSPACE]\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\WebServiceProject\WEB-INF\lib\
Upvotes: 1