Deploy to weblogic using maven and jenkins - maven

We are using Jenkins in our project for build and deployment on dev environments. I have sucessfullly created a war file using maven in jenkins and now I have to create another job to deploy that war file into the weblogic server.
However, I am not aware of the required steps for configuring this job in jenkins. Will it be a matter of just invoking a maven deploy command? Can some one please tell me what will be the required steps to deploy a war file into weblogic 10.3.5 using jenkins?
edit : The approach we are following is after creating the war file we are cheking the war file created into svn and then the deploy job will take the war file from there and deploy it into the weblogic. Does some one thing there is a better way of doing thhings than this?
Thanks,
Manish

Use the Jenkins "Weblogic Deployer Plugin". This will do the deployment for you. All you need to do is specify:
Task Name: Give the deployment a name; Eg. Webapp WL Deployment
Environment: Specify the environment you are deploying to. Make sure you are using the AdminServer port number and not the Managed Server port number; default is 7001
Name: The name weblogic should use for your webapp to display the deployed component
Built resource to deploy: The file name of your webapp. You can use also use regular expressions for this
Targets: The name of the managed server you want to deploy the webapp to
Weblogic libraries: Whether or not the webapp should be deployed as a library component.

Related

Docker | How to build and deploy war file in jboss container hosted in Docker

I have a jboss image hosted in Docker, along with several others. I am able to run the jboss image and use it as container to deploy webapps.
Currently using IntelliJ to configure a Docker configuration and deploy war files directly from IntelliJ and pointing to the docker configuration within IntelliJ.
I am looking for ways by which I can deploy this war file directly in my jboss image at Docker.
Basically looking at ways to deploy war file without any IntelliJ intervention, with the use of docker-compose to build jboss image along with added war targets successfully deployed.
What sort of changes need to be done in jboss.yml file and Dockerfile for jboss image?
If you want the .war file to be integral part of your image, then you just need to add it as a file resource to your jboss deployment dir during your image assembly via dockerfile. Say your docker file goes like this:
FROM jboss/wildfly
COPY myapp.war /opt/jboss/wildfly/standalone/deployments/
Of course you need to adjust the paths to match your setup and distribution, you can for example use maven docker plugin.
Other option is just to build your server without any deployments and use jboss cli or web admin interface to deploy it. Again you can automate it via maven or RUN command in dockerfile.

Where does maven wildfly plugin deposit its deployed WARs?

I have been deploying mvn wildfly:deploy successfully for a few days, and I always imagined that deployment would place my foo.war in the standalone deployments folder, but all I can find are some foo.war empty directories in deployments/tmp.
Where is maven sticking the deployed files?
Is mvn wildfly:deploy suitable for production use?
The wildfly-maven-plugin uses management operations to deploy the archive created by Maven. It does not move the file itself as that would not work for remote deployments. Where the deployment content is stored is up to the application server itself.
The $JBOSS_HOME/standalone/deployments directory is used by the deployment-scanner to deploy applications copied there. See the documentation on the deployment scanner for more details.

Spring Maven rest web service - What is the URL when deploying on real web server?

I followed this tutorial https://spring.io/guides/gs/rest-service/ by creating maven project in intellij, addind pom.xml etc. Then I run on localhost exactly as written in the tutorial and all works:
http://localhost:8080/greeting
When greeting came from the annotation of method in the controller #RequestMapping("/greeting").
Then I made JAR artifact & deployed it to Tomact on 'real server' (Elastic beanstalk environment running EC2 instance on AWS).
I got from AWS the base URL of my webserver running Tomact. What is now the suffix to my service? This is NOT working:
http://someEnvironmentName.elasticbeanstalk.com/greeting
EDIT: How I made the artifact JAR
In intellij I can compile & run maven project and then test it in localhost. So what I did:
Right click on the project name->Open Module Settings->Artifacts->Add->Jar
Build->Build Artifacts->Selecting the Jar from above
Maybe I need to build WAR? And how to deal with the POM.xml? Now my pom is exactly as in the linked tutorial.
Thanks,
If you use spring-boot, you donĀ“t need a tomcat because spring include an embedded tomcat. Only you run the application with Maven. So, the advantage of spring-boot is not dependent on an application server and using other containers such as Docker.
Do you put the port in the call to your webserver?
On the other hand, check your server logs to see if there are any problem.
Solution (Thanks to #JBNizet suggestion):
Follow this link http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
Modify the Application.java file
Modify the pom.xml (By adding one more dependency)
Then if you are using Intellij IDE under Build->Build Artifacts will be automatically option for WAR file.
Just deploy to AWS elasticbeanstalk instance running EC2 in the usual way. The URL is:
http://someEnvironmentName.elasticbeanstalk.com/greeting

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.

Weblogic Maven Plugin Deployment Issue

I'm using eclipse Kepler, Weblogic 10.3.5 and Maven 3.0.5 with the Weblogic-Maven-Plugin. When I deploy my application using eclipse Run As...Run On Server, this is what I get:
When I deploy this way, you see the application on the Weblogic Server and I'm able to reach my application through my localhost link.
When I use the Weblogic-Maven-Plugin, this is what I get:
You see the application has been placed under the adminServer and I get an error when I try to reach the application through my localhost link (Yes, I even ran the start-app command).
I have few questions:
Why is it that when I use the weblogic-maven-plugin, it deploys under the adminServer?
Is there a way to have the weblogic-maven-plugin deploy in a similar fashion as the Run As option in eclipse?
Why can I not reach the application with my localhost link after deploying with the plugin?
Any help is greatly appreciated.
I face this problem some weeks ago but in another environment Jdeveloper 12c with Maven and OJMake and OJDeploy.
The deployment is the last step on your way to run our application on WLS(WebLogic Server)
How do i solve the issue?
I create an Maven Ear projet
I create also Maven War project
I add the war project in the ear project also dependency and later also web_module
My deploy(to WLS) Configuration is in the pom from Ear project.
I you use run as from Eclipse or Jdeveloper there is a complex mechanism which do the work for us. If we want maven to do the job for us, then we must tell him what to do. We must also know what type of archive file we suppose to send/deploy to WLS

Resources