开发者

Why does Eclipse not deploy dependency to Glassfish?

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>开发者_C百科
</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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜