Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I use Eclipse Juno and I've made 2 projects:

  • One of them is actually a EAR containing an EJB project and a project to hold only the interfaces for the EJBs. 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). Then the project is deployed and the EJBs are initialized.
  • The second project is a simple WAR project depending on the project holding the interfaces. In it I have a dummy servlet calling the EJBs. The procedure of deploying is almost the same. The difference is that I choose WEB -> WAR file in the export navigation menu. After the WAR is deployed everything works fine.

Now the reason I do the whole "Export" thing is because the Run as -> Run on server does not build and deploy my projects. 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...

I know this could be easily done by build script but that is not my point!

Thanks in advance for your help and suggestions.

like image 202
nyxz Avatar asked Feb 17 '23 09:02

nyxz


1 Answers

First of all, check if you have JBoss Tools installed in your Eclipse IDE. 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. In other words, if you are starting JBoss AS from Eclipse, you have to deploy your project to this directory.

You can try this (taken from JBoss community site), helped me too:

  1. Server configuration (in Servers view in your Eclipse IDE)

  2. Deployment > "Use the JBoss Deploy folder"

  3. Save Server configuration

  4. Select your project on server and make a "Ful Publish" using project context menu

  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.

like image 123
Smajl Avatar answered May 09 '23 13:05

Smajl