We have a couple of JBoss instances using the same JBoss installation and would ask if its possible to declare a datasource(or JMS connection factory) in one location that will be available to all instances.
If you have one data source definition and just you want to install it on all servers you can use one of these methods:
Use RHQ platform to monitor your JBoss server and deploy new application (and also data sources)
Use twiddle command (you can find in your JBoss bin directory) and MainDeployer bean:
twiddle invoke "jboss.system:service=MainDeployer" deploy /some/path/myapp.ear
Just remember that your data source should be accessible from server and will not be install after server restart - after each JBoss restart you need to tun these twiddle command. More info: Application Deployment
If your JBosses servers works in cluster you can try and use farm directory: Farm Management.
You can use SSH (or maybe FTP) server and copy the data source on each location. scp command can be very useful when you connect it with login by keys.
You can create some directory and export it by NFS. Than mount on each machine that directory and tell JBoss to deploy application from it. More info: How to deploy my application in an external directory in JBoss-5.
You can access the data source configured in one instance out side that instance. Check http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/beta500/html/ch13s15.html. Is this what you are looking for?
Related
I'm trying to install the solace weblogic resource adapter as described here https://dev.solace.com/wp-content/uploads/2016/06/Solace-JMS-Integration-with-WebLogic.pdf
The problem is that we are not allowed to manually deploy anything inside weblogic with our infrastructure. This means that in order to get the rar inside weblogic I have to package it inside the ear that also contains the war for our application.
The problem is that once the resource adapter is deployed on the server it still needs to be configured which requires manual intervention and that is again not allowed.
When manually configuring the resource adapter locally it creates a deployment plan that it then uses to configure the resource adapter when the server starts.
My question is, is there a way to somehow pre-package the deployment plan for the rar inside the ear so that I can configure it at build time?
Weblogic handles the deployment plans separately from applications. It is not possible to deploy a deployment plan by pre-packaging it inside of the RAR file.
If you are not permitted to use the Weblogic console, another option would be to
use the weblogic.Deployer Java command which handles the application and the plan separately, but it still gets the deployment done in one command without using the console.
I am trying to deploy a war file in tomcat7. I am using MySQL JDBC driver to connect to database server. The jar file of MySQL JDBC driver is copied to $CATALINA_HOME/lib/ directory and the web application works correctly.
Now, I want to deploy the .war file in Amazon Elastic BeanStalk service. By default, Amazon doesn't place the MySQL JDBC driver in $CATALINA_HOME/lib directory by default and I can't run a script which will ssh into each instance and download the jar in the directory.
Is there any way, in which I can bundle the jar file for JDBC driver , so that I don't have to download and place the jar file in $CATALINA_HOME/lib directory ?
You can place the jar file in an S3 bucket, and then use a EB container command to copy the file to the lib directory, like:
"copy-lib-file":
mode: "000644"
owner: root
group: root
source: https://s3.amazonaws.com/<MY_BUCKET>/<my-JDBC-driver>.jar
No you can't bundle JDBC JARS for Tomcat7:
I've had this issue and it was a nightmare to debug. In my trials and in the documentation you can't bundle JDBC drivers inside your WAR file. Or at least you can but the classloader will ignore JDBC classes that are not in the Tomcat Lib folder. Its in the first paragraph of the Mysql section of the documentation here -> Tomcat7-JDBC I don't know of Tomcat8 or Tomcat9 beta...
Short Term Solution
What I do is exactly what you said you don't want to do and similar to Mark B's solution. I use a script that copies it from s3 but this is really easy and is only 1 line of bash if you use the aws s3 cp command. The aws s3 tool comes installed on the EC2 instance your application will be running on.
aws s3 cp s3://mybucket/mysql.jar /usr/share/tomcat7/lib/mysql.jar
*You will need to restart tomcat another reason you should see the longterm solution
Long Term Real Solution = Automate Your Build Steps
In the end you'll eventually have to run provisioning scripts if your application becomes complex, which is why I stopped using elastic beanstalk and started using AWS cloudformation which gives you a "STEP" where you can throw in all your setup scripts similar to docker build steps. It will also run those configuration steps for every new instance that gets created so there is no needed for you to ssh onto every box.
Cloudformation is all about turning your infrastructure setup into code which you could actually check into github and build without any manual intervention. You go through the headache of configuring your build scripts once then save your environment as a json or yaml file. You can include the MySQL server, tomcat version, firewalls, load balancers etc etc and build that all from a file.
Tomcat, like many application servers, installs a variety of class loaders (implementation of java.lang.ClassLoader) that will give your application access to the JDBC jar resource.
The order is:
Bootstrap
System
Common - $CATALINA_BASE/lib
Webapp - /WEB-INF/lib
Put the jar into the WEB-INF/lib directory inside the application. Note, this JAR will be only visible to this specific application and no others.
In order to do so you need to use .ebextensions.
With .ebextensions you can copy files from your application package to the beanstalk file system.
However keep in mind that no other application deployed in a beanstalk environment will use your driver. Your beanstalk instance is dedicated to one application. Every time you upload the application you have to upload the mysql driver in order to be deployed to the tomcat installation.
Therefore you do not gain anything in terms of upload size or memory footprint in a tomcat (shared jdbc connetion pool through jndi).
It seems that uploading your application with the jdbc driver included (non provided in your maven config) is a more beanstalk oriented solution.
However there are cases you don't want to make any changes in the way your war gets packaged, for example your application gets deployed to an on premises tomcat server containing the jdbc driver and you want to upload it to an elastic beanstalk environment.
In such cases you can consider docker with elastic beanstalk as an option too.
I'm trying to make a java project run on a remote server.
I've used Maven and the project uses a Mongo database. I've got access to a home directory on a remote web server. MongoDB, Tomcat and java are installed so the only thing I have to do is to transfer my Mongo Database and my project and making this all work and run.
However, I'm new to all this and I've got no clue in how to do this. I also can't find anything online on how to archieve this.
How would I go about doing this via SSH?
Additional info:
My project includes:
.js files
.java files
.html files
1 main java class which should run constantly
Actually if you are new for this kind of development, (actually it is more about deployment so popular tag DEVOPS anyway...) take it easy so use your application server and database in the same machine(which is not a suggested way for large systems).
Step 1 For ssh you need to create key read this document and create a key
Step 2 Make a ssh connection to your remote machine like
ssh username#yourIp
it will ask a password enter the password which is given by you when creating the SSH key.
Step 3 Install Mongo DB, Maven, Tomcat, Java to your remote machine.
Step 4 Copy your war to under remote machine webapps
Secure Copy war to remote machine
scp -vC ~/.m2/repository/com/foo/Example/foo.war username#yourIp:/home/Development/tomcat/webapps
echo "Copy to server"
Step 5 Run tomcat server Go to tomcat/bin directory run startup.sh
/tomcat/bin/startup.sh
I have a JRebel+Tomcat server run via IntelliJ on my Work (*NIX) machine, and occasionally I'd love to have JRebel update Classes/Resources when I'm at my home (*NIX) machine remotely connected via SSH.
e.g.
home $ ssh work
work $ cd workspace/foo/bar/baz
work $ hey-jrebel-go-update-classes
I handle this today by VNC'ing into my work machine, then in IntelliJ executing "Update Classes and Resources" on my running Tomcat instance, then log back out.
It's rather silly since I'm already SSH'd in. Is there a way to kick off this process via command-line?
JRebel features Remoting facility, which can be used to sync the changes via HTTP to the remote machine. For that, you should enable JRebel on remote Tomcat (via -javaagent:jrebel.jar) and enable JRebel remote plugin that create an HTTP endpoint for negotiating with the IDE plugin. -Drebel.remoting_plugin=true will do.
For more information you can check the tutorial for setting up Remoting with IntelliJ IDEA and Tomcat.
Otherwise, without remoting enabled, you can deploy the app with the rebel.xml config file which will point to the location where the exploded application is and JRebel will make Tomcat to load the resources from that specific location, so you could just synchronize from IntelliJ to that remote location via SSH. JRebel will then work as usual - monitoring the changes in the specified location and reloading the classes/resources as soon as they are being used in the application.
I'm not completely following what you are attempting to do. But if I follow, you basically want to issue a command to a remote server via SSH and, ideally, launch it from within IntelliJ IDEA. You could either:
Use the Terminal window (Tools > Open Terminal), start an ssh connection, and then issue the command manually.
Create an External Tool definition that uses plink (or an equivalent) to execute the ssh command to your remote server. You can create an External Tool Definition in Settings > [IDE Settings] > External Tools. See the screenshot below for an example. The definition (or its group if using groups to add structure to your definitions) will appear on the Tool menu. You can also map a shortcut to it via Settings > [IDE Settings] > Keymap > External Tools. For a multiple command sequence, you can either
write a local script that does it and use the External Tool definition to launch the script
write a remote script and use the plink in an External Tool Definition to run it
put the commands to run in a local file and use plink -m {file} to run them.
As the question explains I want to deploy a Java servlet based application which is developed on a local server (Apache Tomcat 6.0). I have the IP address, Host name for the new virtual server. I want to know, if it will be just a normal site migration process where I'll have to install Tomcat on the new server and configure the server, web XML files or is there a bit more.
As I have not done Tomcat config before. Any Help would be great
Is there a step-by-step documentation to perform this
Thanks
Download and install Java
Download Tomcat http://tomcat.apache.org/download-70.cgi
Read http://tomcat.apache.org/tomcat-7.0-doc/setup.html
Build your webapp into a war file with your build scripts
Copy the war file into webapps directory under your tomcat installation directory. More details can be found http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html
I find it best to create a script that deploys my webapp from running my build script. And scp and ssh task comes in handy for installing it quickly. There are probably other maven tasks that might work for you.