[
https://issues.jboss.org/browse/GTNPC-76?page=com.atlassian.jira.plugin.s...
]
Matt Wringe commented on GTNPC-76:
----------------------------------
"Still it seems fair to keep the same loading order, no ?"
we can't keep the order the same because its different things which are starting, we
have wci, pc, the portlet and the servlet.
When the server is started:
- wci starts up
- wci get notified that a new war is available and it gets put into a list waiting for PC
to come along and read it
- the servlet starts up
- PC get initialized, reads through the list of wars, finds all available portlets and
initializes them.
Hot Deploy
- PC and WCI are already started
- WCI gets notified that a new war is available, and PC get notified of this new war and
looks into the war for any new portlets
- PC initializes the new portlet
- the servlet gets inialized
The order is the same here, the portlet gets retrieve first and then the servlet. The
reason things act differently is because of when PC gets initialized and when it can
initialize the portlets. Portlets shouldn't depend on servlets to be initialized, its
not designed for this situation (nor do we say we can do this in the documentation).
"When you say "this requires all portlet wars to be modified to include this
special servlet" that would be for portlets we want to hotdeploy, or really all
portlets ?"
All wars which contain portlets, since WCI will no longer be integrated into the web
container and will require a servlet to register each and every war (if the web.xml
doesn't contain the servlet, WCI (and therefore PC) will not know about it). If they
use this approach, when the portlet gets deployed is dependent on a servlet, and therefore
can use a load-on-startup value to determine when it should be loaded with respect to
other servlets.
The way to properly support this would actually be to allow for both the generic (ie no
web container integration) and native (ie web container integration) wci implementations
to be used at the same time. It would work something as follows:
when the server is started
- wci is initialized and becomes a listener for new wars to be deployed in the web
container
- wci get notified that a new war is available, it checks to see if the war contains the
GateInServlet (the generic implementation). If the war contains the GateInServlet, it
skips this war. If it does not contain this servlet, it add the war to the list of
available wars to be used by PC. So, in this case, the sample war is not added to the
list.
- the servlet starts up (the servlet load-on-startup = 0)
- wci get notified of the new war (the GateInServlet load-on-startup = 1)
- pc starts up and searches the WCI list of wars for portlets
- the portlet gets initialized
[NOTE: its a bit more tricky, but we can also configure the setup to load the portlet
first instead of the servlet if needed]
hot deploy
- WCI and PC are already initialized and running
- the sample war is deployed, WCI see that its using the GateInServlet and doesn't
notify PC about it
- the servlet starts (load-on-startup = 0)
- the GateIn servlet starts (load-on-startup = 1) and notifies WCI that a new war is
available. WCI then notifies PC
- PC initializes the portlet
For this to work I need to update WCI to be able to use both configurations at the same
time, which makes things a bit more tricky.
Hotdeploy of a portlet war, see the portlet.xml loaded before the
web.xml
-------------------------------------------------------------------------
Key: GTNPC-76
URL:
https://issues.jboss.org/browse/GTNPC-76
Project: GateIn Portlet Container
Issue Type: Quality Risk
Environment: JBoss EPP-5.1.0
Reporter: Dimitri BAELI
Assignee: Matt Wringe
Attachments: PortletAndServletLoadOrderTest.war, PortletServletLoadOrder.zip
CONTEXT:
* A war with a portlet deployed in EPP/GateIn
PROBLEM:
* As seen in the Forum (
http://community.jboss.org/thread/157804) the servlet / portlet
init order is changing between normal startup and hotdeploy.
* This breaks the hotdeployment of Spring MVC Portlets (which requires the Spring
RootContext to be initialized).
* This is a quality risk as the loading order is not consitent
* This breaks the hotdeployment feature of JBossStudio of manual HotDeployment, and
it's a huge pain for developpers
REPRODUCE:
* To reproduce, I've created a minimalist project (without Spring) that shows the
difference between start order init order (normal/hotdeploy).
* Put the war in a EPP/GateIn deploy dir
* Start the server
* The logs will contain this for the fresh start-up:
{code}
03:14:47,514 INFO [STDOUT] SampleServlet init.
...
03:15:38,088 INFO [STDOUT] HelloWorldPortlet init.
{code}
* Touch the war file in the deploy dir
* The logs will contain this for the fresh start-up:
{code}
03:16:24,907 INFO [TomcatDeployment] undeploy, ctxPath=/PortletAndServletLoadOrderTest
03:16:24,979 INFO [STDOUT] HelloWorldPortlet destroy.
03:16:25,180 WARN [MainResourceResolver] Cannot find servlet context module
03:16:25,181 INFO [STDOUT] SampleServlet destroy.
03:16:25,322 INFO [TomcatDeployment] deploy, ctxPath=/PortletAndServletLoadOrderTest
03:16:25,461 INFO [STDOUT] HelloWorldPortlet init.
03:16:25,467 INFO [STDOUT] SampleServlet init.
{code}
* Where we see that the Portlet is inited before the portlet
EXPECTED:
* web.xml is initialized before portlet.xml when the war is Hotdeployed, like during a
normal startup
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira