[jboss-user] [EJB 3.0] - Re: ejb-jar.xml a clear definition for EJB3

giancarlo.cadei do-not-reply at jboss.com
Thu May 3 05:11:35 EDT 2007


Hello, I'm a newbie with application servers and ejb3 in particular (so maybe you fall from the pan in the brace - as we say in italian) but with my search on internet and with a lot of patient I've concluded that what you need to deploy an ejb3 is.
Suppose you want to deploy a jar with a session bean that use an entity (POJO) bean. Who use the bean is another jar into the same application (ear)
1) the bean jar need an ejb-jar.xml 
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
  <display-name>uns-bean</display-name>
  <enterprise-beans>
    
      <ejb-name>UniqueNumberBean</ejb-name>
    
  </enterprise-beans>
</ejb-jar>
2) it need also a jboss.xml:
<?xml version="1.0" encoding="UTF-8"?>
<enterprise-beans>
      
         <ejb-name>UniqueNumberBean</ejb-name>
         <jndi-name>UniqueNumberBean</jndi-name>
      
</enterprise-beans>
3) For the entity is required a persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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">
  <persistence-unit name="uns-ejbPU" transaction-type="JTA">
    org.hibernate.ejb.HibernatePersistence
    <jta-data-source>java:OracleDS</jta-data-source>
    eu.efsa.docreg.uns.beans.PendingNumber
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    
    
  </persistence-unit>

4) I've also used a jndi.properties
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099

The Session bean implements the Local and the Remote interface.

<<In the mouth of the loop>> (reply is .... <>)

Regards
Giancarlo

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042747



More information about the jboss-user mailing list