views:

30

answers:

2

I am using Eclipse Helios, Glassfish 3.0.1 (Full Platform) and myfaces 2.0 .

There a two projects in the workspace: A simple Java project (=> JP) and a dynamic web project (=> WP). I added JP to the classpath of WP.

I added one class from JP as a managed bean to the faces-config.xml file of WP.

<managed-bean>
    <managed-bean-name>myBean</managed-bean-name>
    <managed-bean-class>myPackage.MyBean</managed-bean-class>
    <managed-bean-scope>application</managed-bean-scope>
</managed-bean>

When I deploy the package and make a request, an error message is displayed. It says, that the myPackage.MyBean class could not be found.

If I look into WEB-INF/classes directory, of the deployed and running WP project, this directory is empty.

I did not wrote any classes inside WP itself yet, but shouldn't be the classes of JP in that directory?

What can I do to deploy JP together with WP?

Thanks in advance.

+1  A: 

You need to set the plain Java Project as a module/deployment dependency. In the current Eclipse version (Helios, 3.6) you can do it in Deployment Assembly of the project's properties. In the older versions (Galileo, 3.5 and before) you can do it in Java EE Module Dependencies of the project's properties. It will then end up as a JAR in /WEB-INF/lib.

BalusC
A: 

Failing the eclipse tie-in of "Module Dependencies" (or if it all seems complicated) then manually jar the class files of project JP (e.g. as jp.jar) and add the jar to WEB/INF/lib of project WP

this will fix your ClassNotFoundException

chrome