geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Mulder" <ammul...@alumni.princeton.edu>
Subject Re: How to do a local bean lookup
Date Wed, 19 Apr 2006 12:07:55 GMT
OK, so looking at the schemas/ejb-jar_2_1.xsd schema it looks like the
ejb-ref stuff is imported from the J2EE schema, and looking at
schemas/j2ee_1_4.xsd I see this:

  <xsd:complexType name="ejb-ref-typeType">
    <xsd:annotation>
      <xsd:documentation>

        The ejb-ref-typeType contains the expected type of the
        referenced enterprise bean.

        The ejb-ref-type designates a value
        that must be one of the following:

            Entity
            Session

      </xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:restriction base="j2ee:string">
        <xsd:enumeration value="Entity"/>
        <xsd:enumeration value="Session"/>
      </xsd:restriction>
    </xsd:simpleContent>
  </xsd:complexType>

Thanks,
    Aaron

On 4/19/06, Siraj Mohamed <Siraj@virtusa.com> wrote:
> Thanks Aaron.
>
> It does not work in any order and this is the abstract string of the
> exception.
>
>
> Caused by: org.apache.xmlbeans.XmlException: Invalid deployment
> descriptor: [error: cvc-enumeration-valid: string value 'Stateless' is
> not a valid enumeration value for ejb-ref-typeType in namespace
> http://java.sun.com/xml/ns/j2ee]
> Descriptor: <ejb-jar
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/x
> ml/ns/j2ee/ejb-jar_2_1.xsd" versi
> 2.1" id="ejb-jar_1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/j2ee">
>
>
> It indicated that 'Stateless' is not a valid value for ejb-ref-type.
>
> My Demo2 bean is a stateless bean. Any thought what's wrong here?
>
> Thanks,
> Siraj
>
> -----Original Message-----
> From: ammulder@gmail.com [mailto:ammulder@gmail.com] On Behalf Of Aaron
> Mulder
> Sent: Wednesday, April 19, 2006 3:57 PM
> To: user@geronimo.apache.org
> Subject: Re: How to do a local bean lookup
>
> The new ejb-local-ref looks right.  Maybe you have to swap the order
> of the ejb-local-ref and the resource-ref?  Does the XML parsing error
> give you any specific information about what it expected vs what it
> actualy got?  You can always consult the schema at
> geronimo/schemas/ejb-jar_2_1.xsd
>
> Thanks,
>     Aaron
>
> On 4/19/06, Siraj Mohamed <Siraj@virtusa.com> wrote:
> >
> >
> >
> > Hi All,
> >
> >
> >
> > I want to do a local lookup of a session bean from another session
> bean.
> > This is what I am actually trying to do:
> >
> >
> >
> > I have two session bean bundled them in the same EAR and in my first
> bean's
> > method; I do a local lookup of the 2nd bean. This is the code:
> >
> >
> >
> > Context jndiCntx = new InitialContext();
> >
> > Object objref = null;
> >
> > Demo2Home home = null;
> >
> > objref = jndiCntx.lookup("Demo2");
> >
> > home = (Demo2Home)PortableRemoteObject.narrow(
> >
> >            objref, Demo2Home.class);
> >
> > Demo2 demo = home.create();
> >
> >
> >
> > Now I am invoking the 1st bean's method from a standalone java (remote
> > client), but I am getting following errors:
> >
> >
> >
> > javax.naming.NameNotFoundException: Demo2
> >
> >             at
> >
> com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:10
> 8)
> >
> >             at
> >
> com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:11
> 6)
> >
> >             at
> > javax.naming.InitialContext.lookup(InitialContext.java:361)
> >
> >             at ejb.demo.DemoBean.ejbCreate(DemoBean.java:116)
> >
> >
> >
> > My ejb-jar.xml contains following information.
> >
> >
> >
> > enterprise-beans>
> >
> >       <session id="Session_Demo">
> >
> >          <description><![CDATA[The bean implementation class for the
> Demo
> > EJB.]]></description>
> >
> >          <ejb-name>Demo</ejb-name>
> >
> >          <home>ejb.demo.DemoHome</home>
> >
> >          <remote>ejb.demo.Demo</remote>
> >
> >          <ejb-class>ejb.demo.DemoBean</ejb-class>
> >
> >          <session-type>Stateful</session-type>
> >
> >          <transaction-type>Bean</transaction-type>
> >
> >
> >
> >          <resource-ref id="ResRef_1">
> >
> >             <res-ref-name>xmeta_defaultDS</res-ref-name>
> >
> >             <res-type>javax.sql.DataSource</res-type>
> >
> >             <res-auth>Container</res-auth>
> >
> >
> > <res-sharing-scope>Shareable</res-sharing-scope>
> >
> >          </resource-ref>
> >
> >       </session>
> >
> >
> >
> >       <session id="Session_Demo2">
> >
> >          <description><![CDATA[The bean implementation class for the
> Demo
> > EJB.]]></description>
> >
> >          <ejb-name>Demo2</ejb-name>
> >
> >          <home>ejb.demo2.Demo2Home</home>
> >
> >          <remote>ejb.demo2.Demo2</remote>
> >
> >          <ejb-class>ejb.demo2.Demo2Bean</ejb-class>
> >
> >          <session-type>Stateless</session-type>
> >
> >          <transaction-type>Container</transaction-type>
> >
> >       </session>
> >
> >    </enterprise-beans>
> >
> >
> >
> > If I lookup the 2nd bean remotely, it works fine but it does not work
> > locally. There were some discussion in the forum regarding this and
> suggest
> > introducing 'ejb-local-ref' tag. I added following for the 1st bean in
> the
> > ejb-jar.xml.
> >
> >
> >
> > <session id="Session_Demo">
> >
> >    .................
> >
> >    <ejb-local-ref>
> >
> >     <ejb-ref-name>ejb/Demo2</ejb-ref-name>
> >
> >     <ejb-ref-type>Stateless</ejb-ref-type>
> >
> >     <local-home>ejb.demo2.Demo2Home</local-home>
> >
> >     <local>ejb.demo2.Demo2</local>
> >
> >     <ejb-link>Demo2</ejb-link>
> >
> >    </ejb-local-ref>
> >
> > </session>
> >
> >
> >
> > After this change, I could not deploy the EAR and getting XML parsing
> > exception for ejb-jar.xml. Possibly I am doing some thing wrong here.
> > Appreciate if any one could suggest a solution.
> >
> >
> >
> > Thanks & Regards,
> >
> > Siraj
> >
> >
> >
> >
> >
> >
>

Mime
View raw message