geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fabian Dankof" <fab...@dankof.net>
Subject References between Webapp and EJB
Date Sat, 08 Apr 2006 08:37:55 GMT
Hello!
 
I'm trying to get a simple example thing to work that consists of an EJB and a webapp.
Up to now I don't know exactly how references between webapps and ejbs are made.
Additionally I don't know which files I actually need.
 
I've got the following deployment descriptors:
 
ejb-jar.xml:
--------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1">

   <description><![CDATA[StringMirrorEJB generated by eclipse wtp xdoclet extension.]]></description>
   <display-name>StringMirrorEJB</display-name>

   <enterprise-beans>

      <!-- Session Beans -->
      <session id="Session_MyStringMirror">
         <description><![CDATA[A session bean named MyStringMirror]]></description>
         <display-name>MyStringMirror</display-name>

         <ejb-name>MyStringMirror</ejb-name>

         <home>foo.MyStringMirrorHome</home>
         <remote>foo.MyStringMirror</remote>
         <local-home>foo.MyStringMirrorLocalHome</local-home>
         <local>foo.MyStringMirrorLocal</local>
         <ejb-class>foo.MyStringMirrorSession</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
      </session>
   </enterprise-beans>

</ejb-jar>
--------------------------------------------------------------

Here is my question if i need an additional 'id' attribute in the <ejb-jar> tag and
which value it should have. I already noticed that the value in the 'id' attribute
is taken as 'Component Name' in Geronimo Console.


Here is my web.xml:

---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<web-app id="web-app_1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
   <display-name>SimpleEJBConsumer</display-name>
   <distributable/>


   <servlet>
      <display-name>SimpleEJBConsumer</display-name>
      <servlet-name>SimpleEJBConsumer</servlet-name>
      <servlet-class>foo.SimpleEJBConsumer</servlet-class>

   </servlet>


   <servlet-mapping>
      <servlet-name>SimpleEJBConsumer</servlet-name>
      <url-pattern>/SimpleEJBConsumer</url-pattern>
   </servlet-mapping>
 </web-app>
---------------------------------------------------------------

Do i need an ejb-ref in the web.xml???


geronimo-web.xml:

---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.0" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.0"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.0"
configId="SimpleEJBConsumer/SimpleEJBConsumer">
  <context-root>/SimpleEJBConsumer</context-root>
  <context-priority-classloader>false</context-priority-classloader>
  <nam:ejb-ref>
  	<nam:ref-name>ejb/MyStringMirror</nam:ref-name>
  	<nam:target-name>geronimo.server:J2EEServer=geronimo,j2eeType=StatelessSessionBean,name=MyStringMirror</nam:target-name>
 
  </nam:ejb-ref>
</web-app>
---------------------------------------------------------------


I would be very glad if someone can just tell my what is needed, and what is not.


Thanks,

Fabian



Mime
View raw message