automatic redeployment of aar file in JBoss AS on exception - jboss

I have web services deployed as AAR(Axis Archive) within JBoss AS 6.1.
I would like to know if it is possible for a java program in aar
to automatically redeploy itself on some critical exception.
I hope I may embed some codes to tell the container(JBoss AS) inside try ~ catch block to
redeploy my java web service in aar form without human intervention.
Anyone knows about this?

You may refer to my idea.
https://community.jboss.org/thread/243356
This is the proposed solution that I have not yet done.

Related

Build vs Deploy vs Publish (Eclipse IDE)

I'm a newbie to J2ee though not a complete newbie. I'm unable to find a good resource (book or video) that could help me understand what exactly happens when we build, deploy and publish. I have a fair idea though. So my questions are -
Is there a good resource out there that can help me understand these concepts? I've read some books on struts and servlets/jsp but they don't delve into eclipse and how/what it does. The eclipse documentation has been helpful but only slightly.
When we build an application the the java files are converted into the class files and stored in the java build path. What else happens during build? Many people use the term 'library dependencies', what does this mean? Also, when people refer to dependencies do they refer to files like xml and tld?
At what stage (build or run on server) does the container check to see if the dependencies are alright? Say for instance, if the servlet class/name in the web.xml file.
Is it appropriate to say that build is basically compilation while deploying the project and running it is the same as executing it?
Familiarity with the servlet specification would help you (perhaps some older version would be quicker to read like 2.4), but general understanding of what you build and how you do it in Eclipse is what you are after.
The way I see it is that during the build Eclipse creates almost complete version of WAR (or some other archive, if you use EJBs for instance) and by publishing you deploy it to some server (this is practically the same thing although Eclipse might just configure the server to use exploded WAR that it just prepared instead of copying it to some "deploy" dir that you are supposed to do if you work without an IDE).
If you configure your project well, the build can only mean compilation, but if you have more ceremony in it, then some source generation and moving files around might happen too.
To address your second question, library dependencies can be files that reside in WEB-INF/lib for instance. Read the spec to know what should be there and what should not. Eclipse tries to copy there all defined dependencies of your project.

Deploy a service before deploying a portlet

I have to design a service builder in Liferay which retrieve data for the look and feel. Then this service have to deploy before deploying look and feel. I don't know how to deploy this service. Actually, I obtain an exception of type "no bean named...is defined".
Thank you in advance,
Best regards.
You can declare dependencies in WEB-INF/liferay-plugin-package.properties. The easiest way to do it is to look it up in other plugins or use Liferay IDE or Developer Studio to edit the file as it comes with a form-based editor, recognizing the file content.
This dependency will make sure that the plugin containing your service will deploy before everything else that depends on it. Dependent plugins will not be deployed until their dependencies are satisfied.
From the sample file here:
#
# Specify other plugins that depend on deployment of this plugin. Some
# plugins require this in order to rely on services and features provided by
# other plugins.
#
#required-deployment-contexts=
#required-deployment-contexts=\
# chat-portlet,\
# flash-portlet,\
# sample-service-builder-portlet

How can you develop bottom-up JAX-WS web services referencing classes contained in separate jar files?

I am developing a Java EE 6 bottom-up JAX-WS to expose an EJB3.1 stateless session bean. The web service in a WAR is failing to install on deployment because it references an external jar (or shared library) which one can assume is not loaded yet.
The common suggestion is to include the jars in the /lib folder, which does fix the issue, however the jars need to remain in this external shared library location and NOT in the ear file, because they amount to 30MB.
What are some techniques to get around this issue in a Websphere (WAS v.8) environment or any server environment.
Some suggestions I have found include:
1. define classpath in META-INF file.
2. define the resources in deployment.xml
3. alter class loading order
4. (from ibm) In the case where the jars are part of a Shared Library configured on WebSphere Application Server, then a User Library must be used to configure the project for development before generating the WebService.
However, I have been unsuccessful to find any help online in these areas. Is there another technique or does anyone know anything about accomplishing this? Thanks in advance.
EDIT: If I specify the libraries in the META-INF using class-path, they are loaded before extensions, shared libraries..etc, but they are still loaded after the WAR which is not good. Again, this isn't a runtime issue because the web services are created at deployment on the fly.
I submitted a ticket to IBM. The libraries referenced by the web service are needed during deployment and must be bundled into the Ear in some fashion. I threw them in the web-inf/lib folder. However, if the referenced libraries then depend on additional libraries, these can be placed in the Shared Libraries. Seems odd to me too, but let's all just admit "shared libraries" are a hack anyways.
If you still have issues, just make sure your class loading is set to parent_last.

JBPM workflow deployment into alfresco error

I'm getting the following error when deploying from JBPM eclipse interface to alfresco. This happens when I select 'classes and resources to include in process archive', like 'src/main/java' etc.
Exception happened while deploying
java.lang.NullPointerException
at org.jbpm.gd.jpdl.util.ProcessDeployer.addClassOrResource(Unknown Source)
It was working perfectly, just stopped working suddenly. Any clues?
Thanks.
You should try not selecting anything in the Java Classes and Resources pane. You should be able to deploy your process definition XML file. If you have Java classes specific to your process definition, just have your build script JAR those up alongside your other Alfresco related Java classes you may have and put those in WEB-INF/lib.

Eclipse OEPE compile needs server restart

I have a Java GWT-Spring-JPA project that I am developing in Eclipse with the OEPE plugin. When my server(Weblogic is running), if I compile the code, and reload my webpage without restarting the server, I get a strange error message, and I have to restart Weblogic for it work.
At one particular point in the code, I get a ClassCast exception to the effect Cannot cast class A to class A !!
Sometimes I get an error during the compile to the effect - Error compiling because jndi.properties file could not be deleted. Anyone seen this?
These errors are really slowing me down! Does anyone have any solutions please?
Any input much appreciated.
You should use development mode as you are already and do a exploded deployment from your app diring development in the default auto-deploy directory in your weblogic domain, in the link below you will find general guidance on it.
http://download.oracle.com/docs/cd/E21764_01/web.1111/e13706/toc.htm
If you are using Ant you may use the wldeploy ant task for that:
http://download.oracle.com/docs/cd/E21764_01/web.1111/e13706/splitcreate.htm#WLPRG182
Well with this environment configured you wont need to restart when you have a static or a page updated it will do it automatically and if you need to force a general classloading update you could have a REDEPLOY file in your split directory(META-INF if using .ear or WEB-INF if using .war) that whenever you do a touch(change it) on it, weblogic will restart your app context WITHOUT restarting the server, updating the class loader for your app and possibly solving your problem.
regards.