I have a java application(not a EJB, not a MDB, it has a class implements ApplicationLifecycleListener). I build this java application into a jar file then create an EAR file include this jar, deploy the EAR file on a weblogic server, it works perfectly fine.
Now I want to use weblogic deployment plan to update some of the values in a configuration file which located inside the jar file. I generated the deployment plan, but it does not recognize my configuration XML file. I tried manually add it to the deployment plan, and use the deployment plan to redeploy this application. But nothing is updated.
I have read some examples of updating ejbs, but did not find anything about update a JAR's configuration inside an EAR, can anyone please give me example or send leave a link on how to properly use weblogic deployment plan to update a configuration file inside a JAR which is packed within an EAR file. Thanks.
You probably have to place the XML file in a jar file with same name under the same path as the original and use this jar in AppFileOverrides.
Related
There is a project in github:
https://github.com/chexagon/redis-session-manager
I downloaded and created jar file via maven. But I must use war file for deploying it to Tomcat and use it in our own application. Because of this project doesn't have web.xml file or any entry point (at least I couldn't find it) I couldn't create war file properly. Can anyone help me to solve this issue.
Thanks in advance
The software you downloaded is not a web application. It is a component that can be used as part of a web application.
Correction - Actually it is an add-on component / plugin for Tomcat itself ... that allows the session state of web applications to be persisted in Redis.
Turning it into a WAR file won't help.
Even putting it into your application's WAR file won't help.
The JAR file needs to be copied to the tomcat/lib directory. Then you add a a <Manager> element to the conf/server.xml file. The README.md file describes the attributes of <Manager>.
I have a WAR file that requires additional data from an external config file residing in the same folder as the WAR file.
But once I deploy them to Tomcat, the WAR file and the config file will be residing in different places right?
Do I need to insert a special file path to my project before building the WAR file to make sure that the WAR file will still find the config file after deployment?
Thanks.
You can:
include the config file inside the war and read it from this predefined location. This isn't good if you're going to change it after you deploy since every time you deploy a new war, your changes will be overwritten
put the config file outside the war (and maybe even outside of tomcat) and read it from there. Doing this, your changes will survive redeploys of the war.
I have a simple web application deployed in glassfish as a war file, and there is a class file included in a jar file under WEB-INF/lib folder
also I have a custom .class file developed and I put in under
WEB-INF/classes/...same classpath as in jar file/TheClass.class
However when I deploy the application, looks like that class file I customized does not take effect at all. But if I replace the one in the jar file, then everything is fine.
I have use the same feature on Websphere, Jboss and tomcat, all take the .class file in precedence on top of jar file.
is there any configuration I have missed in the context that cause the weird behavior?
I am really new to WebLogic deployments. I have the below situation:
I have a war file which is already deployed on WebLogic 8.1, I want to pick the same war and deploy it on the same server without bringing the original site down. This would definitely give me a exception saying the context path already exists. I have no way of recreating the war file, hence I will somehow have to modify the war file to change the context root. Is this possible?
And if it is possible could you also confirm that both using the same data-source(JNDI) would not cause any issues to the existing site.
Thanks,
Sahana
Yes you can deploy the same war file multiple times and yes you can change the context root. You will want to do something like the following if you cannot rebuild the war file yourself.
Unzip the war file (jar xvf myfile.war)
This isn't entirely necessary but it will help you understand the structure of the war file. Zip tools can modify a file in place. Try 7zip or use the Windows zip utility via right-click Open
Edit the weblogic.xml file with the new root <context-root>/new-root</context-root>
Rezip the war file (jar cvf mywar.war folder_it_is_in)
Here are other examples that may help as well:
How to deploy EAR application twice on WebLogic server?
How to deploy the same web application twice on WebLogic 11g?
How can I use Weblogic (12 C) without the application context in the URL?
I have this problem. I want to load a properties file located in a war file but the class loader is in another jar file. But they are compiled in one ear file. When I place the properties file in src folder of the jar file's project, it works but I wanted to put it in Web-INF/Classes for future update purposes.
Details.
Compiled in EAR
EJB
IBM Websphere
Thanks!
You war depends on your EJB but the EJB does not depends on your war.
Thus, it's not possible.
If configuration must be updated, you should externalize it.
You won't be able to modify files in your war.
A good practice is to generate EJB jars and WARs independtly of the environment.
It will enable your Exploitation team to deploy the same code in every environment. They will just need to adapt the externalized property files (DB login / password, etc...).