Hello, I am getting an odd naming exception when I try to lookup the
connection factory:

<snip>
javax.naming.NameNotFoundException: QueueConnectionFactory not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:474)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:482)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:488)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:283)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:295)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:279)
        at javax.naming.InitialContext.lookup(InitialContext.java:350)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:367)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:279)
        <snip-truncate/>

</snip>

Here are the bits that I added to the ejb-jar and jboss xml files, as well
as a bit of the JNDIView output from the server this is running in:

<snip from="ejb-jar">

  <resource-ref>
    <description>Default QueueConnectionFactory</description>
    <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

</snip>

<snip from="jboss">

  <resource-ref>
    <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
    <resource-name>QueueConnectionFactory</resource-name>
  </resource-ref>

  <snip-truncate/>

  <resource-managers>
    <resource-manager res-class="">
      <res-name>QueueConnectionFactory</res-name>
      <res-jndi-name>QueueConnectionFactory</res-jndi-name>
    </resource-manager>
  </resource-managers>

</snip>

<snip from="JNDIView Output">
  +- QueueConnectionFactory (class: org.jbossmq.SpyQueueConnectionFactory)
</snip>

--

It looks like the namespace of the bean is ok:

<snip from="JNDIView Output">
  +- env (class: org.jnp.interfaces.NamingContext)
    |   +- jms (class: org.jnp.interfaces.NamingContext)
    |   |   +- QueueConnectionFactory (class: javax.naming.LinkRef)
</snip>

--

To lookup the object I am first getting the env context:

 context = new InitialContext().lookup("java:comp/env/");
 ...
 factory = (...) context.lookup("jms/QueueConnectionFactory");

--

I am not really sure where the naming problem comes up.  It looks like it
might be having touble with the LinkRef, but that is only a guess since the
name I am looking for has a 'jms/' prefix on it at the bean level, but the
resource does not.

I will play around with it some more, but if you (or anyone else) has any
ideas please let me know.

Thanks,

--jason

On Thu, 12 Apr 2001, Scott M Stark wrote:

> A ConnectionFactory is a resource factory and the spec talks about JMS
> being located by convention under the java:comp/env/jms context. To
> access a QueueConnectionFactory independent of which app server you
> deploy in you would define an ejb-jar resource-ref as:
>
> ejb-jar.xml:
> <ejb-jar>
>     <display-name>ENC Tests</display-name>
>     <enterprise-beans>
>         <session>
>             <description>A session bean on looks up stuff in the ENC</description>
> ...
>             <!-- JMS Connection Factories (java:comp/env/jms) -->
>             <resource-ref>
>                 <description>Default QueueFactory</description>
>                 <res-ref-name>jms/QueFactory</res-ref-name>
>                 <res-type>javax.jms.QueueConnectionFactory</res-type>
>                 <res-auth>Container</res-auth>
>             </resource-ref>
>         </session>
>     </enterprise-beans>
> </ejb-jar>
>
> jboss.xml:
> <jboss>
>     <enterprise-beans>
>         <session>
>             <ejb-name>ENCBean</ejb-name>
>             <resource-ref>
>                 <resource-name>QueFactory</resource-name>
>                 <res-ref-name>jms/QueFactory</res-ref-name>
>             </resource-ref>
>         </session>
>     </enterprise-beans>
>
>     <resource-managers>
>         <resource-manager res-class="">
>             <res-name>QueFactory</res-name>
>             <res-jndi-name>QueueConnectionFactory</res-jndi-name>
>         </resource-manager>
>     </resource-managers>
> </jboss>
>
> Your bean is indepdendent of the app server but its deployment unit is not.
>
> ----- Original Message -----
> From: "Jason Dillon" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 12, 2001 5:25 PM
> Subject: Re: [JBoss-user] Using JMS resources (or other resources)
>
>
> > That is more or less what I am going to be doing, but I wanted to know if
> > there was a standard way to provide the queue information to a bean.  My
> > guess is that it should be as a resource, but I am not 100% sure.
> >
> > --jason
> >
>
>
>
> _______________________________________________
> 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

Reply via email to