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, <strong>but shouldn't be the classes of JP in that directory?</strong>
<strong>What can I do to deploy JP together with WP?</strong>
Thanks in advance.Answer1:
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 <em>Deployment Assembly</em> of the project's properties. In the older versions (Galileo, 3.5 and before) you can do it in <em>Java EE Module Dependencies</em> of the project's properties. It will then end up as a JAR in
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