Bugs item #790843, was opened at 2003-08-18 15:01
Message generated for change (Comment added) made by starksm
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=790843&group_id=22866

Category: JBossServer
Group: v3.2
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Stefan Reich (sreich)
Assigned to: Adrian Brock (ejort)
Summary: JMX/jndi scoping problem for beans with same jndiName

Initial Comment:
SUN's petstore components have a couple of beans that 

appear in several archives, and that have the same 

jndiName. Although perfectly legal, it causes a problem 

when the JMX core registers the beans because of the 

naming scheme it uses. Each bean is registered like this in 

the jboss.j2ee name space:

jboss.j2ee:jndiName=local/ContactInfoEJB,service=EJB



Because the record doesn't include the module name, a 

naming conflict occurs, and result in the deletion and 

recreation of the bean, but with a different classloader. This 

finally leads to ClassCastExceptions in arbitrary locations of 

the application.



The test case is SUNs PetStore 1.3.1_02 on top of MySQL, 

which is most likely to large to attach. I can send it via 

email, if necessary.





Errors at deploy time look like this:

12:59:12,996 ERROR [EjbModule] Initialization failed

javax.management.InstanceAlreadyExistsException: 

jboss.j2ee:jndiName=local/ContactInfoEJB,service=EJB 

already registered.

        at 

org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicM

BeanRegistry.java:617)

        at 

org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBe

an(BasicMBeanRegistry.java:198)

        at 

sun.reflect.GeneratedMethodAccessor2.invoke(Unknown 

Source)

        at 

sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegating

MethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324)

        at 

org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(Ref

lectedMBeanDispatcher.java:284)

        at 

org.jboss.mx.interceptor.ObjectReferenceInterceptor.invoke(

ObjectReferenceInterceptor.java:59)

        at 

org.jboss.mx.interceptor.MBeanAttributeInterceptor.invoke(M

BeanAttributeInterceptor.java:43)

        at 

org.jboss.mx.interceptor.PersistenceInterceptor2.invoke(Pers

istenceInterceptor2.java:93)

        at 

org.jboss.mx.server.MBeanInvoker.invoke(MBeanInvoker.java

:76)

......



Or



12:59:13,731 DEBUG [EJBModuleFactory] Created module: 

jboss.management.local:

J2EEApplication=supplier.ear,J2EEServer=Local,j2eeType=EJB

Module,name=supplierpo-ejb.jar

12:59:13,732 DEBUG [EJBModuleFactory] 

javax.management.InstanceNotFoundException: jboss.j2ee:

jndiName=local/SupplierOrderEJB,service=EJB is not 

registered.

        at 

org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicM

BeanRegistry.java:354)

        at 

org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanSe

rverImpl.java:446)

        at 

org.jboss.management.j2ee.factory.EJBModuleFactory.create

EJB(EJBModuleFactory.java:102)

        at 

org.jboss.management.j2ee.factory.EJBModuleFactory.create(

EJBModuleFactory.java:65)

        at 

org.jboss.management.j2ee.LocalJBossServerDomain.handle

Notification(LocalJBossServerDomain.java:383)

        at 

org.jboss.mx.server.NotificationListenerProxy.handleNotificati

on(NotificationListenerProxy.java:71)

        at 

javax.management.NotificationBroadcasterSupport.sendNotifi

cation(NotificationBroadcasterSupport.java:95)

        at 

org.jboss.deployment.SubDeployerSupport.start(SubDeployer

Support.java:178)

        at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:

558)

        at 

org.jboss.deployment.MainDeployer.start(MainDeployer.java:

824)

        at 

org.jboss.deployment.MainDeployer.start(MainDeployer.java:

816)

        at 

org.jboss.deployment.MainDeployer.deploy(MainDeployer.jav

a:632)

        at 

org.jboss.deployment.MainDeployer.deploy(MainDeployer.jav

a:605)

        at 

sun.reflect.GeneratedMethodAccessor23.invoke(Unknown 

Source)

        at 

sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegating

MethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324)

        at 

org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(Ref

lectedMBeanDispatcher.java:284)

        at 

org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerI

mpl.java:550)

        at 

org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java

:177)

        at $Proxy7.deploy(Unknown Source)



----------------------------------------------------------------------

>Comment By: Scott M Stark (starksm)
Date: 2003-09-10 10:40

Message:
Logged In: YES 
user_id=175228

ejb-name elements must be unique per jar, jndi-names must be

unique globally in the server. Think about it. The jndi name

is the binding of the home interface that the client is

looking up. If this was not unique remote client X looking

jndi-name Y has no guarentee what home they are getting.

----------------------------------------------------------------------

Comment By: Stefan Reich (sreich)
Date: 2003-09-10 10:34

Message:
Logged In: YES 
user_id=429729

Why does a deployer have to make sure that jndiNames are 

unique per JBoss container when all they need to be is unique per 

jar? That looks like an arbitrary implementation decision that 

makes it unnecessarily hard for the deployer.

Please note that the exception I get is caused by how the bean is 

registered via JMX, whcihs results in a name collision in the JMX 

name space, not the JNDI name space.

----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2003-08-23 17:24

Message:
Logged In: YES 
user_id=175228

You need to specify a unique jndi name using the jboss.xml

descriptor:



<jboss>

    <enterprise-beans>

        <session>

            <ejb-name>ENCBean</ejb-name>

            <ejb-local-ref>

                <ejb-ref-name>ejb/bean1</ejb-ref-name>

                <local-jndi-name>ENCBean1</jndi-name>

            </ejb-ref>

...

----------------------------------------------------------------------

Comment By: Adrian Brock (ejort)
Date: 2003-08-18 16:24

Message:
Logged In: YES 
user_id=9459

<ejb-link> is used for <ejb-ref> resolution during ENC

construction.



It does not affect the global jndi binding.



Regards,

Adrian

----------------------------------------------------------------------

Comment By: Stefan Reich (sreich)
Date: 2003-08-18 16:11

Message:
Logged In: YES 
user_id=429729

Well, problem is that the <ejb-local-ref> in the ejb-jar.xml of the 

modules in question contain <ejb-link> elements.



According to the change recently made by Jan Bartel ("Handling of 

ejb-ref and ejb-local-ref") the <ejb-link> is consulted first, and 

there is nothing I can configure w/o changing ejb-jar.xml.



----------------------------------------------------------------------

Comment By: Adrian Brock (ejort)
Date: 2003-08-18 15:59

Message:
Logged In: YES 
user_id=9459

And it is the job of the deployer to resolve these conflicts

(choose appropriate jndi-names)



e.g. 

<local-jndi-name>ejbs/petstore/ContactInfo</local-jndi-name>

and <local-jndi-name>ejbs/supplier/ContactInfo</local-jndi-name>



That jboss doesn't have support for changing these settings

without

breaking open the package is a known issue.



Regards,

Adrian

----------------------------------------------------------------------

Comment By: Stefan Reich (sreich)
Date: 2003-08-18 15:50

Message:
Logged In: YES 
user_id=429729

Maybe I was not explicit enough.

Module petstore contains bean ContactInfoEJB, mapped to 

jndiName local/ContactInfoEJB

Module supplier contains bean ContactInfoEJB, mapped to 

jndiName local/ContactInfoEJB

That's where the problem occurs, not between different beans in 

the same module. 

Modules are supposed to be self-contained and isolated from the 

rest of the world, and with the current implementation, they 

aren't.

----------------------------------------------------------------------

Comment By: Adrian Brock (ejort)
Date: 2003-08-18 15:42

Message:
Logged In: YES 
user_id=9459

Duplicate JNDI mappings are not legal.



The spec doesn't even specify jndi bindings, leaving it to

application specific deployment descriptors.



You should remap the jndi names using jboss.xml,

by default the jboss mapping is local/<ejb-name>



Regards,

Adrian

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=790843&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to