autodeploy web service java with glassfish server 4.1.1? - java

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.

Related

Deploy to Tomcat

How can I deploy a war file to Tomcat in exactly the same way Eclipse deploys to Tomcat, if I configured Tomcat in Eclipse?
Reason for asking is that when I deploy with Eclipse everything works fine (databse connection, log4j ect). But when I manually deploy the corresponding war file to the same Tomcat installation, none of my external resources like database connection, logging to files work!
You can add the external jars to $CATALINA_BASE/lib Read here
Common — This class loader contains additional classes that are made
visible to both Tomcat internal classes and to all web applications

Deploy Java Web Project on Tomcat without WAR or EAR

I have a Java Web project (Struts + Spring) working perfectly in my localhost. I have to deploy it on my website, but the Tomcat Manager interface given by the webhost says it cannot upload a WAR file due to safety reasons. When contacting the tech support I was told it is not possible to upload a WAR and that I should try deploying my project by uploading the files directly (I have FTP access).
My problem is that no one at the tech support gave specific instructions on where I should put my project files (I don't know if it should be on de same folder the WAR would be sent to) neither how to start/stop it (Will the Tomcat Manager recognize it once I upload the files?).
You can always try to upload a war file to webapps folder of tomcat.
if tomcat is running with autoDeploy set to true it will auto deploy your application.
i think that the same will happen if you upload the exploded war to the webapps, the context will be the name of the directory you put your files in.
Just place your apllication's root folder to the Tomcat's directory webapps and configure tomcat to auto deploy. Restart the server and your application will be deployed.
You transfer the files to the same place as the war file would go - but just as an expanded war.
Whether or not tomcat will recognise that the files have changed depends on the configuration of the tomcat server. I'd just give it a go - transfer the files and see what happens. If it doesn't pick up the changes then you'll need to find out from tech support how to restart tomcat.

Deploy web application on JBoss via custom installer

I am not sure where should I start from as I have to deploy a web application on JBoss via custom installer.
I have created the Dynamic Web Apllication which comunicates with BES (BlackBerry Enterprise Server) to perform some operations on devices.
Now I want to create a installer file (.exe) file which will take care of following things:
Installation of JBoss server on client machine
Deploy my application on JBoss server
so that I just have to give that installer file to client and on single click the installer will do all the things for me.
Package the normal (unmodified) JBoss distribution into your installer
The installer unpacks the JBoss distribution, and uses jboss-cli.sh to configure it.
The installer copies your application into the deployment directory
Configure and deploy your application on your development system (including data sources etc.)
Package that JBoss installation into your installer (you probably don't need the content in .../standalone/data/)
The installer just unpacks that JBoss installation on the client's system
The 2nd options possibly seems to be easier, but in the long run, the 1st option is superior, because you automatically get a script of all configuration changes.
Note: The 1st option requires JBoss 7

How to deploy a Java EE project to my webserver?

I'm working on my first Java EE project with NetBeans IDE. My application server is the integrated GlassFish.
At this moment my project run locally on my Mac with MySQL database. How can I deploy it on my web server?
You need to just create the war file and copy it to your web server. When you start your web-server it will automatically deploy the war file.
You need to use the remote application server functionalities of deploy.
If it's also Glassfish you can use the Administration Console to do it - e.g. example.com:4848 (defaut port for Glassfish admin portal).
Also you may use Cargo Maven Plugin in order to automate the deploy.
You have different possibilities:
Netbeans can deploy your application on the integrated Glassfish server. This should happen automatically if you Run you project and the Glassfish server is selected for this project. You can change the selected server for every project under Project Properties -> Run
You can deploy .war files via the Glassfish admin console if the Glassfish server is already started. Navigate to http://localhost:4848, go to Applications and click on Deploy
You can manually deploy you applications. You have to copy either the .war file or a folder containing the contents of the .war file to the folder /GLASSFISH_HOME/glassfish/domains/domain1/autodeploy

How to transfer file to server using maven

Once maven creates a WAR file (with mvn package) I would like to somehow transfer the war file onto another server and then execute a command on the server to deploy the war to tomcat. I am connected to the destination Windows 2008 Server via VPN. I can also ping the destination server while vpn'd in from my local machine.
Is there a way to do this transfer of the war from my local computer to windows 2008 server? Would I need to install something additionally on the windows server?
This blog entry details how to use the Maven Tomcat plugin to do this.
Issue “mvn tomcat:deploy” to package your project in a WAR file, and
deploy it to Tomcat server. To verify it, just access to the Tomcat’s
manager page and make sure “/mkyongWebApp” path is existed.
Basically you configure Tomcat to accept a remote deployment, configure your settings.xml with your Tomcat credentials, and set up the Tomcat Maven plugin with the hostname/port etc of your Tomcat server (phew!)
There are many ways, but none of them are ideal. I would personally discourage the use of Maven as a deployment or "devops" tool. If you really need to do this there's a good chance that your requirements are going to evolve and become more complicated as your application develops. Why not just start with CFEngine, Chef, Puppet, or other tools?
Warning aside, you could do the following:
Deploy with scp - The Maven Deploy Plugin can scp a file to a server. This overrides the real purpose of a deployment in Maven, but it will work. (Again the downside here is that you'll be overriding the real way that Maven was designed to work) For this to work you may need to explicitly add the SCP wagon provider, it used to be present by default, but it was removed.
Use Cargo to manipulate whatever server you use - http://cargo.codehaus.org/Maven2+plugin

Categories

Resources