Eclipse Mars + Wildfly 9 + deployment not working - spring

I have a Java Spring application, configured in Eclipse Mars and I am running Wildfly 9 from within Eclipse. I am using the wildfly-maven-plugin to deploy to server.
These are the steps I follow:
Start the server from Eclipse and do maven build which also deploys the application to server. I can see whole lot of logs on server of "successful deployment"and I can access my application in browser. It creates a folder under "/standalone/data/content" but no war or exploded WAR under "standalone/deployments"
If I change some code and save it in Eclipse, (I have checked Automatically publish check box and build on save), the server logs says:
Replaced deployment "myApp.war" with deployment "myApp.war"
Content removed from location "standalone\data\content..."
And I see the prev folder created during step 1 is removed and myApp.war is added to deployment folder. But now I can not access my application in browser.
auto-deploy-exploded="true"
That is in the section of standalone.xml.

Related

How do I go from a Maven Dynamic web project to some executable

I have a Maven Dynamic web project in Spring - I can run this in eclipse with a tomcat server and serve all my code a web page via localhost.
I am looking to create an executable which can be ran locally on a machine with no internet connection and when ran will serve the web project to a specified localhost URL.
If you have included an embedded server (like tomcat) as a dependency in you POM.xml file, then you have to Right Click on your Project -> Run as -> Maven Install. This will build a Maven Executable Jar file in the target folder of your Maven Application.
Take the Jar file and Run it from command line using
java -jar <jarfilename>.jar
After building project you will have <project_name>.war file created in target folder inside the project.
You should deploy it to a J2EE application server, like: Glassfish, JBoss Wildfly, etc.

Jelastic - deploy from maven generates both WAR and EAR files and fails

I am using Jelastic and I have an environment with a WildFly 10.1 node and a Maven 3.5.0 node. When I click "build and deploy" on the project in the Maven node my application should build and deploy a EAR file.
However, after the first time I do that, the deploy fails, and when I check the WildFly admin console there is a EAR and a WAR file. I have no idea where this WAR is coming from, and I can't find such file in the "target" folder either.
Checking the WildFly log, I see a "org.jboss.msc.service.DuplicateServiceException: Service jboss.naming.context.java.app.myapp-dev is already registered"
If I remove the war from the admin console, disable the EAR and re-enable it, the application works.
I don't know exactly how Jelastic works with maven, but I believe there is no problem with my pom.xml files.
Thanks in advance!
edit: here's the pom.xml for the project root, and the pom.xml for the inner EAR module.
Automatic build and deploy functionality in Jelastic is designed to build all the targets specified in pom.xml and deploy all the built artifacts to the app server.
If multiple targets are specified in root pom.xml of the project, all of them will be built and deployed to the app server, not only the .ear target.
Please try to deploy the subproject with the inner EAR module with the appropriate pom.xml as root project file to build and deploy only the *.ear file.

ClassNotFoundException in spring project with maven

I have created a spring project with maven and it works fine. I am trying to add a jar file to the project, eclipse does not give any errors but when i start the server and try to access to the page which uses a class from that jar file i get a classNotFound exception.
My steps are..
1 - I put the jar file in src->main->resources
2 - I added it to build path by right clicking and saying add to build path.
3 - I add the project to tomcat and start the server
The thing is i looked at the tomcat deployment directory and the .jar file appears in classes directory. When i take copy the file from classes to lib (which has libraries downloaded by maven) project works fine.

Deploying on JBoss EAP 6 using Jenkins and Maven Deploy plugin

I am setting up a CI environment to build and deploy java projects to a remote server using mvn jboss-as:deploy goal.
Couple of questions
1. Do i need to do anything specific on jboss standalone.xml to enable hot deployment. For example
auto-deploy:exploded option needs to be enabled?
Presently the deployment is manual process: copying the war to deploy folder and then touch the ar file. Do I need to remove the old wars under deploy folder for remote hot deployment to work successfully?
Once hot deployment is performed using jenkins, if a server restart is performed, older version of the war is getting deployed. Any clue on this?
Please help.
I figured out the issue. Since previously the war was deployed manually, I had to remove the war files from Standalone/deployments folder. On a server restart the war under this folder would be deployed causing older version of the application to show up.

deploying multple war files using intelliJ IDEA

I have a maven based spring mvc project. I can build that project and run it via tomcat manually like this
mvn package -Dbuild.name=App1
mvn package -Dbuild.name=App2
mvn package -Dbuild.name=App3
and then can copy those generate war files App1.war, App2.war and App3.war into my tomcat folder and start it. It works fine.
Question is how to do the same using intelliJ IDEA?
I generated war files one by one by using Maven Project window and creating custom value for package goal. It generates .war files in target folder. But when I run it in Tomcat of intelliJ it only runs the application at root "/" address. For other addresses
/App2 -> 404
/App3 -> 404
You can have multiple artifacts created in IntelliJ IDEA and configured for deployment at the same time in the application server Run/Debug configuration, Deployment tab under different contexts.
Note that Deployment tab has a configuration to perform the deployment from the External source where you can specify the location of the war produced by Maven if you don't want to use artifacts for some reason.

Resources