Re: [JBoss-user] Classnames in JNDI
Ole, After restarting JBoss (2.2.1 with Jetty), the getEJBMetaData().getHomeInterfaceClass() works the way it should again. I am also confused, why before restarting JBoss it was acting so strange! Now it seems to work fine. Thanxs a lot for your help! Best regards Lorenzo Ole Husgaard wrote: [EMAIL PROTECTED]">Lorenzo Resta wrote: I have tried the getEJBMetaData().getHomeInterfaceClass() method in JBoss,but all i am getting here is the "$Proxy2" class name again,so i suspect that the mentioned method returns the class that implementsthe Home interface. I dont think it should (or does), and I am a bit puzzled bythis. Just tried re-running the jbosstest CTS tests from thelatest CVS MAIN branch, and the testContainerObjects testpasses as usually:Get the Meta-data object...OKProbe the Meta-data object: Home Interface : org.jboss.test.cts.interfaces.CtsBmpHome PrimaryKey : org.jboss.test.cts.keys.AccountPK Remote Interface: org.jboss.test.cts.interfaces.CtsBmpMeta-data OKJust for reference, the code that prints the above looks like:System.out.print("Get the Meta-data object...");EJBMetaData md = anotherHome.getEJBMetaData();assert(md != null);System.out.println("OK");System.out.println("Probe the Meta-data object:");String homeInterface = md.getHomeInterfaceClass().getName();String primaryKey = md.getPrimaryKeyClass().getName();String remoteInterface = md.getRemoteInterfaceClass().getName();System.out.println(" Home Interface : " + homeInterface);System.out.println(" PrimaryKey : " + primaryKey);System.out.println(" Remote Interface: " + remoteInterface);assert(homeInterface.equals("org.jboss.test.cts.interfaces.CtsBmpHome"));assert(primaryKey.equals("org.jboss.test.cts.keys.AccountPK"));assert(remoteInterface.equals("org.jboss.test.cts.interfaces.CtsBmp"));System.out.println("Meta-data OK");This test only tests the metadata for entity beans.With which kinds of beans do you have these problems?Best Regards,Ole Husgaard.___JBoss-user mailing list[EMAIL PROTECTED]http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Lorenzo Resta wrote: > I have tried the getEJBMetaData().getHomeInterfaceClass() method in JBoss, > but all i am getting here is the "$Proxy2" class name again, > so i suspect that the mentioned method returns the class that implements > the Home interface. I dont think it should (or does), and I am a bit puzzled by this. Just tried re-running the jbosstest CTS tests from the latest CVS MAIN branch, and the testContainerObjects test passes as usually: Get the Meta-data object...OK Probe the Meta-data object: Home Interface : org.jboss.test.cts.interfaces.CtsBmpHome PrimaryKey : org.jboss.test.cts.keys.AccountPK Remote Interface: org.jboss.test.cts.interfaces.CtsBmp Meta-data OK Just for reference, the code that prints the above looks like: System.out.print("Get the Meta-data object..."); EJBMetaData md = anotherHome.getEJBMetaData(); assert(md != null); System.out.println("OK"); System.out.println("Probe the Meta-data object:"); String homeInterface = md.getHomeInterfaceClass().getName(); String primaryKey = md.getPrimaryKeyClass().getName(); String remoteInterface = md.getRemoteInterfaceClass().getName(); System.out.println(" Home Interface : " + homeInterface); System.out.println(" PrimaryKey : " + primaryKey); System.out.println(" Remote Interface: " + remoteInterface); assert(homeInterface.equals("org.jboss.test.cts.interfaces.CtsBmpHome")); assert(primaryKey.equals("org.jboss.test.cts.keys.AccountPK")); assert(remoteInterface.equals("org.jboss.test.cts.interfaces.CtsBmp")); System.out.println("Meta-data OK"); This test only tests the metadata for entity beans. With which kinds of beans do you have these problems? Best Regards, Ole Husgaard. ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Maurice, I did set all the JNDI properties like this: private String J2EE_BEAN_INITIAL_CONTEXT = "org.jnp.interfaces.NamingContextFactory"; private String J2EE_SERVER = "maloja:1099"; private String J2EE_SERVER_USER = "username"; private String J2EE_SERVER_PASSWORD = "password"; private Context getInitialContext()throws NamingException{ Properties p = new Properties(); p.put("java.naming.factory.initial", J2EE_BEAN_INITIAL_CONTEXT); p.put("java.naming.provider.url", J2EE_SERVER); if (J2EE_SERVER_USER != null) { p.put(Context.SECURITY_PRINCIPAL, J2EE_SERVER_USER); if (J2EE_SERVER_PASSWORD == null){ J2EE_SERVER_PASSWORD = ""; } p.put(Context.SECURITY_CREDENTIALS, J2EE_SERVER_PASSWORD); } return new InitialContext(p); } The lookup went fine, but as soon as i called the getEJBMetaData().getEJBHome() method on the looked up home interface , the Exception occured. What's weird is that since i restarted JBoss, the getEJBMetaData().getHomeInterfaceClass() and getEJBMetaData().getRemoteInterfaceClass() work fine and return the "real" home and remote interface names. Thanks Lorenzo Maurice le Rutte wrote: 013901c11102$85d1f1e0$d9a0bc86@pc1mplr"> I have tried the getEJBMetaData().getHomeInterfaceClass() method inJBoss, but all i am getting here is the "$Proxy2" class name again,so i suspect that the mentioned method returns the class that implementsthe Home interface. The $Proxy2 is a class that is dynamically generated and wraps the homeinterface methods. See java.lang.reflect.Proxy for more information. I thinkyou can use introspection to query the interfaces it implements, this shouldinclude the name of the home interface class. There is also the getEJBMetaData().getEJBHome(), but when i call this method, an exception like this is thrown:javax.naming.NoInitialContextException: Need to specify class namein environment or system property, or as an applet parameter, or inan application resource file: java.naming.factory.initialat javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:646)[...] Have you specified all needed configuration parameters? Easiest is to have ajndi.properties in your classpath containing the following properties.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactoryjava.naming.provider.url=localhost:1099java.naming.factory.url.pkgs=org.jboss.namingOf course, you might need to change the java.naming.provider.url to fit yourlocal configuration needs.Maurice.___JBoss-user mailing list[EMAIL PROTECTED]http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
>I have tried the getEJBMetaData().getHomeInterfaceClass() method in >JBoss, but all i am getting here is the "$Proxy2" class name again, >so i suspect that the mentioned method returns the class that implements >the Home interface. The $Proxy2 is a class that is dynamically generated and wraps the home interface methods. See java.lang.reflect.Proxy for more information. I think you can use introspection to query the interfaces it implements, this should include the name of the home interface class. >There is also the getEJBMetaData().getEJBHome(), but when i call this method, >an exception like this is thrown: >javax.naming.NoInitialContextException: Need to specify class name >in environment or system property, or as an applet parameter, or in >an application resource file: java.naming.factory.initial >at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:646) >[...] Have you specified all needed configuration parameters? Easiest is to have a jndi.properties in your classpath containing the following properties. java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=localhost:1099 java.naming.factory.url.pkgs=org.jboss.naming Of course, you might need to change the java.naming.provider.url to fit your local configuration needs. Maurice. ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Hi Rajesh, You should be able to look up your beans in JNDI and call your desired methods with help of java reflection. I just tried a little example. It looks like that: The registerEJB() method takes a JNDI context name as parameter and looks up your beans in the given context name like "/company/applications". public void registerEJBs(String aContextName) throws NamingException{ NamingEnumeration theNames; Context theContext = new InitialContext(); theNames = getNames(theContext, aContextName); while(theNames.hasMore()){ NameClassPair theName = (NameClassPair)theNames.next(); Object theObjectRef = myContext.lookup(aContextName+"/"+theName.getName()); EJBHome theHome = (EJBHome)PortableRemoteObject.narrow(theObjectRef, EJBHome.class); //This works so far, but i am not sure if the home interface is always at index 0 Class theHomeInterface= theHome.getClass().getInterfaces()[0]; System.out.println("Home of "+aContextName+"/"+theName.getName()+" is " + theHomeInterface.getName()); try{ java.lang.reflect.Method theCreateMethod; Class[] theMethodArgs = {}; //Get the create() method theCreateMethod = theHomeInterface.getMethod("create", theMethodArgs); System.out.println("home interface create method " + theCreateMethod.toString()); Object[] theInvocationArgs = {}; //Invoke the create method on the home interface Object theRemoteObject = theCreateMethod.invoke(theHome, theInvocationArgs); //This works so far, but i am not sure if the remote interface is always at index 0 Class theRemoteInterface = theRemoteObject.getClass().getInterfaces()[0]; //You can look up your methods like this java.lang.reflect.Method[] theBusinessMethods; theBusinessMethods = theRemoteInterface.getMethods(); System.out.println("The remote object is " + theRemoteInterface.getName()); }catch(NoSuchMethodException anException){ anException.printStackTrace(); }catch(java.lang.reflect.InvocationTargetException anException){ anException.printStackTrace(); }catch(IllegalAccessException anException){ anException.printStackTrace(); } } } private NamingEnumeration getNames(Context aContext, String aName) throws NamingException{ NamingEnumeration theNames; theNames = aContext.list(aName); return theNames; } I hope that this helped so far Cheers Lorenzo Rajesh Vilasrao Bhujbal wrote: hi, i saw your mail in JBoss-user list. I am also trying to do same thing. I am sending reuest to queue through session EJB. MDB listen to quque and then calls business EJB. Business Beans are not known to MDB before hand. Can we call business EJB in such fashion? if yes, how? Rajesh Hi Michael, Yes, i am trying to "discover" EJB's on servers, lookup their home-interfaces and maybe create one or more bean-instances, in order to register then in a sort of "application-registry" together with other non-EJB java applications. Lorenzo Maraya Michael wrote: [EMAIL PROTECTED]"> If I understand what you're saying, I think you're trying to accessEJBs without knowing what their names and home and remote interfaces are atcompile-time by using reflection at run-time. Is this what you're trying todo?---Michael R. Maraya --From: Lorenzo Resta[SMTP:[EMAIL PROTECTED]]Reply To: [EMAIL PROTECTED]Sent: Thursday, July 19, 2001 12:20 PMTo: [EMAIL PROTECTED]Subject: Re: [JBoss-user] Classnames in JNDIHi Burkhard,The problem is that i don't know the bean's name. The list() methodreturnsan enumeration of JNDI names found in the given context. If you havedeployed beans in the context, youcan get at the name and classname through the NameClassPair class.I have also tried your approach :home.getEJBMetaData().getHomeInterfaceClass(),but i still get only classnames like "$Proxy0".Do you get the real classnames?Thanks LorenzoBurkhard Vogel wrote: Hi, not sure about the return values of list() but you can do: Object obj = new InitialContext().lookup(BeanName); EJBHome home = (EJBHome)javax.rmi.PortableRemoteObject.narrow(obj, EJBHome.class); log.debug("HomeInterface: " + home.getEJBMetaData().getHomeInterfaceClass()); Burkhard
Re: [JBoss-user] Classnames in JNDI
Hi Ole, I have tried the getEJBMetaData().getHomeInterfaceClass() method in JBoss, but all i am getting here is the "$Proxy2" class name again, so i suspect that the mentioned method returns the class that implements the Home interface. There is also the getEJBMetaData().getEJBHome(), but when i call this method, an exception like this is thrown: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:646) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:283) at javax.naming.InitialContext.lookup(InitialContext.java:350) at org.jboss.ejb.plugins.jrmp.interfaces.HomeHandleImpl.getEJBHome(HomeHandleImpl.java:49) at org.jboss.ejb.plugins.jrmp.interfaces.EJBMetaDataImpl.getEJBHome(EJBMetaDataImpl.java:58) at com.surfkitchen.context.GlobalContext.registerEJBs(GlobalContext.java:130) at com.surfkitchen.context.GlobalContext.main(GlobalContext.java:178) java.rmi.RemoteException: Could not get EJBHome at org.jboss.ejb.plugins.jrmp.interfaces.HomeHandleImpl.getEJBHome(HomeHandleImpl.java:55) at org.jboss.ejb.plugins.jrmp.interfaces.EJBMetaDataImpl.getEJBHome(EJBMetaDataImpl.java:58) at com.surfkitchen.context.GlobalContext.registerEJBs(GlobalContext.java:130) at com.surfkitchen.context.GlobalContext.main(GlobalContext.java:178) As far as i can say from this exception, i have to specify the potential home interface class names, before they can resolved... Cheers Lorenzo Ole Husgaard wrote: [EMAIL PROTECTED]">Hi,Lorenzo Resta wrote: Shouldn't the getEJBMetaData().getHomeInterfaceClass() return the home interface, or does itreturn the class that implements the home interface? I think it should return the home interface class, and_not_ the class implementing the home interface.The EJB1.1 specification is surprisingly silent on this,but the Javadocs for BeanMetaData.getHomeInterfaceClass()says: "Obtain the Class object for the enterprise Bean'shome interface.".Doesn't it work that way in JBoss?Best Regards,Ole Husgaard.___JBoss-user mailing list[EMAIL PROTECTED]http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Hi Michael, Yes, i am trying to "discover" EJB's on servers, lookup their home-interfaces and maybe create one or more bean-instances, in order to register then in a sort of "application-registry" together with other non-EJB java applications. Lorenzo Maraya Michael wrote: [EMAIL PROTECTED]"> If I understand what you're saying, I think you're trying to accessEJBs without knowing what their names and home and remote interfaces are atcompile-time by using reflection at run-time. Is this what you're trying todo?---Michael R. Maraya --From: Lorenzo Resta[SMTP:[EMAIL PROTECTED]]Reply To: [EMAIL PROTECTED]Sent: Thursday, July 19, 2001 12:20 PMTo: [EMAIL PROTECTED]Subject: Re: [JBoss-user] Classnames in JNDIHi Burkhard,The problem is that i don't know the bean's name. The list() methodreturnsan enumeration of JNDI names found in the given context. If you havedeployed beans in the context, youcan get at the name and classname through the NameClassPair class.I have also tried your approach :home.getEJBMetaData().getHomeInterfaceClass(),but i still get only classnames like "$Proxy0".Do you get the real classnames?Thanks LorenzoBurkhard Vogel wrote: Hi, not sure about the return values of list() but you can do: Object obj = new InitialContext().lookup(BeanName); EJBHome home = (EJBHome)javax.rmi.PortableRemoteObject.narrow(obj, EJBHome.class); log.debug("HomeInterface: " + home.getEJBMetaData().getHomeInterfaceClass()); Burkhard - Original Message - From: "Lorenzo Resta" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 19, 2001 4:49 PM Subject: [JBoss-user] Classnames in JNDI Hi, Does someone know how to get the thre "real" class names ofEJB's looked up through a given context? Right now i try to look up all name in a specified contextlike this: myContext = new InitialContext(); theNames = myContext.list("/company/applications"); while(theNames.hasMore()){ NameClassPair theName =(NameClassPair)theNames.next(); String theClassName = theName.getClassName(); //<---Here i get always classnames like "$Proxy1" Object theObjectRef = myContext.lookup(aName+"/"+theName.getName()); EJBHome theHome = (EJBHome)PortableRemoteObject.narrow(theObjectRef,EJBHome.class); } So far the code works fine, but the trouble is that theclass name stores in JNDI is always something like "$Proxy1". But iwould like to get the real Homeinterface class name. By the way : even in JNDIView the classnames appear as"$Proxy0", "$Proxy1" , etc. Any ideas how to get at the "real" class names? Thanks Lorenzo Resta SurfKitchen Inc. ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user ___JBoss-user mailing list[EMAIL PROTECTED]http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Hi, Lorenzo Resta wrote: > Shouldn't the getEJBMetaData().getHomeInterfaceClass() return the home interface, or >does it > return the class that implements the home interface? I think it should return the home interface class, and _not_ the class implementing the home interface. The EJB1.1 specification is surprisingly silent on this, but the Javadocs for BeanMetaData.getHomeInterfaceClass() says: "Obtain the Class object for the enterprise Bean's home interface.". Doesn't it work that way in JBoss? Best Regards, Ole Husgaard. ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] Classnames in JNDI
If I understand what you're saying, I think you're trying to access EJBs without knowing what their names and home and remote interfaces are at compile-time by using reflection at run-time. Is this what you're trying to do? --- Michael R. Maraya > -- > From: Lorenzo Resta[SMTP:[EMAIL PROTECTED]] > Reply To: [EMAIL PROTECTED] > Sent: Thursday, July 19, 2001 12:20 PM > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-user] Classnames in JNDI > > Hi Burkhard, > > The problem is that i don't know the bean's name. The list() method > returns > an enumeration of JNDI names found in the given context. If you have > deployed beans in the context, you > can get at the name and classname through the NameClassPair class. > > I have also tried your approach : > home.getEJBMetaData().getHomeInterfaceClass(), > but i still get only classnames like "$Proxy0". > > Do you get the real classnames? > > Thanks > > Lorenzo > > Burkhard Vogel wrote: > > > Hi, > not sure about the return values of list() but you can do: > Object obj = new InitialContext().lookup(BeanName); > EJBHome home = > (EJBHome)javax.rmi.PortableRemoteObject.narrow(obj, EJBHome.class); > log.debug("HomeInterface: " + > home.getEJBMetaData().getHomeInterfaceClass()); > Burkhard > > - Original Message - > From: "Lorenzo Resta" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, July 19, 2001 4:49 PM > Subject: [JBoss-user] Classnames in JNDI > > > > Hi, > > Does someone know how to get the thre "real" class names of > EJB's looked > up through a given context? > Right now i try to look up all name in a specified context > like this: > > myContext = new InitialContext(); > > theNames = myContext.list("/company/applications"); > > while(theNames.hasMore()){ > > NameClassPair theName = > (NameClassPair)theNames.next(); > > String theClassName = theName.getClassName(); //<--- > Here i get > always classnames like "$Proxy1" > > Object theObjectRef = > > myContext.lookup(aName+"/"+theName.getName()); > > EJBHome theHome = > (EJBHome)PortableRemoteObject.narrow(theObjectRef, > EJBHome.class); > > } > > So far the code works fine, but the trouble is that the > class name > stores in JNDI is always something like "$Proxy1". But i > would like to > get the real > Homeinterface class name. > > By the way : even in JNDIView the classnames appear as > "$Proxy0", > "$Proxy1" , etc. > > Any ideas how to get at the "real" class names? > > Thanks > > Lorenzo Resta > > SurfKitchen Inc. > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user > > > > ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Alexander, I know that somebody has to implement an interface.. That's not the point. I was simply trying the find the name of the home interface. It would be nice if JBoss would publish the name of the home interface in JNDI. Shouldn't the getEJBMetaData().getHomeInterfaceClass() return the home interface, or does it return the class that implements the home interface? Thanks Lorenzo Alexander Kogan wrote: [EMAIL PROTECTED]">Lorenzo,1. Actually the *real* name is the "$ProxyN".JBoss uses dynamic proxy to construct asort of stub for your EJB client. The returned "$Proxy" class implements your HomeInterface.2. You HomeInterface is the *interface*.So anyway, something should implement it.What did you expect?3. You may get the list of interfaces and/oryour real HomeInterface by using reflection.Regards,Alex,Lorenzo Resta wrote: Hi,Does someone know how to get the thre "real" class names of EJB's lookedup through a given context?Right now i try to look up all name in a specified context like this:myContext = new InitialContext();theNames = myContext.list("/company/applications");while(theNames.hasMore()){ NameClassPair theName = (NameClassPair)theNames.next(); String theClassName = theName.getClassName(); //<--- Here i getalways classnames like "$Proxy1" Object theObjectRef = myContext.lookup(aName+"/"+theName.getName()); EJBHome theHome =(EJBHome)PortableRemoteObject.narrow(theObjectRef, EJBHome.class);}So far the code works fine, but the trouble is that the class namestores in JNDI is always something like "$Proxy1". But i would like toget the realHomeinterface class name.By the way : even in JNDIView the classnames appear as "$Proxy0","$Proxy1" , etc.Any ideas how to get at the "real" class names?ThanksLorenzo RestaSurfKitchen Inc.___JBoss-user mailing list[EMAIL PROTECTED]http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Lorenzo, 1. Actually the *real* name is the "$ProxyN". JBoss uses dynamic proxy to construct a sort of stub for your EJB client. The returned "$Proxy" class implements your HomeInterface. 2. You HomeInterface is the *interface*. So anyway, something should implement it. What did you expect? 3. You may get the list of interfaces and/or your real HomeInterface by using reflection. Regards, Alex, Lorenzo Resta wrote: > > Hi, > > Does someone know how to get the thre "real" class names of EJB's looked > up through a given context? > Right now i try to look up all name in a specified context like this: > > myContext = new InitialContext(); > > theNames = myContext.list("/company/applications"); > > while(theNames.hasMore()){ > > NameClassPair theName = (NameClassPair)theNames.next(); > > String theClassName = theName.getClassName(); //<--- Here i get > always classnames like "$Proxy1" > > Object theObjectRef = myContext.lookup(aName+"/"+theName.getName()); > > EJBHome theHome = > (EJBHome)PortableRemoteObject.narrow(theObjectRef, EJBHome.class); > > } > > So far the code works fine, but the trouble is that the class name > stores in JNDI is always something like "$Proxy1". But i would like to > get the real > Homeinterface class name. > > By the way : even in JNDIView the classnames appear as "$Proxy0", > "$Proxy1" , etc. > > Any ideas how to get at the "real" class names? > > Thanks > > Lorenzo Resta > > SurfKitchen Inc. > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user -- __ Alexander Kogan PTC www.ptc.com [EMAIL PROTECTED]140 Kendrick St. Needham MA 02494 ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Hi Burkhard, The problem is that i don't know the bean's name. The list() method returns an enumeration of JNDI names found in the given context. If you have deployed beans in the context, you can get at the name and classname through the NameClassPair class. I have also tried your approach : home.getEJBMetaData().getHomeInterfaceClass(), but i still get only classnames like "$Proxy0". Do you get the real classnames? Thanks Lorenzo Burkhard Vogel wrote: 016001c11067$73c571c0$[EMAIL PROTECTED]">Hi,not sure about the return values of list() but you can do:Object obj = new InitialContext().lookup(BeanName);EJBHome home =(EJBHome)javax.rmi.PortableRemoteObject.narrow(obj, EJBHome.class);log.debug("HomeInterface: " +home.getEJBMetaData().getHomeInterfaceClass());Burkhard- Original Message -From: "Lorenzo Resta" <[EMAIL PROTECTED]>To: <[EMAIL PROTECTED]>Sent: Thursday, July 19, 2001 4:49 PMSubject: [JBoss-user] Classnames in JNDI Hi,Does someone know how to get the thre "real" class names of EJB's lookedup through a given context?Right now i try to look up all name in a specified context like this:myContext = new InitialContext();theNames = myContext.list("/company/applications");while(theNames.hasMore()){ NameClassPair theName = (NameClassPair)theNames.next(); String theClassName = theName.getClassName(); //<--- Here i getalways classnames like "$Proxy1" Object theObjectRef = myContext.lookup(aName+"/"+theName.getName()); EJBHome theHome =(EJBHome)PortableRemoteObject.narrow(theObjectRef, EJBHome.class);}So far the code works fine, but the trouble is that the class namestores in JNDI is always something like "$Proxy1". But i would like toget the realHomeinterface class name.By the way : even in JNDIView the classnames appear as "$Proxy0","$Proxy1" , etc.Any ideas how to get at the "real" class names?ThanksLorenzo RestaSurfKitchen Inc.___JBoss-user mailing list[EMAIL PROTECTED]http://lists.sourceforge.net/lists/listinfo/jboss-user ___JBoss-user mailing list[EMAIL PROTECTED]http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Classnames in JNDI
Hi, not sure about the return values of list() but you can do: Object obj = new InitialContext().lookup(BeanName); EJBHome home = (EJBHome)javax.rmi.PortableRemoteObject.narrow(obj, EJBHome.class); log.debug("HomeInterface: " + home.getEJBMetaData().getHomeInterfaceClass()); Burkhard - Original Message - From: "Lorenzo Resta" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 19, 2001 4:49 PM Subject: [JBoss-user] Classnames in JNDI > Hi, > > Does someone know how to get the thre "real" class names of EJB's looked > up through a given context? > Right now i try to look up all name in a specified context like this: > > myContext = new InitialContext(); > > theNames = myContext.list("/company/applications"); > > while(theNames.hasMore()){ > > NameClassPair theName = (NameClassPair)theNames.next(); > > String theClassName = theName.getClassName(); //<--- Here i get > always classnames like "$Proxy1" > > Object theObjectRef = myContext.lookup(aName+"/"+theName.getName()); > > EJBHome theHome = > (EJBHome)PortableRemoteObject.narrow(theObjectRef, EJBHome.class); > > } > > So far the code works fine, but the trouble is that the class name > stores in JNDI is always something like "$Proxy1". But i would like to > get the real > Homeinterface class name. > > By the way : even in JNDIView the classnames appear as "$Proxy0", > "$Proxy1" , etc. > > Any ideas how to get at the "real" class names? > > Thanks > > Lorenzo Resta > > SurfKitchen Inc. > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user