user1884155
user1884155

Reputation: 3736

Linked projects/folders in Eclipse don't deploy in tomcat

I used Eclipse to create two dynamic web projects. One is meant to build/deployed, the other is a dummy project which contains classes, resources and jars to be included in other projects.

My project layout is like this:

Project PortalLogin

java sources: src folder + resources folder
build
target
common
WebContent/WEB-INF: lib folder + classes folder (actually empty, it is just a linked resource to the lib and classes folder of the common project)


Project PortalCommon

java sources: src folder + resources folder
build
target
WebContent/WEB-INF: lib folder + classes folder

The projects are linked together as follows:

enter image description here

This is also the reason why the "common" folder is present in the layout of the PortalLogin project.

However, when I deploy the PortalLogin Project to tomcat 7.0, the container complains he cannot find the source files of the common project and throws a ClassNotFoundException at the first class he needs:

Caused by: java.lang.ClassNotFoundException: company.acme.portal.common.webapp.UndefinedActionHandler at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216) ... 19 more

I looked into my tomcat server configuration and saw that in the "source" tab both projects were properly included:

enter image description here

The claspath doesn't shown anything suspicious?

enter image description here

As a final check I looked into my file system to see if the Common project has actually builded the .java source files into .classes files, and they are properly present.

My first attempt was using deployment Assembly as described in this question, but when I click on "java build entry", i just see an empty list and I cannot click on anything there.

My second attempt was also using deployment Assembly to add the common project and/or source folder of the common project as following. This did not solve the issue.

enter image description here

Lastly I tried adding the project to the classpath in the tomcat server configuration as described in this question. THIS DOES WORK... but now suddenly my tomcat cannot find any jar in web-inf/lib folder nor any jar in program files/apache/tomcat 7.0/lib. So adding the project there messes up something else and I don't know how to fix this.

enter image description here

Any thoughts?

EDIT: server module overview screenshot

enter image description here

Upvotes: 2

Views: 2718

Answers (1)

outdev
outdev

Reputation: 5492

PortalCommon must not be a web project, it must be just java project.
Add PortalCommon to PortalLogin's "Build Path" and "Deployment Assesmbly"

Then Tomcat>Clean.

Upvotes: 1

Related Questions