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 192248 - Insert Code|Send JMS Message generates code that throws an Exception
Summary: Insert Code|Send JMS Message generates code that throws an Exception
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: App Client (show other bugs)
Version: 7.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Fousek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-21 20:54 UTC by dheffelfinger
Modified: 2011-02-18 10:33 UTC (History)
0 users

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 dheffelfinger 2010-11-21 20:54:11 UTC
[ BUILD # : 201011210001 ]
[ JDK VERSION : 1.6.20 ]

Steps to reproduce:

Create an enterprise application project with an application client module and
no web application module.

In the generated application client module, right click on the source of
Main.java and select "Send JMS Message".

The following annotations are generated:

 @Resource(name = "jms/myQueue")
    private static Queue myQueue;
    @Resource(name = "jms/myQueueFactory")
    private static ConnectionFactory myQueueFactory;

When running the code, the application client is executed by default, the
following exception is thrown:

Nov 21, 2010 3:48:49 PM
com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using
com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the
delegate
Nov 21, 2010 3:48:49 PM com.sun.enterprise.deployment.util.ComponentValidator
accept
WARNING: enterprise.deployment.backend.invalidDescriptorMappingFailure
com.sun.enterprise.container.common.spi.util.InjectionException: Exception
attempting to inject Unresolved Message-Destination-Ref
jms/myQueue@java.lang.String@null into class enterpriseapplication5.Main
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(Injec
tionManagerImpl.java:614)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(Inject
ionManagerImpl.java:384)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectClass(I
njectionManagerImpl.java:210)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectClass(I
njectionManagerImpl.java:202)
        at
org.glassfish.appclient.client.acc.AppClientContainer$ClientMainClassSetting.get
ClientMainClass(AppClientContainer.java:599)
        at
org.glassfish.appclient.client.acc.AppClientContainer.getMainMethod(AppClientCon
tainer.java:498)
        at
org.glassfish.appclient.client.acc.AppClientContainer.completePreparation(AppCli
entContainer.java:397)
        at
org.glassfish.appclient.client.acc.AppClientContainer.prepare(AppClientContainer
.java:311)
        at
org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:2
64)
        at
org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClie
ntContainerAgent.java:75)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.ja
va:323)
        at
sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.j
ava:338)
Caused by: javax.naming.NamingException: Lookup failed for
'java:comp/env/jms/myQueue' in SerialContext
targetHost=localhost,targetPort=3700 [Root exception is
javax.naming.NameNotFoundException: No object bound for
java:comp/env/jms/myQueue [Root exception is java.lang.NullPointerException]]
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(Injec
tionManagerImpl.java:513)
        ... 15 more
Caused by: javax.naming.NameNotFoundException: No object bound for
java:comp/env/jms/myQueue [Root exception is java.lang.NullPointerException]
        at
com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:218)
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:428)
        ... 17 more
Caused by: java.lang.NullPointerException
        at javax.naming.InitialContext.getURLScheme(InitialContext.java:269)
        at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:318)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at
com.sun.enterprise.naming.util.JndiNamingObjectFactory.create(JndiNamingObjectFa
ctory.java:79)
        at
com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNaming
ManagerImpl.java:688)
        at
com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNaming
ManagerImpl.java:657)
        at
com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:148)
        ... 18 more
Java Result: 1

Changing the "name" attribute of the generated @Resource annotation to
"mappedName" solves the problem. However "Insert Code" should generate the
annotations with the correct attributes.

Note, this was tested with GlassFish 3.0.1.
Comment 1 Petr Hejl 2011-02-17 11:47:53 UTC
Passing for evaluation.
Comment 2 Martin Fousek 2011-02-17 13:53:05 UTC
Fixed in 9037031eda00.
Comment 3 Quality Engineering 2011-02-18 10:33:03 UTC
Integrated into 'main-golden', will be available in build *201102180501* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/9037031eda00
User: Martin Fousek <marfous@netbeans.org>
Log: #192248 - Insert Code|Send JMS Message generates code that throws an Exception