• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Troubles when try to lookup java:comp

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a new resource on my jboss and I was trying to get the reference through JNDI, but I got some error when tryied do that.

1_ I declared on jboss-web.xml of my app this:
<?xml version="1.0" encoding="UTF-8" ?>
<jboss-web>
<resource-ref>
<res-ref-name>bean/MyBeanFactory</res-ref-name>
<res-type>com.mycompany.MyBean_Stub</res-type>
<jndi-name>java:bean/MyBeanFactory</jndi-name>
</resource-ref>
</jboss-web>

2_ the web.xml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<web-app>
<display-name>Bean Test</display-name>
<description>Just a bean test</description>
<resource-ref>
<res-ref-name>bean/MyBeanFactory</res-ref-name>
<res-type>com.mycompany.MyBean_Stub</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>

3_ In the client app I did this:
String sInitialContextFactory = "org.jnp.interfaces.NamingContextFactory";
String sProviderUrl = "jnp://localhost:1099";
String sInterface = "org.jboss.naming rg.jnp.interfaces";

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, sInitialContextFactory);
env.put(Context.PROVIDER_URL, sProviderUrl);
env.put(Context.URL_PKG_PREFIXES, sInterface);

Context initialContext = new InitialContext(env);
Object obj = initialContext.lookup("/bean/MyBeanFactory");

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

I get the following exception.

Exception in thread "main" javax.naming.NameNotFoundException: bean not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
at org.jnp.server.NamingServer.lookup(NamingServer.java:252)
at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.mycompany.BeanClient.main(BeanClient.java:41)


------------**************----------------

Tired of try that, I did other thing, I made a lookup to "java:comp" and I got the same exception "comp not bound"

Any Idea? I think is something related with the Naming context.

Is this the right step to registry a resource?



Anibal
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
resource-ref is for things like queue connection factories or data sources. It has nothing to do with referencing EJBs, and you would never have any need to know about stub implementations in the deployment descriptors.
 
Anibal Gimenez Canicoba
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You right, the right tag should be <res-type>com.mycompany.MyBean</res-type>, but I don't want to publish an EJB, I want to work with RMI-iiop, I created a simple bean whith its stub and skeleton(rmic) and I would like to let it available like a resource in the simple RMI registry but in an app. server.
I heard or read in some place that this is possible(publish as a resource).

Any idea?


 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BEA has a lot of documentation on using RMI-IIOP with Weblogic; you may want to start there and see if you could back-port any of the info to JBoss. I'd have to say this sounds amazingly painful, since all EJB is doing is automatically creating for you the very things that you are going to need to create manually. Particularly if the webapp and the ejb layer are deployed in the same server, this is rather bizarre.

I'd still be surprised if the specific deployment descriptor tags you are using turn out to be the correct ones; I'm inclined to think that a square peg is getting shoved into a round hole. You may want to consider resource-env-ref as another option. resource-ref is really intended for JCA resource adapters or things that behave very similarly, like data sources. If you wouldn't resolve a bean binding via resource-ref, I'm surprised if you'd resolve its RMI equivalent that way.

You'll probably need to poke around in the jmx-console app to see where JBoss is binding things. Trying to use an ENC to resolve the binding might be adding to your problem. Going through the global JNDI tree may make more sense for you.
[ February 03, 2006: Message edited by: Reid M. Pinchback ]
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<ejb-ref>
<ejb-ref-name>ejb/[myEjb]</ejb-ref-name>
<jndi-name>ejb/[package]/[myEjb]</jndi-name>
</ejb-ref>
 
Wiley Snyder
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what version are you using ???

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic