-
1. Re: Deployment Order - HTTPServlet lifecycle
wdfink Nov 11, 2010 7:48 AM (in response to jpsabadini)Problem is that the deployment is done in the following order
*.deployer, *.sar, *-service.xml, *.rar, *-ds.xml, *.jar, *.war, *.ear
same files are deployed in alphabetic order.
What help is to move the war file into the deploy/deploy.last folder.
This folder is scanned after all other.
-
2. Re: Deployment Order - HTTPServlet lifecycle
jpsabadini Nov 11, 2010 8:58 AM (in response to wdfink)Hi,
I already change the deployment order... Jboss is deploying ear before war files, but even so the ServletA isn't available until the JBoss startup procedure is done!
Thanks for your help!
JP
-
3. Re: Deployment Order - HTTPServlet lifecycle
wolfc Nov 11, 2010 9:17 AM (in response to jpsabadini)TomcatService adds a NotificationListener on the server. Once the server is started the connectors are started up.
-
4. Re: Deployment Order - HTTPServlet lifecycle
jpsabadini Nov 11, 2010 9:43 AM (in response to wolfc)So, I could implement a NotificationListener that "waits" until the ear is available for requests?
regards,
JP
-
5. Re: Deployment Order - HTTPServlet lifecycle
wdfink Nov 11, 2010 9:53 AM (in response to jpsabadini)I'm not sure whether it will work because there is a WAR included in the EAR file.
Do you test the deploy.last directory (without changing the deploy order)?
-
6. Re: Deployment Order - HTTPServlet lifecycle
jpsabadini Nov 11, 2010 10:18 AM (in response to wdfink)The war and ear modules are in separated files!
I also tried to deploy without alter deploy order, but couldn't solve the issue.
Regards
JP
-
7. Re: Deployment Order - HTTPServlet lifecycle
wdfink Nov 11, 2010 11:28 AM (in response to jpsabadini)How your ServletA is deployed?
Is it accessible if you only deploy your EAR?
-
8. Re: Deployment Order - HTTPServlet lifecycle
jpsabadini Nov 11, 2010 11:58 AM (in response to wdfink)ServletB is in app2.war, that mainly has a jsp and a Servlet (ServletA.java).
Servletb is like this:
public class ServletB extends HttpServlet {
private static final long serialVersionUID = -6262725994880383230L;
/**
* Constructor of the object.
*/
public ServletB() {
super();
}/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
try {
finalizeChronJobs();
} catch (SchedulerException e) {
e.printStackTrace();
}
}public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String command = request.getParameter("command");
if("recreateHashmap".equals(command)){
recreateCameraMonitor();
} else if("refreshHashmap".equals(command)){
initilizeCameraMonitor();
}
}/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/public void init() throws ServletException {
initilizeCameraMonitor();
}
private void finalizeChronJobs() throws SchedulerException{
SchedulerFactory schedFactory = new StdSchedulerFactory();
Scheduler sched = schedFactory.getScheduler();
boolean isDeleted = sched.deleteJob("CheckMessageAge", "CAMSTATUS_CHRONGROUP");
if(isDeleted)
System.out.println("Job was deleted");
else
System.out.println("Job was not deleted");
sched.shutdown();
}
private void initilizeCameraMonitor(){
String cgiResponse = ConnectionUtils.getCamerasToWatchFromVmon();
System.out.println(cgiResponse);
CameraHashMap cameraHashMap = CameraHashMap.getInstance();
try {
cameraHashMap.addCameraMonitor(cgiResponse);
} catch (JDOMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SchedulerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void recreateCameraMonitor(){
CameraHashMap cameraHashmap = CameraHashMap.getInstance();
cameraHashmap.resetCameraHashmap();
initilizeCameraMonitor();
}
}So in init() method I call to initilizeCameraMonitor(), that throws a Exception because queries to ServletA and ServletA isn't available when Jboss is deploying the modules. Remember, I modified the deploying order, so in my Jboss ear files are first.
Thank for your reply!
JP
-
9. Re: Deployment Order - HTTPServlet lifecycle
jpsabadini Nov 11, 2010 12:03 PM (in response to wdfink)Sorry, I explained ServletB, but you asked about ServletA. ServletA is in a war that in turn is inside an ear.
There is nothing special about it. Just reponds to requests (GET method)
Regards.
JP
-
10. Re: Deployment Order - HTTPServlet lifecycle
jpsabadini Nov 24, 2010 2:47 PM (in response to jpsabadini)Hi,
I was searching arround the forum and I didn't find the solution for this... I'm really stuck here. Let me rephrase the problem:
I want that b.war waits until a.war is available for requests.
Remember that a.war is in an ear.
Any hints?
Regards,
-
11. Re: Deployment Order - HTTPServlet lifecycle
wdfink Nov 25, 2010 2:16 AM (in response to jpsabadini)As far as I understand,
ServletA packed in a WAR that is part of an EAR
ServletB is in a WAR and need ServletA within the init()
So I would try to store ServletB.WAR in deploy/deploy.last to ensure it is the last in deploy order.
For me that works for a SAR that need services from an application (EAR)
-
12. Re: Deployment Order - HTTPServlet lifecycle
jpsabadini Nov 25, 2010 9:57 AM (in response to wdfink)Yes, is exactly as you said.
But, what did you mean by store ServletB.war in deploy/deploy.last ? Is a dir that I could create in order to modify deployment order?
Thanks for your help!
Regards,
-
13. Re: Deployment Order - HTTPServlet lifecycle
jpsabadini Nov 25, 2010 10:07 AM (in response to jpsabadini)Just for the record, my org.jboss.deployment.MainDeployer-xmbean.xml is configured like this:
<attribute access='read-write' setMethod='setEnhancedSuffixOrder' getMethod='getEnhancedSuffixOrder'>
<description>Allows the override of the suffix order declared by subdeployers, using the syntax [order:]suffix
</description>
<name>EnhancedSuffixOrder</name>
<type>[Ljava.lang.String;</type>
<!--
Statically set one or more enhanced suffix orders, independent of the value proposed by subdeployers.
Some deployers may also allow the suffixes/orders to be set locally, so that's preferable too.
For reference, this is the list of enhanced suffixes likely to be set by deployers (it may not
be completely up-to-date, or there can be user-defined deployers).
050:.deployer,050:-deployer.xml,100:.aop,100:-aop.xml,150:.sar,150:-service.xml,200:.beans,250:.rar,300:-ds.xml,350:.har,400:.jar,400:.ejb3,400:.par,500:.war,600:.wsr,650:.ear,700:.jar,750:.zip,800:.bsh,900:.last
Until we resolve some startup issues, we'll setup some static enhanced suffix orders bellow
and leave the rest of the suffixes contributed dynamically by registering deployers.
-->
<descriptors>
<value value="250:.rar,300:-ds.xml,400:.jar,550:.jse,600:.ear,650:ServletB.war,750:.war,800:.bsh"/>
</descriptors>
</attribute>ServletB.war is actually deploying after ServletA.war, but I getting a timeout error, because ServletA.war isn't available yet, even it is deployed!
-
14. Re: Deployment Order - HTTPServlet lifecycle
wdfink Nov 25, 2010 1:33 PM (in response to jpsabadini)If you create a deploy.last directory within the deploy folder and place some deployable here it will be deployed after files in the deploy folder.