How to deploy WAR manually to JBOSS 5? - java

I've used tomcat previously for simple apps. When I needed to deploy my application I just packed it with maven to WAR file and then put that app.war to tomcat\webapps and started tomcat.
But now I need to do the same with JBOSS v.5 and I totally cannot understand the JBOSS way :(
PS: I use JBOSS through integration with my IDE but in this particular case I need manual deployment

Place your application inside \server\default\deploy
and from cmd go to
<JBOSS_HOME>\bin
and execute the command
run.bat ---> to run local access only
run.bat -b 0.0.0.0 --> run in broadcast mode, (can be accessed from other system in LAN)
check your app in browser
http://localhost:8080/<AppName>/<Path>

Related

How to configure properties and deploy application from Jenkins to tomcat

Is it possible to deploy a war file from Jenkins to tomcat with an application properties configuration?
Instead of building the war file from any version controll, I want to give a war file directly to Jenkins for deployment. Before that, some application properites(e.g., db connection, third-party services URL) will need to be configured according to the original deployed app and then deployed to tomcat. This might need to be done by writing some script?
For example, the deployed app is version 1.0 and db connection properties is port 5433. The war file which I gave is version 1.1 and the db port default is 5432. So, I have to update the properties in the war to 5433 for db port and deploy to tomcat to get a version 1.1 app and with correct db connectino settings(5433)
Does there have any plugin of Jenkins can achieve this?
Yes, you can do this through the scripts.
In the Build section of the Jenkins there is an option called Execute Shell - there you can do these things
1) Execute the script - which updates properties
sh script_with_changes.sh
2) Copy the war file as shown below using rsync command
rsync -avz /path/where/war/exists/xxx.war username#machineip:/tomcat/path/to/copy/xxx.war

Spring boot application in windows server

I am planning to deploy a web application built on spring boot in windows server.
I want to use tomcat container.
Can I deploy the spring boot fat jar directly or is it recommended to deploy the war file.
please suggest how to deploy and the preferred method?
As Josh Long likes to say "Make Jar not War!" It really allows an application to have flexibility on where it can be run and allows for everything to be packaged as one artifact. Windows has no issue running the embedded Tomcat that is part of Spring Boot and that is exactly what it is doing when running it in your IDE. The one edge case to this is keeping the process running on the server. Normally in Windows you would do that by setting up a service and having that service run java -jar myapp.jar. I haven't personally seen it done so might take some playing around but it is possible.
A simple way to run a spring application in Windows Server is to run it as a service. You can do it using the winsw, that you download its .bin file here
winws download
Then, rename it to something like my-app.exe and create a XML file like this:
<service>
<id>my-app-service</id>
<name>my-app-service</name>
<description>Back end service for app</description>
<env name="HOME" value="YOUR_JAR_FILE_PATH"/>
<executable>java</executable>
<arguments>-Xrs -Xmx256m -jar "YOUR_JAR_FILE_PATH\YOUR_JAR_FILE.jar"</arguments>
<logmode>rotate</logmode>
</service>
Then, using the terminal, run:
my-app.exe install service
Your application is now a windows service and you can start\stop it in the tasks manager on the services tab.
Starting from the latest Windows versions, you could also deploy your Spring Boot app inside a Docker Windows Container. I wrote a complete guide: https://blog.codecentric.de/en/2017/04/ansible-docker-windows-containers-spring-boot/ (as already mentioned, Tomcat is already embedded in Spring Boot).
Spring boot internally has a tomcat server.
If you want to deploy it on tomcat then while building with maven build it as war.
If you want to deploy it has inependent application then build has jar and then place it in some folder and run it using below commands java -jar yourjarname.
Apache tomcat is a web container you cannot deploy a jar in tomcat server. If you created a web application then export your application as war file and put it in tomcat webapp directory, start the server and your war will be deployed.
How to deploy created .jar file in Apache Tomcat server in Eclipse IDE?

autodeploy web service java with glassfish server 4.1.1?

How can I do to deploy the web service automatically,I have the webService.war file ?I'm working with glassfish 4.1.1 and use a external library postgresql-9.4-1203.jdbc4.jar and I dont know how deploy the .war file thanks.
Not sure what you mean by deploy automatically, however, DeshanR's suggestion is still workable even for 4.1.1. You also have two other options:
You can deploy the war file from the browser by pointing your browser to yourdomain:4848. This will bring you to the glassfish admin console (provided glassfish is up and running and your glassfish is set to use port 4848, which by default it should be). You can then deploy your war file under the applications menu.
If this is a dev environment you can also deploy to your local glassfish from your IDE. This is an example for Eclipse. Connecting your IDE to your local glassfish has the advantage of allowing you to publish changes as you make them.
If you're using the postgres jar file for the JDBC driver and Glassfish's Connection Pool, you will need to restart the server to deploy that file after copying it in to your domain/ext/lib directory.
For the WAR, there is the asadmin command line client, your IDE may have direct support to deploy it from there, you can use the GF administration console, or you can copy the WAR in to the domain/autodeploy directory (assuming you have autodeploy enabled, which is it by default).
There are also HTTP and JMX interfaces, but those are probably not what you're looking for.

maven deployment of configuration information to tomcat

In my current development/deployment workflow I deploy my (Java/Spring) web apps to a remote tomcat containers by using the tomcat7 maven plugin.
This makes easy for me to simply deploy the new version of my app by invoking
mvn tomcat7:deploy
My specific problem now is how to correctly handle configuration information: at the moment I keep configuration information (db connection info, passwords, etc.) in .properties files which are packaged with my war and then deployed remotely to the container as described above. An improvement of this process is the use of maven profiles to include different versions of .properties for different target deploy environments.
The problem with this approach is that sentitive information (eg. passwords) are packaged with the war file, while I would prefer to have them somewhere else on the server, visible to the web app (e.g. as part of its classpath), but manageable independently (so as to allow a change in some config settings withouth having to rebuild/redeploy the app).
The only solution I've found so far for this implies the following steps:
1) do not include the .properties in the packaged war
2) deploy the war to the remote server with mvn tomcat7:deploy
3) manually copy the .properties on some server folders where they are accessible from the web app via classpath
In step 3) "manually" means not using maven-based mechanisms for this step. Can someone suggest me some mechanism through which both the packaged war and the configuration files can be separately deployed to a remote server (for instance some ?
For example , you can do this :
1. Create module_config.zip with maven-assembly-plugin contains : *.properties
2. Deploy war with mvn tomcat7:deploy
3. Start script to copy module_config > dir_deploy_application
4. ReStart tomcat7
You can do it with (sh script) or (jenkins)

Debug application in Jboss 5.1 using local debugging mode in Eclipse

I am trying to setup my eclipse project to be able to debug an EJB application that is deployable in Jboss 5.1. To configure the debugging options i used the options described here:
JBoss debugging in Eclipse
I tried the above and it works but with the following limitations:
If i change any code, i have to rebuild the application and re-deploy into Jboss and restart the server. We use ANT to build the project so having to rebuild and re-deploy the application because of a small change is not really ideal.
I managed two approaches:
The first one as described in JBoss debugging in Eclipse. This requires that i copy the war file manually, start up jboss remotely then start the remote debugger in ecliplse.
The second approach is i would still copy the war file manually to jboss but not start jboss remotely. Instead i would start jboss within eclipse. This sort of works but the problem is i still have to do the manual deployment when i make a change.
I have debugged an application within eclipse running in Tomcat before and with that all i had to do is just restart the server if i make a change to the code.
Is it possible to debug an EJB application locally within Eclipse so that if i make a code change all i need to do is restart the server locally and not need to redeploy the war file?

Categories

Resources