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 79808 - @EJB and incorrect update of sun-ejb-jar.xml
Summary: @EJB and incorrect update of sun-ejb-jar.xml
Status: RESOLVED WORKSFORME
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: _ pcw
URL:
Keywords:
Depends on:
Blocks: 80015
  Show dependency tree
 
Reported: 2006-07-06 09:37 UTC by chris_loftus
Modified: 2006-08-10 09:38 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 chris_loftus 2006-07-06 09:37:31 UTC
Build: NB 5.5 beta 3rd July 06 daily, pack 9th May 06

I am using the @EJB annotation to allow one session EJB to inject a reference to
another:

@Stateful
public class PurchaseBean implements PurchaseRemote {
...
  @EJB(name="ejb/processPayment",
    beanInterface=ProcessPaymentLocal.class,
    beanName="ProcessPaymentBean")
   private ProcessPaymentLocal payment;
...
} 

The expectation was that the @EJB sets up the ENC entry
"java:comp/env/ejb/processPayment" and that the actual JNDI deployment name
would be specified in sun-ejb-jar.xml

First of all netbeans seems to generate:

<ejb>
     <ejb-name>PurchaseBean</ejb-name>
     <ejb-ref>
       <ejb-ref-name>payment</ejb-ref-name>
       <jndi-name>ejb/payment</jndi-name>
     </ejb-ref>
   </ejb> 

no matter what arguments I pass to @EJB. So I changed the file manually to look
like this:

<ejb>
     <ejb-name>PurchaseBean</ejb-name>
     <ejb-ref>
       <ejb-ref-name>ejb/processPayment</ejb-ref-name>
       <jndi-name>uk.ac.aber.dcs.bookshop.model.ProcessPaymentLocal</jndi-name>
     </ejb-ref>
   </ejb>

This deployed fine and worked. However, if I exit Netbeans and start it again,
my sun-ejb-jar.xml settings are overwritten and set back to the first example
shown above! If I just use @EJB without any arguments and delete the
sun-ejb-jar.xml file then during deployment I receive the error: 

Deploying application in domain failed; Error loading deployment descriptors for
module [BookshopWithJSPandEJB] -- This application client has no ejb refernce by
the name payment

and the file is re-created with the default contents on stop exiting and
starting NB anyway.

Is there some way of telling NB 5.5 not to re-create the sun-ejb-jar.xml file
but leave it alone? Shouldn't NB 5.5 derive information from the name parameter
of the @EJB annotation and use that in the xml file? There is also a mappedName
para that it could use. 

Regards

Chris Loftus
Comment 1 _ pcw 2006-08-10 01:39:30 UTC
Could you provide specific steps to reproduce your projects (or attach an
example)?  Questions I have include: Is this just in one EJB module or two?  Are
you using remote or local interfaces to call the EJB?

It appears to be a naming bug inside NetBeans, but I have been unable to
reproduce this scenario to confirm.
Comment 2 _ pcw 2006-08-10 09:38:30 UTC
Reporter says works in beta 2 and I can't reproduce either in current dev
builds.  Closing as WORKSFORME.