简体   繁体   English

Eclipse - >运行为 - >在服务器上运行 - 如何让它与JBoss一起运行?

[英]Eclipse -> Run as -> Run on server - How to get it to work with JBoss?

I use Eclipse Juno and I've made 2 projects: 我使用Eclipse Juno,我做了2个项目:

  • One of them is actually a EAR containing an EJB project and a project to hold only the interfaces for the EJBs. 其中一个实际上是一个包含EJB项目的EAR和一个只保存EJB接口的项目。 I deploy it on the server by going to the: 我通过转到:在服务器上部署它:
    EAR Project -> Export -> Java EE -> EAR file
    and in the destination box I set the auto-deploy folder of the server (which is JBoss AS 6). 在目标框中,我设置了服务器的自动部署文件夹(JBoss AS 6)。 Then the project is deployed and the EJBs are initialized. 然后部署项目并初始化EJB。
  • The second project is a simple WAR project depending on the project holding the interfaces. 第二个项目是一个简单的WAR项目,具体取决于持有接口的项目。 In it I have a dummy servlet calling the EJBs. 在其中我有一个调用EJB的虚拟servlet。 The procedure of deploying is almost the same. 部署过程几乎相同。 The difference is that I choose WEB -> WAR file in the export navigation menu. 不同的是我在export导航菜单中选择了WEB -> WAR file After the WAR is deployed everything works fine. 部署WAR后,一切正常。

Now the reason I do the whole "Export" thing is because the Run as -> Run on server does not build and deploy my projects. 现在我做整个“导出”事情的原因是因为Run as -> Run on serverRun as -> Run on server不会构建和部署我的项目。 I thought that is its primary goal. 我认为这是它的首要目标。 Am I wrong? 我错了吗? Is there a way to make this command work as I expected it to? 有没有办法让这个命令像我预期的那样工作? I think it worked this way with Tomcat and web projects... 我认为它与Tomcat和Web项目一起工作......

I know this could be easily done by build script but that is not my point! 我知道这可以通过构建脚本轻松完成,但这不是我的观点!

Thanks in advance for your help and suggestions. 在此先感谢您的帮助和建议。

First of all, check if you have JBoss Tools installed in your Eclipse IDE. 首先,检查Eclipse IDE中是否安装了JBoss Tools。 You can find them here . 你可以在这里找到它们。

By default JBoss AS Adapter uses .metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss-AS-5.1.0.GA/deploy folder to deploy your project and then register this temp folder in JBoss. 默认情况下,JBoss AS Adapter使用.metadata / .plugins / org.jboss.ide.eclipse.as.core / JBoss-AS-5.1.0.GA / deploy文件夹来部署项目,然后在JBoss中注册此临时文件夹。 In other words, if you are starting JBoss AS from Eclipse, you have to deploy your project to this directory. 换句话说,如果从Eclipse启动JBoss AS,则必须将项目部署到此目录。

You can try this (taken from JBoss community site ), helped me too: 您可以尝试这个(取自JBoss社区网站 ),也帮助了我:

  1. Server configuration (in Servers view in your Eclipse IDE) 服务器配置(在Eclipse IDE的Servers视图中)

  2. Deployment > "Use the JBoss Deploy folder" 部署>“使用JBoss Deploy文件夹”

  3. Save Server configuration 保存服务器配置

  4. Select your project on server and make a "Ful Publish" using project context menu 在服务器上选择您的项目,并使用项目上下文菜单进行“Ful Publish”

  5. Start server 启动服务器

If you have everything configured correctly, the "add and remove" method from the previous answer should be working, too... 如果您已正确配置所有内容,那么上一个答案中的“添加和删除”方法也应该正常工作......

Let me know, if you got it working. 如果你让它工作,请告诉我。

I would recommend another approach. 我会推荐另一种方法。 First Build both projects in eclipse (right click on project -> Build ), then left click on your server -> Add and Remove ... and check if both projects are added. 首先在eclipse中Build两个项目(右键单击项目 - > Build ),然后左键单击您的服务器 - > Add and Remove ...并检查是否添加了两个项目。 Now you can use Run on server or Publish in server context menu. 现在,您可以使用Run on serverPublish in server context菜单。

If there will be still no progress, try to undeploy your projects from JBoss which were Exported to autodeploy directory. 如果仍然没有进展,请尝试从JBoss取消部署已导出到autodeploy目录的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM