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.
Related
I have an application running in a tomcat container in Windows environment.
When I have to update the application, the tomcat windows service is stopped, new ROOT.war file is copied in the webapps folder and tomcat service is restarted.
Sometimes it happens that the ROOT.war extraction fails and the extracted ROOT folder has only few subfolder and few files. Obviously the following application startup fails.
To solve this problem I have to stop tomcat, delete ROOT folder and run in again to let tomcat re-extract the ROOT.war again from the beginning.
I cannot understand why sometimes it happens and sometimes no. However, it makes impossibile to me to create an automatic update. It is too risky.
Do you have any idea why it can happen?
Resources are not released. So, when you try to update the existing war file, tomcat is not able to delete the older files before deployment/redeployment.
To resolve this issue, ensure that:
The application is not open/running on web browser.
You're not stuck in debug mode when you click on update.
All processes/requests are completed before redeployment.
All files/streams are closed within the code.
When all else fails, you may want to stop the application. Then update. There are ways to stop applications on tomcat using command line, batch files, etc. You can then automate the process.
If you want a more reliable way to do this, you may use jrebel or a free version of the same. There are other ways to update code. Basically, standalone tomcat is not worth anything more than a development server.
Remark: if you are updating the application while Tomcat is running you need to either:
use Tomcat Manager to deploy it,
call tryAddServiced (before Tomcat 9.0 addServiced/isServiced) before any modification to the webapps directory and removeServiced afterwards. This can be done through JMX on the bean Catalina:type=Deployer,host=<your_host_name>,
replace the WAR file (almost) atomically: e.g. deleting the old one and moving (renaming) the new one from another location on the same filesystem should work.
which prevents Tomcat from immediately deploying the application until the copy operation is finished.
To prevent the OS from locking the files in the webapps/ROOT folder you have two options:
Use antiResourceLocking="true" as already suggested by Svetlin, which basically forces Tomcat to copy webapps/ROOT to a uniquely named temporary directory before deployment (the copy will be locked, webapps/ROOT will not),
Use parallel deployment by naming your WAR files: ROOT##001.war, ROOT##002.war, etc. This is basically an explicit version of the antiResourceLocking feature with the additional advantage of letting clients transition fluently between the old and new app version.
We are working on Liferay platform, which uses Tomcat servlet. We have deployed modules, which consist another our compiled jars. Now, we wrote simple program, that monitor our resources and replace them in webapps folder if changes detected. This works fine, but when we are trying to replace sources in compiled jars (js, html etc), then Tomcat detect changes and start redeploy.
Is there any way to replace resources in compiled jars without affecting Tomcat redeploy automatically? Our Tomcat redeploys take a lot of time, and we want to redeploy resources only on demand.
You can disable autodeployment setting Host autoDeploy attribute to false. Then you can use startup scripts, tomcat manager or REST api to redeploy.
<Host autoDeploy="false"
See https://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html#Deploying_on_a_running_Tomcat_server
You can consider also to deploy on demand using the tomcat API and providing a war. There is an Ant task available. See this example
Now here's a mess for you...
I am currently working on an Eclipse RCP application plugin. The goal of this plugin is to serve up a webapp for users to interact with within an Eclipse ViewPart (SWT browser control).
I would like for this webapp to be powered by Struts2 and I already have Jetty at my disposal for serving things up.
Is there any way at all I can deploy a Struts2 WebApp in this way? If more info is needed please ask!
EDIT #1:
Some more detail. The only way I know how to deploy a struts2 application currently is via a war file (hosting on tomcat, that is). This is not something I can do in this case. I need to somehow deploy struts2 internally in an embedded way using the Jetty server provided with the Eclipse RCP framework.
RESULT:
As it turns out you can deploy a WAR file (struts2 app in this case) with embedded Jetty. I found Joakim Erdfelt doing it here: Embedding Jetty as a Servlet Container
Struts2 web application can run in the servlet container like Jetty. Jetty also have an embedded option. Eclipse RCP uses Eclipse platform for extension and customization with plugins. There's an article of using Eclipse RCP with embedded Jetty server:
First, let’s add the jetty plugin to our dependencies. Open the tab
Dependencies in your plugin configuration. Then add these six
plugins to the Required Plug-ins:
javax.servlet
org.eclipse.equinox.http.jetty
org.eclipse.equinox.http.regstry
org.eclipse.equinox.http.servlet
org.mortbay.jetty.server
org.mortbay.jetty.util
In the list of plugins included at the launch of application you need
to change the Auto-Start value for three plugins to true (if you are
lazy, you can turn the default behavior to auto start but this is
another concern):
org.eclipse.equinox.http.jetty
org.eclipse.equinox.http.regstry
org.eclipse.equinox.http.servlet
Now if you run the application you can check if your server is
correctly running by accessing http://localhost. This should work
flawlessly except maybe if you are not allowed to run server in port
80 or there is already a server running in port 80.
You can change the port by adding an argument to the VM arguments in
Run Configurations. Add this value:
-Dorg.eclipse.equinox.http.jetty.http.port=8888. Change 8888 to
whatever port you want the server to be running.
Now if you are running the application, you can access it from the
port you mentioned before.
The next task is to define one (or several) servlet(s) that will serve
any request the server gets. To do this, you need to open the
Extensions tab from your plugin configuration and add a new
extension named org.eclipse.equinox.http.registry.servlets. After
that add new servlet. You need to mention the class name of the
servlet, and an alias for that. One note here is you need to add slash
in front of the alias. For example, if you want to make the servlet
accessible from http://localhost:8888/webserviceInterface, then the
alias value is /webserviceInterface. Of course, you need to
implement a servlet which will do the work you want.
Does anyone know how to update the content of a WebLogic Server's WLS_HOME/server/lib/ folder without having to restart it?
A colleague of mine did a deployment which involved an updated .jar file that was used by all the .ears in the user_projects directory, so he decided to place it in WLS_HOME/server/lib. Whilst the web apps he deployed to user_projects deployed ok, we noticed in the server log it was getting repeated NoClassDefFound exceptions for classes we knew were in the updated .jar - and it didn't pick up the new classes till after a restart.
I need ideally to be able to deploy new shared libraries to this /lib folder without having to restart the server as that involves an outage.
Does anyone know how to do this?
This is not possible. You should move to shared Java EE libraries if you need more flexibility. For your current situation, the only thing you can do, provided you have a clustered environment, is to do a rolling restart of the instances to avoid downtime.
From Understanding WebLogic Server Application Classloading :
WebLogic Server includes a lib subdirectory, located in the domain directory, that you can use to add one or more JAR files to the WebLogic Server system classpath when servers start up. The lib subdirectory is intended for JAR files that change infrequently and are required by all or most applications deployed in the server, or by WebLogic Server itself. For example, you might use the lib directory to store third-party utility classes that are required by all deployments in a domain. You can also use it to apply patches to WebLogic Server.
The lib directory is not recommended as a general-purpose method for sharing a JARs between one or two applications deployed in a domain, or for sharing JARs that need to be updated periodically. If you update a JAR in the lib directory, you must reboot all servers in the domain in order for applications to realize the change. If you need to share a JAR file or Java EE modules among several applications, use the Java EE libraries feature described in Creating Shared Java EE Libraries and Optional Packages.
I am trying to use tomcat with eclipse. I have installed it all and got the tomcat plugin installed. I have put a .war file in the webapps folder of tomcat and have made sure autodeploy is set to true. The problem I am having is that I can't get tomcat to run this .war file. The tomcat server is started and running as it tells me under the servers tab at the bottom of eclipse. It also shows the name of my .war file under it and says synchronized meaning it at least knows its there. But I can't get it to work at all. Even when I go to the local host page it shows the title of apache tomcat but does not show the file. I want it to show me the .war file. It has the correct xml files and everything in it. Any help is much appreciated.
You may try to check whether the application is deployed or not. You can directly go to the Tomcat directory to see this.
Another possible thing could be, you might be typing the incorrect url.
http://localhost:8080/[your_application]
where 8080 is the port you have specified for tomcat.
You need to let Eclipse publish your web project for you when using the Eclipse Tomcat plugin instead of trying to manually deploy it youself.
The Tomcat plugin for Eclipe supports hot deployment whereby you can change jsp's etc without having to manually redeploy your web application.
If you have a valid web project in eclipse then you can check that it is being deployed by looking at the Server View.
Window, Show View, Other, Server
This window should contain details of your Apache server. (If no server is listed then you'll need to right click on the list and set one up.)
To check that your application is being deployed right click on your server and select Add/Remove projects. Check that your web project is listed. If it is not listed under Configured Project then add it.
If your project does not appear in the list then it probably wasn't setup as a Dynamic Web Project. You can fix this by by right clicking on the project to bring up project properties and then clicking on facets and then enabling Dynamic Web Project.
It is also worth having the Console view visible when starting/stopping Tomcat so that you can see the server output.
Start tomcat from the command line (not eclipse) and see if your webapp shows up. It should if you have indeed created a valid war file. If it doesn't work, check the logs.
You shouldn't be manually deploying the war file if you are using eclipse to launch tomcat. Running tomcat from eclipse does not necessarily use the same default workspace as the standalone tomcat. Check the configurations for the 'server': it may be that the eclipse launched server's webapp folder is empty.
If for some reason your webapp failed to initialize properly (error in the descriptor, an uncaught exception in a context listener, ...) tomcat will unload it and you won't see anything at http://localhost:8080/yourwebapp.
Is it there in the list of applications in tomcat manager?
if you havent done this...then follow the steps...
Go to http://localhost:8080/
Go to Tomcat manager and check if your application is there in the list of deployed applications. Try redeploying or starting the application if running=false. It usually tells you what is wrong when you do that.