This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 38819 - Webmodule context property change has no effect in deployment in some cases
Summary: Webmodule context property change has no effect in deployment in some cases
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 3.x
Hardware: PC All
: P3 blocker (vote)
Assignee: Nam Nguyen
URL:
Keywords:
: 38831 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-15 13:53 UTC by Marek Fukala
Modified: 2004-03-15 14:42 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2004-01-15 13:53:55 UTC
[20040114]
If you create or mount a webmodule and change the
context path property before its first deployment,
the application is mapped on the context you
specified. Since that the propertych change has no
effect and the application is still deployed on
the original context (even if you restart tomcat).
Comment 1 Pavel Buzek 2004-01-15 17:53:29 UTC
the problem will most likely be in j2eeserver code
Comment 2 Pavel Buzek 2004-01-15 18:06:10 UTC
*** Issue 38831 has been marked as a duplicate of this issue. ***
Comment 3 Pavel Buzek 2004-01-30 03:48:09 UTC
This is a little problematic. In tomcat we identify the application
with context path and this is in fact the only way how to identify it
AFAIK. It is not possible to redeploy an application when the context
path changes, you would need to undeploy and deploy from scratch (see
that if you undeploy the application from Runtime tab and then deploy
it again it is deplyed to the new path).

The solution is probably to add a special condition for this into
TargetServer.processLastTargetModules. It currently compares what was
deployed to the server and what is there and does not compare the
actual URL of module. If the URL differs from the last deployment it
should do undeploy/deploy instead of redeploy or incremental
deployment. Does this work the same way for S1AS and for other types
of modules, Nam? Thanks.
Comment 4 Nam Nguyen 2004-01-30 14:57:35 UTC
Add Ludo for comments.
TMID.getWebURL() is for web modules only.  Conceivably we can check
for URL when the module involved is web module.  I just want to make
sure that for other platform where webmodule are not identified by
context root (say by relative location path), there are no other side
effects than just a one-time performance penalty of undeploy-fulldeploy.
Comment 5 Pavel Buzek 2004-01-30 18:38:23 UTC
How about checking TMID.getModuleID? That is the identity of module
that can be implemented more generally if, as you say, some server
uses different identification. Tomcat uses the URL for ID.
Comment 6 davisn 2004-01-30 19:06:38 UTC
for j2ee 1.4 what we do is use the initial context root (and prepend
"_" to it to be the unique identifier for the web app.
After that, any redeployment, including of the same we bapp with a
different context root would work...
The main issue with that is that the user has little or no control
about this unique id and this might has nasty side effects.

All in all, this is a serious flaw is JSR88 that takes only archives
or stream and no identifier in order to deploy apps...
TMID.getModuleID should work I think...

We also need to check for the dependancy on JSP source level debugging
to access the repository area for compiled jsps...
Currently, the JSP finder method takes a context root. Could it take a
ModuleID instead?
FindJSPServlet:
public File getServletTempDirectory(String moduleContextPath);
if not, an internal live mapping od contextroot<->moduleID has to be
maintained.
Comment 7 Pavel Buzek 2004-01-30 20:32:31 UTC
There is also an easy solution: if the user changes the context path
property just inform them that they must unload and deploy again for
it to take effect.

Incremental deployment cannot be used in case that the plugin provides
its own location for files to be copied in since that location may
depend on the context path (and it does for tomcat).
Comment 8 Nam Nguyen 2004-01-30 21:04:19 UTC
I think that thing used for ID (whether MID or TMID) should stick with
the entity instance its used to identify.  So why Tomcat cannot assign
some lifetime MID, TMID as J2EE 1.4?

The problem with using TMID.getModuleID is that its does not uniquely
identify a module-deployed-on-target association.  If a deployment
manager has more than one TMID per MID than this scheme would not
work.  Say, if I can't find a TMID match the recorded one I go on to
check MID, and discover a TMID with same MID as the one in current
current recorded TMID of the module provider profile, should I
undeploy that TMID?  I guess I can if it have same target name as the
one recorded.  But I am at lost because why with same MID, same target
name could have different TMID?

Now I think the URL would not work either.  How can I get the web URL
from devmodule API/SPI?  
And this discussion brought up another issue that how we handle
automatic undeploy when we discover already deploy condition.  This
condition would happen on any platform when somehow users already have
 a module deployed (e.g. by some external tool) before any recorded
deployment by the IDE.  I would proposed a AlreadyDeployedException so
that tools can handle the situation gracefully.  This exception should
be thrown by  ID.incremental/initialDeploy or DM.distribute/redeploy
calls.
Comment 9 Pavel Buzek 2004-01-30 21:28:46 UTC
I think tmcat actually does the same thing as s1as. And I see that you
are right that it would be wrong to ask about identity again, I agree
it has to remain the same (i.e. the ID created when first deployed).

so does this leaves us only with the easy solution that I proposed?

as for the other issue you mentioned, Nam, I just got this bug report:
http://www.netbeans.org/issues/show_bug.cgi?id=39428

and I was going to just display the message about failer. How do you
propose to handle the situation better? I think the options are
limited in the running progress bar...
Comment 10 Nam Nguyen 2004-01-30 22:09:02 UTC
Pavel, yes the proposed easy solution could be temporary for now. 
Either you or I will do it in j2eeserver code.  Let me know if you
want me to take this action.

For issue 39428, I think tomcat plugin just need to generate
ProgressEvent FAILED  with proper message enough for user know what to
do, is good for now.

Complete solution for both is to make ID.incrementalDeploy to throws
AlreadyDeployException so j2eeserver would do stop/undeploy and
initialDeploy.  This one we should do after beta.
Comment 11 Pavel Buzek 2004-02-04 22:34:52 UTC
We discussed another solution - to base the indentity of deployed
modules on shomething else then context path. Nam is working
implementation (tx!)
Comment 12 Marek Fukala 2004-02-16 09:34:07 UTC
Pavle or Nam, what is the progress on this issue?
Comment 13 Nam Nguyen 2004-02-16 15:37:05 UTC
This is one of the case covered by auto-undeploy implementation I just
checked in.  Change to new context root value should work now. 
However, switching modules to a shared context root is not supported
at this time.  To enable this Tomcat plugin implementation of
TMIDResolver need to return a TMID when query included module
directory.  Currently the preliminary implementaion I put in would
return emtpy TMID list.
Comment 14 Marek Fukala 2004-03-15 14:42:38 UTC
verified