Hello!

No, in general you don't need the ejb-jar.xml. You can include the ejb-jar.xml 
file if you intend to override settings from given annotations. But in generel, 
you don't need it.

What you need to do is:
Create a JAR-file with the ejb:s you want to deploy. This file must also 
include a META-INF/persistence.xml file where you ponit out the datasource you 
wan't to use. Here is an example:

  | <persistence xmlns="http://java.sun.com/xml/ns/persistence";
  |    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  |    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  |      http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";
  |    version="1.0">
  |    <persistence-unit name="my-ejbs">
  |       <jta-data-source>
  |          java:/my-ejbs-DS
  |       </jta-data-source>
  |       <properties>
  |          <!--
  |             <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  |          -->
  |          <property name="show_sql" value="true" />
  |          <property name="dialect"
  |             value="org.hibernate.dialect.MySQLDialect" />
  |       </properties>
  |    </persistence-unit>
  | </persistence>
  | 

The structure of the final jar file containing the ejb:s is something like:

  | /my-ejbs.jar
  |    /META-INF
  |       MANIFEST.MF
  |       persistence.xml
  |    /my
  |       /example
  |          /bean
  |             MyBean.class
  |             ...
  | 

Then  you need to create an ear-file. This is not a must, but you get better 
structure if you deploy your ejbs in an ear file. You still need to specify the 
META-INF/application.xml file.  Here is an example:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <application
  |    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/application_1_4.xsd";
  |    version="1.4">
  |    <description>my application description</description>
  |    <display-name>my-application</display-name>
  |    
  |    <!--
  |    Point out the ejb jar files as ejb modules
  |    -->
  |    <module>
  |       <ejb>my-ejbs.jar</ejb>
  |    </module>
  | 
  |    <!--
  |    Point out the war files as web modules
  |    -->
  |    <module>
  |       <web>
  |          <web-uri>my-service-jaxws-web.war</web-uri>
  |          <context-root>/my-service-jaxws-web</context-root>
  |       </web>
  |    </module>
  | </application>
  | 

A good idea is also to bundle the dependent jar files in the ear file. Place 
them in the lib folder of the ear file. In the META-INF folder you create a 
jboss-app.xml file where you tell jboss to use the libs you provide in the ear 
file. Note that if you do this way and also include a war file in the ear - 
then make sure you don't have any WEB-INF/libs/... in the war file. Here is an 
example:

  | <!DOCTYPE jboss-app
  |    PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
  |    "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd";>
  | <jboss-app>
  |    <loader-repository>my-ejbs:app=ejb3</loader-repository>
  | </jboss-app>
  | 

So finally, this is the structure of the ear file:

  | my-service.ear
  |    /my-ejbs.jar
  |    /lib
  |       dependency_jar_A.jar
  |       dependency_jar_B.jar
  |       ...
  |    /META-INF
  |       MANIFEST.MF
  |       application.xml
  |       jboss-app.xml
  | 


Kind regards
Oskar


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042766#4042766

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042766
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to