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 109146 - 0705: JMS resources injection mismatch in @Resource anotation
Summary: 0705: JMS resources injection mismatch in @Resource anotation
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Nitya Doraisamy
URL:
Keywords:
: 109214 (view as bug list)
Depends on: 109463
Blocks:
  Show dependency tree
 
Reported: 2007-07-09 16:52 UTC by nouar38
Modified: 2007-11-29 09:02 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project zip file made on solaris-sparc (2.58 MB, application/octet-stream)
2007-07-09 16:54 UTC, nouar38
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nouar38 2007-07-09 16:52:24 UTC
Scenario : NB 0705 & GF b54 on both solaris and windows (jdk 1.6u1)

Cannot deploy a web application with JMS resources injected within a servlet.

** local default domain is started (GlassFish V2 kept the node added automatically by IDE at start
as installed with the bundled GF b54)

** Open a new web project with struts FWK
Add Servlet
In servlet code: click right and choose Enterpise Resources / Send JMS Message

in the wizard
Project Destinations: Queue1
and after OK


Problem1:

The method createJMSMessageForqueue1 is generated as:
private Message createJMSMessageForqueue1
(Session session, Object messageData) throws JMSException {
}

with an empty code ==>> red !

it is called within sendJMSMessageToQueue1(Object messageData) throws JMSException {
.... etc.
the code here seem to be ok, as the one I'looked at in javaeetutorial : jms/simple examples
producer and consumers. (the Producer example does not run neither evenif I add the needed resources, but this another
issue may be related).

}

Problem2:
if I update the code in createJMSMessageForqueue1 to be like:

private Message createJMSMessageForqueue1(Session session, Object messageData) throws JMSException {

       TextMessage message = session.createTextMessage();
       message.setText("This is message from servlet " + messageData.toString() );
       return message;
}

to go further in the build/deployment, got the error:

<<<
compile-jsps:
do-dist:
dist:
In-place deployment at /NetBeansProjects/WebApplication1/build/web
Prepare server resources for deployment
moduleID=WebApplication1
deployment started : 0%
Deploying application in domain failed; Error loading deployment descriptors for module [WebApplication1] -- This web
app [/NetBeansProjects/WebApplication1/build/web] has no resource reference by the name of [Queue1Factory]
/NetBeansProjects/WebApplication1/nbproject/build-impl.xml:511: Deployment error:
The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 2 seconds)
>>>
Comment 1 nouar38 2007-07-09 16:54:28 UTC
Created attachment 44827 [details]
project zip file made on solaris-sparc
Comment 2 nouar38 2007-07-09 16:58:01 UTC
sorry, did the zip without making a clean over the project, hope is not too huge.
Comment 3 Nitya Doraisamy 2007-07-10 19:03:07 UTC
Investigating this. Seems to be some set of issues regarding deployoyment of JMS resources created via zero-config.
Investigating
Comment 4 Nitya Doraisamy 2007-07-11 19:39:42 UTC
The first issue is basically where the IDE is creating a placeholder where the user can place their logic
for the JMS message. I don't think it is an error. The user would need to add their logic for the app.

Comment 5 Nitya Doraisamy 2007-07-11 23:15:49 UTC
For @Resource(mappedName = "TestMessageDestinationFactory"), the plugin is creating an associated connector
resource with jndiName 'jms/TestMessageDestinationFactory'. This is wrong and needs to be fixed. The jndiName
should be 'TestMessageDestinationFactory'.

There is also a secondary issue with respect to usage of the @Resource annotation. 
Annotation @Resource(mappedName = "TestMessageDestinationFactory") fails with
Error loading deployment descriptors for module [EnterpriseApplicationJMS-war] -- This web app [C:\Documents and
Settings\Nitya Doraisamy\My Documents\NetBeansProjects\EnterpriseApplicationJMS\EnterpriseApplicationJMS-war\build\web]
has no resource reference by the name of [TestMessageDestinationFactory]

But using name property in the annotation , @Resource(name= "TestMessageDestinationFactory")  works.

sun-web.xml has the following entry,
<resource-ref>
   <res-ref-name>TestMessageDestinationFactory</res-ref-name>
   <jndi-name>TestMessageDestinationFactory</jndi-name>
 </resource-ref> 
Annotation, @Resource(mappedName = "TestMessageDestinationFactory") works only if there is no entry in the sun-web.xml. 
Comment 6 Nitya Doraisamy 2007-07-11 23:36:03 UTC
*** Issue 109214 has been marked as a duplicate of this issue. ***
Comment 7 Nitya Doraisamy 2007-07-12 03:32:06 UTC
Fixed Plugin - uses the jndiName passed via API's as jndiName of resource
Checking in ResourceConfigurator.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceConfigurator.java,v  <--
 ResourceConfigurator.java
new revision: 1.17; previous revision: 1.16
Comment 8 nouar38 2007-07-16 15:47:15 UTC
fix in j2ee (109463) is done today 0716, waiting for a NB 6.0 build > 0716 to verify.
jndiName is ok (verified in 071512000) does not have any more jms/xxxx
Comment 9 Nitya Doraisamy 2007-07-20 22:13:32 UTC
Fix for 109463 fixes this issue.
Comment 10 nouar38 2007-11-29 09:02:12 UTC
marking verified in RC2 and recent dailys dev 6.1