Does anyone know the best way to deploy only a bug-fixed class if a bug is found in a Web application running on WildFly and it is fixed?
If using Tomcat instead of WildFly, I will deploy the class in webapps/my-app/classes/ with package directories in order to minimize an influential range of the changes.
What would you do if you are using WildFly?
you can use the 'same' things in wildfly with deployments in the deployments folder, but you can also use overlays to 'replace' a class or file with an overlay. Using exploded-deployments you can also replace a class file in a jar / war / ear. please note that you might need to redeploy the applications after that.
Related
I would like to know whether it's possible to deploy customized Java service class to activiti without restart the application server (wildfly in my case).
Currently, I have to put the jar to classes folder and then restart the whole server. I have already tried HotSwapAgent but it seems not work.
We are addressing this problem in Activiti Cloud: https://activiti.gitbooks.io/activiti-7-developers-guide/content/
But as Philippe mention, if your class is code that changes quite often, you should think about having a separate service for it.
In case of war file deployment, there are two possible ways to resolve dependency in Jboss EAP:
we could keep all the dependent jar files in Jboss modules and get access of them using jboss-deployment-structure.xml file.
we could keep all the jar files in WEB-INF/lib folder inside war file.
Which one is the best practice to follow and why?
It depends on what you prefer.
#1 means you need to configure server and application(s), and this is more effective when you have more applications on server using these modules as dependencies. So you save space from duplicating libraries in more applications.
#2 means you have almost all dependencies in your deployment application => bigger file/directory (but don't forget some dependencies are automatically enabled by container based on what you use Servlets, JPA etc.).
I have created and deployed one war for my application.
I wanted to use derby for integration testing so I created one module in Jboss.
At run time I am getting ClassCastException for same class, since the class is getting loaded twice: first from war, then from my module's jar.
To elaborate, my war, say application.war contains myderby.jar and under my module i have added myderby.jar .My class, say Custom.java, is present in myderby.jar.
If you want a jar to be accessible to multiple WARs, JARs, or an EAR and a WAR/JAR - or in fact any such combination, you can include it as a global module. Here's how it can be done.
This might also help.
As Suggested I followed the following link
https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Add_a_module_to_all_deployments.html and it worked for me.
The object is to build .ear by using ANT then deploy it on Websphere 8.5 with wsadmin.
Manually, the ear file is generated from a jar file and after deployment, the web application works very well.
But if I use the ear generated by ANT, after deployment (by hand or by wsadmin), I always have this error :
SRVE0255E: A WebGroup/Virtual Host to handle /WebApp$%7Blogout.url%7D has not been defined.
SRVE0255E: A WebGroup/Virtual Host to handle localhost:9080 has not been defined.
Someone knows which might invoke this problem. I met this message before while my colleague deploy on websphere with a war file directly from a Tomcat server.
Thanks in advance.
It looks like you have not defined web application bindings during deployment. There are several ways to do this, but before that I suggest that you read about Application bindings in WAS, especially the paragraph Virtual host bindings for web modules.
Required bindings can be provided either as parameters to install command of AdminApp or by including binding files directly inside WAR. In some cases WAS can generate default binding for you. For example, to install web application with default bindings you need to provide the following command to wsadmin (simplified):
AdminApp.install(path_to_your_war_file, [
'-appname', your_app_name,
'-CtxRootForWebMod', [
['.*', '.*', your_app_context_root]
],
'-usedefaultbindings'])
I also recommend deploying application once in WAS console to understand possible bindings.
We have ".sar"(Service Archive file) used in jboss. Currently we are planning to migrate the code to Weblogic.
Is there a way to deploy .sar files into weblogic.
If not directly possible, is there a work around where we can deploy the services on web logic.
In order to get the custom mbeans that are in the .sar you will need to repackage the contents as an .ear as a .sar is not standard Java EE deployment mechanism - that is a JBoss proprietary archive.
Here are some instructions on how to create, package and deploy your own service MBeans (JMX Beans) along with an example of how to use it.
https://blogs.oracle.com/WebLogicServer/entry/developing_custom_mbeans_to_ma
One thing you could do is to "substitute" or "emulate" the SAR Deployer, by creating, configuring and registering MBeans. That, AFAIK, could be done in two ways:
1) Using Standard Java EE components: that means on web tier you can use the init() method of a servlet (make sure that it is preloaded on startup) or, better, a ServletContextListener
2) Using WebLogic specific components. I'm talking about Startup classes. Simply register a startup class that creates, configures and registers your MBeans.
If you are using a web module, the first approach has the obvious advantage that you are using pure Java EE components. Although you are not using that, you can add a "dummy" web module only for doing that
Concerning what you have to do in those classes, you can choose a "from scratch" approach, by parsing the xml files that describe services and therefore manually create, configure and register MBeans or, if I remember well, the XMBeans from JBoss is something that can be reused outside JBoss but you need to check because I'm not sure