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 236129 - Context root placeholder in glassfish-web.xml is not replaced when run/debug is called
Summary: Context root placeholder in glassfish-web.xml is not replaced when run/debug ...
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-19 06:33 UTC by matsa
Modified: 2016-07-07 08:55 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
simple enterprise project (11.95 KB, application/x-zip-compressed)
2013-09-29 07:24 UTC, matsa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matsa 2013-09-19 06:33:55 UTC
I have a Maven property placeholder in my glassfish-web.xml for the context root called ${fdb.context}. When I run with my appropriate Maven profile I encounter:

com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.net.URISyntaxException: Illegal character in path at index 14: jndi:/server/${fdb.context}/WEB-INF/faces-config.xml
	at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:751)
	at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:349)

In summary: 

* JavaEE7 project
* Glassfish4
* If I deploy my ejb module which uses the web module it deploys correctly.
* If I deploy my war module directly it fails.

The built files in web/target are all correctly built. I'm wondering why NB doesn't "honor this".
Comment 1 Martin Janicek 2013-09-25 12:10:21 UTC
Not sure if I understand you correctly, but are you trying to use properties defined in pom.xml within glassfish-web.xml file? Are you able to deploy your application without using NetBeans?
Comment 2 matsa 2013-09-25 12:13:32 UTC
Yes, that's what I'm trying to do.

I can successfully package my application as either WAR (or wrap it into an EAR) and deploy it manually. I does this continually.

But I can not deploy the WAR to Glassfish4 inside NetBeans.
Comment 3 Martin Janicek 2013-09-25 13:16:58 UTC
Ye, I guess this is caused by the fact that you are trying to "run" your application. You should be able to "deploy" it correctly even using NetBeans but when you want to run it, NetBeans needs to evaluate what URL needs to be open in the browser and in that case it's trying to resolve ${fdb.context} which is not possible (as far as I know Maven properties mechanism doesn't have anything in common with other xml files except the Maven ones - pom.xml, settings.xml etc.).
Comment 4 matsa 2013-09-25 13:40:59 UTC
I'm not sure what you mean by "in common" here. When I hit run the Maven profile is invoked:

mvn.bat -Dnetbeans.deploy.debugmode=true -Dnetbeans.deploy=true -PTest package

When the correct profile is invoked, the ${fdb.context} property is filtered into glassfish-web.xml. After building, I can see that the property is successfully filtered. Otherwise, the WAR would be corrupt, but it is not. 

The question becomes: where does NetBeans read the context from if not glassfish-web.xml?
Comment 5 Martin Janicek 2013-09-25 14:21:16 UTC
(In reply to matsa from comment #4)
> The question becomes: where does NetBeans read the context from if not
> glassfish-web.xml?

I don't know. Do you think it would be possible to create simple project configured as much simple as possible where I would be able to reproduce and debug the problem?
Comment 6 matsa 2013-09-25 15:23:20 UTC
I will do this first thing in the morning when I get into work. :)
Comment 7 matsa 2013-09-29 07:24:54 UTC
Created attachment 140616 [details]
simple enterprise project

Created a simple enterprise project with using maven archetype with context-root filtered into glassfish-web.xml (war module) and into application.xml (ear module).

Deploying to Glassfish4 from NetBeans yields:

* war module: "Loading application [SampleProject-web] at [/${fdb.context}]"
* ear module: Loading application [SampleProject-web] at [/FdbWeb]
Comment 8 Martin Janicek 2013-11-28 15:37:16 UTC
I'm sorry for such a late response. I tried to reproduce the problem using your sample project, but it seems to be working correctly.

When I clean install given web project and run it, the browser is correctly opened on url "http://localhost:8080/fdb.context/" ...which is fine given your context root setting (<context-root>fdb.context</context-root>).

How exactly are you reproducing incorrect behavior? And what version of NetBeans are you using?
Comment 9 matsa 2013-11-28 16:07:40 UTC
Hey!

I'm just glad someone remembered! :)

It's not supposed to be http://localhost:8080/fdb.context/. fdb.context is a Maven property placeholder which is supposed to be replaced by the value "FdbWeb" from the Maven pom. The source folder glassfish-web.xml says <context-root>${fdb.context}</context-root>. Might I suggest you try to read my description again because I think you've misunderstood something. I'll do my best to try and clarify anything.
Comment 10 Martin Janicek 2013-11-28 16:14:28 UTC
(In reply to matsa from comment #9)
> It's not supposed to be http://localhost:8080/fdb.context/. fdb.context is a
> Maven property placeholder which is supposed to be replaced by the value
> "FdbWeb" from the Maven pom. 

Ahaa.. I'm sorry, I didn't notice that. Think I understand now and I'll take a look at it.
Comment 11 Martin Janicek 2013-12-02 10:17:43 UTC
Mmm, not sure if this has any simple fix.

The difference is that during EAR deployment the correct context path is read from your maven-ear-plugin (you do have configured it in configuration/webModule/contextRoot). But in this case it's simple to evaluate the correct value, because we simply use effective pom that evaluates the property placeholders even from parent pom.

On the other hand when you are using maven placeholders in glassfish-web.xml it's not really straightforward to evaluate what you want (Glassfish plugin don't have any idea about building tool you are using - Maven in that case).

Don't know maybe I'm wrong but I would say if you build your war file manually and then manually deploy it to the GlassFish, I doubt it will be available on the URL you are expecting (but of course I might be wrong and in that case we should try to workaround it somehow in NetBeans)
Comment 12 Martin Janicek 2014-01-06 10:46:34 UTC
To be able to fix such an issue we would have to build whole effective pom up during the deployment (which is not available at the moment because deployment infrastructure doesn't care about any build tool specifics) and then try to read property holder from it. Not really simple issue but I guess it's possible to fix this problem. On the other hand I don't believe it makes much sense to do that with respect to the current benefits (there is simple workarround and not many people are using Maven property placeholders like this).

Anyway letting issue open and setting TM = Next for now.
Comment 13 Martin Balin 2016-07-07 08:55:05 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss