为什么Eclipse不会向Glassfish部署依赖关系? [英] Why does Eclipse not deploy dependency to Glassfish?

查看:187
本文介绍了为什么Eclipse不会向Glassfish部署依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse Helios,Glassfish 3.0.1(完整平台)和myfaces 2.0。



工作区中有两个项目:一个简单的Java项目(=> JP)和一个动态Web项目(=> WP)。我添加了JP到WP的类路径。



我将一个类从JP作为托管bean添加到WP的faces-config.xml文件。

 < managed-bean> 
< managed-bean-name> myBean< / managed-bean-name>
< managed-bean-class> myPackage.MyBean< / managed-bean-class>
< managed-bean-scope>应用程序< / managed-bean-scope>
< / managed-bean>

当我部署包并发出请求时,会显示一条错误消息。它说,无法找到myPackage.MyBean类。



如果我查看部署和运行的WP项目的WEB-INF / classes目录,该目录为空。



我没有在WP本身内写过任何类,但不应该是该目录中的JP类?



我可以用WP来部署JP吗?



提前感谢。 p>

解决方案

您需要将纯Java项目设置为模块/部署依赖关系。在目前的Eclipse版本(Helios,3.6)中,您可以在项目属性的部署程序集中执行此操作。在旧版本(Galileo,3.5及更早版本)中,您可以在项目属性的Java EE Module Dependencies 中执行此操作。然后,它将以 / WEB-INF / lib 中的JAR结尾。


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.

解决方案

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.

这篇关于为什么Eclipse不会向Glassfish部署依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆