Deployment
From DaamWiki
Deployment
A Daam application is deployed as an EAR, see testapp.ear as a reference.
+ testapp.ear
+ lib
- daam.jar
- jboss-el.jar
+ META-INF
- application.xml
- jboss-app.xml
- jboss-seam.jar
- testapp.jar
+ META-INF
- ejb-jar.xml
- persistence.xml
- seam.properties
- <class files>
- testapp.war
+ WEB-INF
- components.xml
- web.xml
application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application 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/application_5.xsd"
version="5">
<display-name>Daam</display-name>
<module>
<web>
<web-uri>testapp.war</web-uri>
<context-root>/daam</context-root>
</web>
</module>
<module><ejb>testapp.jar</ejb></module>
<module><ejb>jboss-seam.jar</ejb></module>
</application>
jboss-app.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-app
PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN"
"http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">
<jboss-app>
<loader-repository>
seam.jboss.org:loader=daam
</loader-repository>
</jboss-app>
ejb.jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar 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"
version="3.0">
<interceptors>
<interceptor>
<interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor>
</interceptors>
<assembly-descriptor>
<interceptor-binding>
<ejb-name>*</ejb-name>
<interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
</assembly-descriptor>
</ejb-jar>
persistence.xml
<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="web-persistence" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/CbwDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="none"/>
</properties>
</persistence-unit>
</persistence>
seam.properties is a zero length file, but it's needed by seam to start up. And you get no useful information if you miss this, I spent hours debugging this once. Rox.
components.xml
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:transaction="http://jboss.com/products/seam/transaction"
xmlns:persistence="http://jboss.com/products/seam/persistence"
xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
<core:init jndi-pattern="testapp/#{ejbName}/local"/>
<transaction:ejb-transaction />
<persistence:managed-persistence-context name="em"
auto-create="true"
persistence-unit-jndi-name="java:/EntityManagerFactories/web"/>
</components>
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
<servlet>
<servlet-name>daamservlet</servlet-name>
<servlet-class>daam.DaamServlet</servlet-class>
<init-param>
<param-name>rootContainer</param-name>
<param-value>myContainer</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>daamservlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Resources
You might wonder where all the HTML related resources reside. The GWT compiled stuff is located in the daam.jar. When a resource is requested by the browser, the DaamServlet takes care of the request. It locates the resource using the classloader and then writes it to the output. This mechanism will become important when you want to use custom images. 2do
