Deploy helloworld to wildfly using eclipse - eclipse

I want to deploy my helloworld project to my wildfly (former jboss) application server.
I can use maven mvn install wildfly:deploy and it will deploy the app.
But when I want to use eclipse to run on Server it does nothing.
I don't get a console output or anything which looks like building and deploying.
I added the server runtime to the project and also added the wildfly server.
Why is Eclipse not deploying?

This works for me: do a mvn install in order to build the war and have it at the target folder. Then right-click on wildfly-server. You will see an add-remove option. Click on it, select your project from the list and then add your project to the server. Click finish. If the server is running the project should be deployed.

Another approach would be to simply copy the war from your target directory and place it in the standalone/deployments folder of your wildfly installation.
Make sure that you have stopped the server before copying the war. After you have copied the war to the deployments folder, start he server.
Your application should be deployed successfully.

Related

Running Maven project on glassfish server

I want to run web based Maven project on glassfish server. I am totally new on maven. However, i have successfully build the maven project and glassfish server is up and running also. Moreover, there is WAR file also in target folder but i am confused what is the next step to run that project on glassfish ?
Any help will be highly appreciated.
You have different options to solve this task:
If you are new to Eclipse I suggest to change to NetBeans. It comes with integrated support for application server deployments. You just add your maven (or nearly any other type of project like WAR, EJB and EAR) project and your desired application server instance (Glassfish) and you are ready: Right-click your project and choose Deploy and it'll get deployed to your server. NetBeans also supports hot-deployment.
You can deploy your WAR file manually in GLASSFISH_ROOT/glassfish/domains/domain1/autodeploy and it'll get deployed if your server is running. But this is not very efficient during development.
If you want to stay with Eclipse you can use the maven-glassfish-plugin or this maven plugin to do the deployment for you. I'm not sure which one is better but this topic is also discussed in this question and this question.

Import and run WAR on eclipse

I have a subproject in a Virtual Machine with Ubuntu which I compile with Maven and then run with mvn jetty:run.
Maven also packages it as a war.
All of this works fine and does what is expected.
I am trying to import this WAR from another eclipse in Windows so I have done it by Import -> WAR, thus creating a Web application.
I now want to run it from Eclipse so I have created a new Jetty Server and run my application as Run on Server but I am getting Could not find the main class.
What is the proper way of doing this?
Besides, I have tried deploying the application by putting it in the webapps Tomcat directory . I can see it in the Tomcat GUI and launches the index.html but when I tried to access some of the services it throws No service was found
When deploying, in the Tomcat console I can see runtime NoClassDefFoundErrors.
Is there anything that mvn jetty:run does that the tomcat regular deployment does not? How is it possible that this didn't happen in my Virtual Machine? Shouldn't those classes be all in the WAR?
EDIT:
Here is another hint. When I run the project imported from the WAR in the Ubuntu VM, either with Jetty from eclipse or adding it to the webapps folder it works fine.
It is only hen running it on Windows Host Environment when it fails.
The specific NoClassdefFoundErrors thrown on cmd is the following:
Caused by: java.lang.NoClassDefFoundError: org/ow2/frascati/explorer/
api/FraSCAtiExplorer
That is one of the modules fo the main project.
If you try to deploy your war in tomcat's webapps folder, and if you miss a class, then you probably miss a jar in your lib folder. It is probably a jar that is supposed to be provided by the web server.
We need to know which class is missing.
Finally all errors have been solved by doing the following:
First I recompiled the WAR which did work this time under Jetty in Windows cmd. I apologize as this must be due to some error I still don't know, probably sharing the wrong WAR with Windows HOST OS from the beginning.
On the other hand, the Eclipse was solved by moving the Jetty folder out of the "Program Files" directory. It seems the old Jetty 6 adapter Eclipse comes with does not recognize spaces in its route to the server.

Deploying GWT app to tomcat in eclipse

I want to use tomcat server in development mode with GWT. When I use embedded Jetty it deploys application to the current directory(where my war folder is located). So it generates all the files there. How can I configure eclipse to use tomcat server and all the deployment stuff to be copied to tomcat webapps directory. I have tried to use -noserver option in Run conigurations, but it doesn't copy any resource from war directory to server deployment directory.
Can I use tomcat server in such manner?
P.S. i want to solve this problem withou ant or maven
Using my own server in development mode instead of GWT's built-in Jetty instance
You will need to copy the contents of the WAR folder over, but only once.
Have you looked at Eclipse WTP? It allows deploying to a server right from within Eclipse.
For a GWT project, you'd then, in addition, follow that recipe: http://code.google.com/eclipse/docs/faq.html#gwt_in_eclipse_for_java_ee

deploying a war file in WTP(Eclipse) tomcat server

I have a maven build Java project.
My war file name is: test-1.0-SNAPSHOT.war
I am using M2E plugin in Eclipse.
I have run target mvn package.
Added server as tomcat version 7 in eclipse indigo 3.7. Server started. But my war file didn't deployed in the server.
I have tried by right clicking tomcat server and Add remove..., it says "there is no resources that can be added or removed from the server".
How can i deploy my war file in the eclipse WTP tomcat server?. Do i need to run any maven target?
Make sure that you have "Maven Integration for WTP" installed in your Eclipse instance.
First check if it's available through
Window->Preferences->Maven->Discovery->Open Catalog
If for whatever reason this does not work, you can get WTP integration from this update site (that's the version I am currently using):
https://repository.sonatype.org/content/repositories/forge-sites/m2eclipse-wtp/0.13.0/S/0.13.0.20110623-0455
This integration does a lifecycle mapping of maven-war-plugin into m2e architecture.
Once you've installed the WTP integration, you must restart eclipse and once it's restarted, right click on your web app project and choose: Maven->Update Project Configuration...
Also, I would advise to run a clean build at this time.
Last, but not least, delete and recreate your Tomcat server configuration (I don't know why, but I had to do it quite a few times when I switched to m2e).
I think eclipse is not recognizing your project as a web app, To confirm this
Open to do open J2ee perspective on your eclipse, If you open the project folder of your app, You should see (Deployment Descriptor)
If you don't see it, your app is not web app as far as eclipse is concerned
I have see this in case if you imported/created a maven command line project
To fix this
Select Project ==> Properties ==> Project Facets ==> make sure Dynamic Web Module check box is checked
If you do that the local tomcat server will add your app when do add remove projects
I think eclipse is not recognizing your project as web app,convert your project into web app by command mvn eclipse:eclipse -Dwtpversion=2.0 and try to deploy in Eclipse configured tomcat,it will work.
If you have Eclipse 3.5 or above you should ensure that you have both the m2eclipse (m2e for 3.7) plugin installed and its WTP add-on. With these you shouldn't need to change your configuration by hand.
Did you try to build your project from the command line and deploy it in Tomcat by hand?
By the way, have you read this wiki post? It's a bit old, but it may still be relevant.
Adding 2 cents to Prasanna wonderful solution.
I realized that building maven war files "mvn package" was just creating .war file but eclipse was not picking up that war but was deploying its some internal version of it's app war.
I found that server > Browse Deployment Location.. in Eclipse server view .. it was taking to some abstract location like "C:\Programs\workspaceSTS.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps"
Where I could see my exploded app deployed but it was not having any /classes folder just limited files.
Using Prasanna's method I realized that eclipse now was deploying full exploded .war now.
So this was happening coz changing the facets to Dynamic Web Module has actually populated "R-click project > Properties > Deployment Assembly "
This Web Deployment Assembly window only tells eclipse what to deploy and what not. So even if your project is NOT setup as Dynamic Web Module , and still if you configure "Web Deployment Assembly" values properly , eclipse will deploy the app fine to Tomcat/ Server.

Deploy "exploded" folder to Tomcat in Eclipse

I just installed Eclipse for Java EE developers, Created a New Project by checking out files through SVN from a repository.
I was able to successfully generate an "exploded" web app folder through an ANT build.
How do I deploy this exploded folder (not .war file) to Tomcat? Any configuration that needs to be done?
Thanks.
Just make an ant target that copies the folder directly into the deploy folder of tomcat, usually $TOMCAT_HOME/webapps. Tomcat should then deploy the app in it's container.