web application auto install - java

I need to have an autoinstall/update a web application running on JBoss 6.
I need at least to:
* stop the server
* copy the war in the deployment directory
* apply DB update scripts
* start the server
Do you know an tool or open source project for that?
Thx
Christophe

Most Servlet containers have the ability to deploy without stopping the server. Some do it by dropping the WAR file in a specific directory which is polled by the webserver (if configured properly) while others expose "upload" web APIs.
JBoss typically uses Tomcat as its servlet container. While I don't know which version your version of JBoss is using, Tomcat has supported deploying on a running server for a very long time. Perhaps the documentation for Tomcat 5.5 is enough for you to determine what changes (if any) you need to make.
In the event that you really need to stop the server Tomcat has the ability to stop the server from an external program (it only requires the right kind of message to be sent); however, once stopped, Tomcat can't receive a "startup" message, it will have to be started manually.
A better solution would be to detect when the application started by looking at servlet lifecycle events, and then to "check" the database upon a "first started up" event. In the off chance that your database detection shows the database doesn't match the expected version, apply the changes. After the database detection shows the database is up-to-date, then start normal request processing. This isolates the code within your web application in such a manner that allows for easy deployment and upgrades, although it does mean more work in tailoring the application to encapsulate it's own database maintenance duties.
In the event that such a technique isn't an option, you will have to rely on an external tool to get the job done. Typically such a tool requires heavy integration of resources (sometimes across multiple machines). In such a case, an Enterprise Job Scheduler, or a workflow engine (with your own written adapters) is generally applied to solve the issues at hand.

For information, we finally implemented our own solution. Basically
One job downloads from a FTP a ZIP file containing an installer application written in Java
One unzipped, the installer is run. This one executes SQL update scripts, then deploy the WAR file using the JBoss JMX API. However for JBoss cluster support, we had to write our own MBean in order to copy the WAR file on each node.

Related

Diagnose failed deployment

I have to deploy an EAR archive corresponding to a Java EE application in a client's WebLogic server. I have full access to Enterprise Manager but I'm not allowed to deploy through it—instead, I need to invoke a web service that triggers a home-brew shell script. I can see its source code: it first attempts to undeploy the app and (no matter the result) then attempts to deploy the uploaded EAR; each task call a Python script and that's where I lose track. I believe actual work is eventually done by Java libraries from WebLogic Scripting Tool.
The problem is that I'm not getting any error code or message but the application stubbornly remains in its previous release. I'm positively sure there's nothing wrong with the EAR. I've recompiled everything several times and it deploys successfully to the staging server (where I do use EM).
Is there any log file to be found either in Enterprise Manager or Administration Console?

One application code with multiple contextpaths/deployments to connect to different databases

Encountered a requirement in our team when trying to migrate a WebSphere application into Tomcat and deploy onto Pivotal Cloud Foundry to have same application to connect to two different databases which have entirely same schema with different data, essentially having same application code deployed in different paths and be able to connect to the databases based on the URL being called for accessing the application.
Currently, we handle this situation in Websphere by using the deployment script to deploying the application into two servers and give the different database details in JNDI and access the application using the server names.
We use Jenkins to deploy the application onto PCF.
Tried to use maven to deploy on to different context paths which did not help and have ended up in the loop, Have anyone encountered a situation like this, Any thoughts would be appreciated.
I think there are a number of ways you could handle this.
Modify your application so it's aware and let's you pick. Perhaps have a query parameter to select or /dev/blah goes to one DB and /test/blah goes to another.
Push the same application twice, but bind different databases and routes to each app.
Attempt to run two instances of the same app code inside Tomcat in one app on CF.
Of those, #1 is fine but would probably require code changes. #2 would be my choice as it's very quick to do, #3 would be a lot of work because you'd be fighting against the Java buildpack, which is not recommended.
To accomplish #2, you would do the following:
Push your app code as app-A.
Bind the database service.
Map a route with a context path like my-cool-app.example.com/app-a.
Start your app.
Repeat the same for app-B, but use a different database and route/path (i.e. my-cool-app.example.com/app-b)`.
If you are deploying a WAR file, you will need to tell the Java buildpack to deploy your app on a context path (it should match the route context path you set).
cf set-env my-application JBP_CONFIG_TOMCAT '{tomcat: { context_path: /app-a }}'
https://github.com/cloudfoundry/java-buildpack/blob/master/docs/container-tomcat.md#common-configurations
If you're using Spring Boot and a JAR deployment, you'd need to set server.contextPath=/app-a.
Hope that helps!

What's the procedure of upload a java spring based web application to the real server, and how to use load balance to the server?

I am creating a simple web project with mysql database using Java Spring-MVC. Now I want to understand the full workflow of the web system development cycle.
How to upload a project to a real server?.
How to sync the database to a real server?.
How DC and DRC is sync with each other?.
Why and how to use "Load balancer" to the server?.
Apologize, if I said something non-technical.
I'll not go into too much details but here is the gist of it.
Before anything, the first thing to get sorted is the operating system of the server be it Linux, Windows Server and so on. The choice of operating system will depend on the constraints and requirements.
How to upload a project to a real server?
Any files which needs to be served should be hosted and served by a web application server such as Apache Tomcat, IIS, Websphere and many more.
The choice of web application server depends on a few things, such as the server operating system, the web application implementation and so on. For your case, which is a Spring MVC implemented in Java, you'll need to use a web application server that supports that, such as Apache Tomcat for example.
Once the choice is made, install the web application server on the server. After that, install your web application on the web application server.
How to sync the database to a real server?
I infer that you're referring about the connectivity between the Java web application to the database? Do comment if its not.
The Spring MVC web application can connect directly to the database via JDBC or JNDI (provided that the necessary configuration is configured on the web application server).
Of course, the database can be connected locally (if installed on the same server) or remotely.
How DC and DRC is sync with each other?
This is too broad to cover and the recovery strategy differs for every Data Center providers. But broadly, they employ redundancy and replication strategy to ensure the data is always backed up and available. Check with the providers individually for a better picture.
Why and how to use "Load balancer" to the server?
The load balancer primary purpose is to distribute the work load across multiple servers to achieve better TTFB. To do so, it sits in front of the servers and routes the request accordingly. Some of the load balancing solutions such as f5 explains about load balancing in greater detail.
Step 1: Install Application Server on your machine.
Step 2: Install JDK, Database server which are dependent on your application.
Step 3: Export your war from Eclipse/Netbeans
Step 4: Paste your war file on app server's deployment folder (webapps incase of tomcat)
Step 5: your application deployed

How do I debug server-side errors?

Our Java application is going through migration from a WAS 7 server to a WAS 8.5 server - and for some reason, even though our application shows as Deployed in our Admin Console, the application itself isn't coming up on our assigned URL.
I've ruled out the possibility of a code-related problem by testing the application in my local server, so I know the problem is with some server settings - but, almost all of my experience in CS is in coding, and I don't know how to figure out where those settings have gone awry.
What options do I have to debug my application's server-side issues?
You don't specify what you mean by "coming up," so I'll start with the broad suggestions.
A couple things to sanity check:
Ensure the application has been deployed on the specific server you are trying to access it on. It's common to have multiple servers all in one cell controlled by one deployment manager, and applications can be deployed to only some of those servers. In the admin console, under Servers -> WebSphere application servers you can find the server you expect it to be on and check Installed applications.
Check to see if the application itself has started. It's possible the server has been started, but not the application. In Applications -> WebSphere enterprise applications, look for the green arrow next to your application.
If you're trying to access a servlet, make sure the context-root of your web module is set to what you expect. In the application's configuration page, it's in Context Root for Web Modules under Web Module Properties.
If all of those seem correct, or if the application is stopped and won't start, check the server logs in your profile's logs directory, especially the SystemOut.log and the ffdc folder. It may be that an error is occuring when you go to access it, or when it is starting up. Those should appear there.
If your application uses EJBs at a version less than 3.1, the EJBDeploy tool must have been run against your application either before deployment, or as part of the deployment process. If you are expecting the latter to occur, ensure the EJBDeploy tool was installed alongside WebSphere on the target system.
If all of that fails, you may way to break out the debugger (if that's allowed in your environment) and see if your code is even being reached.
Check Server Logs: in WAS Console you can find the logs of your server.
Debug in local server. By deploying an ear in your local server, you can then start the server in loggin mode. Then you shuld stop and restart your websphere aplication and it will be stoped in selected breakpoints.

Where is the application logic in a Java Web Start deployment?

Where does the application logic run in a Java Web Start deployment? I want to understand the intellectual property security risk of Java Web Start. On the client end does it merely start the application on a server and then proceed to process pixels (GUI objects) and mouse clicks at the client? or is my application logic executing at the client?
Implicit in my question is the assumption that I place no value on any aspects of the design that can be inferred by looking at the GUI buttons, text output and by being an experienced user of the application. The value is in the code and logic.
Java Web Start downloads code to the client, and executes it there. The application logic will execute at the client.
Basically JWS keeps local .jar in sync with that on a server to execute an application in local mode. Read about JNLP here.
So the risk for reverse engineering is the same as with any jar packet Java app.
Basically Java Web Start downloads the latest jars (Application Logic) from the server when u launch it with the help of JNLP. and then it installs this application in temporary internet files or cache.
Your whole application logic(cache) exists in cache at client side. and then your jnlp file use them (jars)

Categories

Resources