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 213873 - Problem with name of the deployed artifact in glassfish and weblogic in Maven Web project (breaks JNDI)
Summary: Problem with name of the deployed artifact in glassfish and weblogic in Maven...
Status: RESOLVED WORKSFORME
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.1.2
Hardware: PC Linux
: P3 normal with 4 votes (vote)
Assignee: Martin Janicek
URL:
Keywords:
: 178570 207099 (view as bug list)
Depends on: 217619
Blocks:
  Show dependency tree
 
Reported: 2012-06-09 12:40 UTC by heidarzadeh
Modified: 2013-07-23 11:23 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 heidarzadeh 2012-06-09 12:40:30 UTC
When I specify  <finalName>${artifactId}</finalName> in pom.xml the final built ear file name is correct but when I want to deploy it in glassfish or weblogic using netbeans (right click on project and click debug or run).
Then the deployed artifact does not get the specified final name and gets the name of groupId + artifact + "ear" + version + SNAPSHOT !
This will break all specified JNDI names that depend on ear name and I have to refactor all JNDI names after changing the version!
Comment 1 Martin Janicek 2012-06-11 14:35:22 UTC
Valid issue --> TM = 7.2
Comment 2 Martin Janicek 2012-06-12 14:17:48 UTC
*** Bug 207099 has been marked as a duplicate of this bug. ***
Comment 3 Martin Janicek 2012-06-12 14:33:21 UTC
Currently there is a getName() method call from the class org.netbeans.modules.maven.queries.Info, which is used by org.netbeans.modules.glassfish.eecommon.api.Utils (line 132)

..this method doesn't care about finalName, so we will have to create different ProjectInformation for Maven project (e.g. WebSpecificProjectInformation), registered via @PSP with WAR packaging and use that one if it will be present in the project lookup.

What isn't obvious yet is if this could be distinguish on the deployment side or if we have to handle it differently for every server type.
Comment 4 Martin Janicek 2012-06-13 08:57:55 UTC
*** Bug 178570 has been marked as a duplicate of this bug. ***
Comment 5 Martin Janicek 2012-06-13 08:59:03 UTC
Copied comment from issue 178570:

When deploying to glassfish (v3) using the run method
the name of the deployed artifact is for example:
  system_system-ejb_ejb_1.0-SNAPSHOT

but within the project the name: 
  system-ejb 
is specified as finalName.

The deployer should take the finalName. Other configurations
within glassfish or of other artifacts may rely on the correct 
name (for example JNDI, VirtualHosts etc.)
Comment 6 andrescarlospa 2012-11-27 17:11:03 UTC
Are you going to fix this problem in some version?, or can you explain how to configure netbeans IDE to solve this issue?. thanks
Comment 7 Martin Janicek 2012-11-28 09:41:50 UTC
(In reply to comment #6)
> Are you going to fix this problem in some version?

Hi andres, of course we do. I would like to try this for 7.3, but there is quite a lot of things on my agenda and this issue isn't actually one of the easiest one, so don't want to promise anything. I'll definitely try..

> or can you explain how to configure netbeans IDE to solve this issue?. thanks

Unfortunately there is nothing you can do to solve it. It's an issue in our code base that makes it happening. It's up to me and probably also the glassfish owner to fix it.
Comment 8 Martin Janicek 2013-07-22 15:12:55 UTC
Guys, is there anyone who is still able to reproduce this problem? I was playing with it a bit and it does seem to work correctly. It might be fixed directly with issue 217619, but on the other hand it's also possible I'm missing something or that I'm trying different use case.
Comment 9 bht 2013-07-23 06:16:26 UTC
I tried to reproduce this with duplicate bug 207099. Its testcase produces a different JNDI name now (without the version appendix):

INFO: EJB5181:Portable JNDI names for EJB NewSessionBean: [java:global/MavenWeb/NewSessionBean, java:global/MavenWeb/NewSessionBean!com.mycompany.mavenweb.NewSessionBeanLocal]

When I inserted java:global/MavenWeb/NewSessionBean into the lookup code, then the lookup failed.

When I inserted java:global/MavenWeb/NewSessionBean!com.mycompany.mavenweb.NewSessionBeanLocal

then it succeeded.

If this is the intended result then this could be closed (from my perspective).

Could someone please explain the difference?
Comment 10 Martin Janicek 2013-07-23 08:18:08 UTC
First of all, thank you for the quick response!(In reply to comment
Comment 11 Martin Janicek 2013-07-23 08:28:00 UTC
(In reply to comment #9)
> When I inserted java:global/MavenWeb/NewSessionBean into the lookup code, then
> the lookup failed.

IMHO this should work (and works for me). Are you sure you have used "java:global/MavenWeb/NewSessionBean" ? Because in your steps from issue 207099 you are pasting code snippet containing "java:global/MavenWeb-1.0-SNAPSHOT/NewSessionBeanLocal" (please see the NewSessionBeanLocal at the end of the string instead of desirable NewSessionBean)

> When I inserted
> java:global/MavenWeb/NewSessionBean!com.mycompany.mavenweb.NewSessionBeanLocal
> 
> then it succeeded.

Great, same for me.

> Could someone please explain the difference?

Well I would say you should be able to lookup both path noted in server info:
java:global/MavenWeb/NewSessionBean
java:global/MavenWeb/NewSessionBean!com.mycompany.mavenweb.NewSessionBeanLocal

..and it works for me fine with both.
For more information about JNDI, please take a look at [1]

[1] http://docs.oracle.com/javase/7/docs/technotes/guides/jndi/index.html
Comment 12 bht 2013-07-23 09:27:13 UTC
Sorry, both paths work for me, too :)

It is a pleasure to report NetBeans issues because the system makes it so easy and the NetBeans people respond so well. The examples in the IDE are very useful for test cases. With the server integration, if one forgets how to write a lookup, on needs only write a maven test case and paste the name from the server log file into the code.
Comment 13 Martin Janicek 2013-07-23 11:23:08 UTC
Awesome, I'm glad it works as expected now. Thanks for your help!