configure seam 2.2 entitymanager在websphere 7上工作

时间:2014-04-06 11:44:48

标签: entitymanager websphere-7 jboss-seam

我使用seam-gen工具创建了一个jboss seam 2.2应用程序(ear文件) 该应用程序在jboss 4.3上运行良好,

根据seam参考文档中提供的文档修改了jar后,我设法在websphere 7上运行应用程序,

问题:我尝试了很多方法来配置连接到数据库的持久性,但是没有用。 将应用程序连接到DB(oracle)的正确方法是什么?我在websphere 7中创建了一个工作数据,但我不确定(components.xml)和(persistence.xml)中的正确配置是什么

提前致谢

1- persistence.xml

  <?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for prod profile -->
<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="shbCalc">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>shbCalcDS</jta-data-source>
      <properties>
         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
         <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
         <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.hbm2ddl.auto" value="none"/>
      </properties>
   </persistence-unit>

</persistence>

2- 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:persistence="http://jboss.com/products/seam/persistence"
            xmlns:security="http://jboss.com/products/seam/security"
            xmlns:transaction="http://jboss.com/products/seam/transaction"            
            xmlns:drools="http://jboss.com/products/seam/drools"
            xmlns:mail="http://jboss.com/products/seam/mail"
            xmlns:web="http://jboss.com/products/seam/web"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation=
                "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
                 http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
                 http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
                 http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.2.xsd                 
                 http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
                 http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
                 http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd
                 http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd">

    <transaction:ejb-transaction />

    <core:init jndi-pattern="ejblocal:#{ejbName}" debug="true" ></core:init>

    <persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="@puJndiName@"/>   

    <core:manager concurrent-request-timeout="500"
                 conversation-timeout="120000"
                 conversation-id-parameter="cid"
                 parent-conversation-id-parameter="pid"/>

   <!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
   <web:hot-deploy-filter url-pattern="*.seam"/>


   <security:identity authenticate-method="#{authenticator.authenticate}" />

   <event type="org.jboss.seam.security.notLoggedIn">
      <action execute="#{redirect.captureCurrentView}"/>
   </event>
   <event type="org.jboss.seam.security.loginSuccessful">
      <action execute="#{redirect.returnToCapturedView}"/>
   </event>

   <mail:mail-session host="localhost" port="25"/>

</components>

3- web.xml

<?xml version="1.0" ?>

    <!-- websphere flavor -->

<web-app 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/web-app_2_5.xsd"
   version="2.5" metadata-complete="true">

   <!-- RichFaces -->

   <context-param>
      <param-name>org.richfaces.SKIN</param-name>
      <param-value>blueSky</param-value>
   </context-param>

   <!-- Suppress spurious stylesheets -->

   <context-param>
      <param-name>org.richfaces.CONTROL_SKINNING</param-name>
      <param-value>disable</param-value>
   </context-param>

   <context-param>
      <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
      <param-value>disable</param-value>
   </context-param>

   <!-- Change load strategy to DEFAULT to disable sending scripts/styles as packs -->

   <context-param>
      <param-name>org.richfaces.LoadStyleStrategy</param-name>
      <param-value>ALL</param-value>
   </context-param>

   <context-param>
      <param-name>org.richfaces.LoadScriptStrategy</param-name>
      <param-value>ALL</param-value>
   </context-param>

   <!-- Seam -->

   <listener>
      <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
   </listener>

   <filter>
      <filter-name>Seam Filter</filter-name>
      <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
   </filter>

   <filter-mapping>
      <filter-name>Seam Filter</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>

   <servlet>
      <servlet-name>Seam Resource Servlet</servlet-name>
      <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
   </servlet>

   <servlet-mapping>
      <servlet-name>Seam Resource Servlet</servlet-name>
      <url-pattern>/seam/resource/*</url-pattern>
   </servlet-mapping>

   <!-- Facelets development mode (disable in production) -->

   <context-param>
      <param-name>facelets.DEVELOPMENT</param-name>
      <param-value>@debug@</param-value>
   </context-param>

   <!-- JSF -->

   <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
   </context-param>

   <servlet>
      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
   </servlet>

   <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.seam</url-pattern>
   </servlet-mapping>

   <security-constraint>
      <display-name>Restrict raw XHTML Documents</display-name>
      <web-resource-collection>
         <web-resource-name>XHTML</web-resource-name>
         <url-pattern>*.xhtml</url-pattern>
      </web-resource-collection>
      <auth-constraint/>
   </security-constraint>

   <!-- Add entries for each EJB session bean which is also a Seam component (not required on JBoss AS) -->

   <persistence-unit-ref>
      <persistence-unit-ref-name>jdbc/shbCalcDS</persistence-unit-ref-name>
   </persistence-unit-ref>


 <ejb-local-ref>
    <!--  This matches the pattern set in components.xml -->
    <ejb-ref-name>ejblocal:EjbSynchronizations</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
  </ejb-local-ref>   

</web-app>

1 个答案:

答案 0 :(得分:0)

最后,我找到了在jboss 4.3和websphere 7上运行的应用程序的正确配置

1- build.xml

<?xml version="1.0"?>
<project name="shbCalc" default="deploy" basedir=".">

    <!-- Give user a chance to override without editing this file or typing -D -->
    <property file="${basedir}/build.properties"/>

    <!-- production is websphere flavor -->
    <!-- Dev is jboss flavor -->

    <property name="profile" value="prod"/>
    <property file="build-${profile}.properties"/>

    <!-- set global properties for this build -->
    <property name="project.name" value="shbCalc"/>
    <property name="project.ear" value="true"/>
    <property name="richfaces.present" value="true"/>
    <property name="dist.dir" value="dist"/>
    <property name="src.model.dir" value="src/main"/>
    <property name="src.action.dir" value="src/hot"/>
    <property name="src.test.dir" value="src/test"/>
    <property name="lib.dir" value="lib"/>
    <property name="endorsed.dir" value="${lib.dir}/endorsed"/>
    <property name="ear.dir" value="exploded-archives/${project.name}.ear"/>
    <property name="exploded.archive.dir" value="${ear.dir}"/>
    <property name="jar.dir" value="${ear.dir}/${project.name}_jar"/>
    <property name="war.dir" value="${ear.dir}/${project.name}_war"/>
    <property name="test.dir" value="test-build"/>
    <property name="bootstrap.dir" value="${basedir}/bootstrap"/>
    <property name="jboss.domain" value="default"/>
    <property name="deploy.dir" value="${jboss.home}/server/${jboss.domain}/deploy"/>
    <property name="ear.deploy.dir" value="${deploy.dir}/${project.name}.ear"/>
    <property name="jar.deploy.dir" value="${ear.deploy.dir}/${project.name}.jar"/>
    <property name="war.deploy.dir" value="${ear.deploy.dir}/${project.name}.war"/>
    <property name="packaged.archive" value="${dist.dir}/${project.name}.ear"/>
    <property name="testng.jar" value="${basedir}/lib/testng-jdk15.jar"/>
    <property name="javac.debug" value="true"/>
    <property name="javac.deprecation" value="false"/>
    <property name="debug" value="false"/>

    <!--Properties for validating configuration files -->
    <property name="validate.resources.dir" value="${basedir}/exploded-archives"/>
    <property name="schema.dir" value="${basedir}/exploded-archives/schemas"/>
    <property name="src.schema.dir" value="${schema.dir}/org/jboss/seam"/>
    <property name="schema.version" value="2.2"/>

    <fileset id="lib" dir="${lib.dir}">
        <include name="*.jar"/>
    </fileset>

    <path id="build.classpath">
        <fileset refid="lib"/>
    </path>

    <!-- Import GlassFish deployment targets -->
    <import file="${basedir}/glassfish-build.xml"/>

    <target name="init" description="Initialize the build">
        <taskdef name="groovyc"
            classname ="org.codehaus.groovy.ant.Groovyc"
            classpathref="build.classpath"/> <!-- really only the groovy jar is necessary -->
        <mkdir dir="${jar.dir}"/>
        <mkdir dir="${ear.dir}"/>
        <mkdir dir="${war.dir}"/>
        <mkdir dir="${dist.dir}"/>

        <condition property="is.debug" value="true">
            <istrue value="${debug}"/>
        </condition>
        <property name="transactionManagerLookupClass" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
        <property name="ejbJndiPattern" value="${project.name}/#{ejbName}/local"/>
        <property name="seamBootstrapsPu" value="false"/>
        <property name="seamEmfRef" value="#{null}"/>
        <condition property="puJndiName" value="java:comp/env/${project.name}/pu" else="java:/${project.name}EntityManagerFactory">
            <available file="${jboss.home}/lib/jboss-vfs.jar"/> <!-- JBoss AS >= 5.0 -->
        </condition>

        <filterset id="persistence">
            <filter token="transactionManagerLookupClass" value="${transactionManagerLookupClass}"/>
        </filterset>
        <filterset id="seam">
            <filter token="ejbJndiPattern" value="${ejbJndiPattern}"/>
            <filter token="seamBootstrapsPu" value="${seamBootstrapsPu}"/>
            <filter token="seamEmfRef" value="${seamEmfRef}"/>
            <filter token="puJndiName" value="${puJndiName}"/>
        </filterset>
        <filterset id="profile">
            <filter token="debug" value="${debug}"/>
        </filterset>

        <!-- if a .groovy file is in model or action, set groovy.present -->
        <available property="groovy.present" value="true" file="" searchparents="true">
            <filepath>
                <fileset dir="${src.action.dir}">
                    <include name="**/*.groovy"/>
                </fileset>
                <fileset dir="${src.model.dir}">
                    <include name="**/*.groovy"/>
                </fileset>
            </filepath>
        </available>
        <condition property="groovy.test.present" value="true">
            <or>
                <isset property="groovy.present"/>
                <available file="" searchparents="true">
                    <filepath>
                        <fileset dir="${src.test.dir}">
                            <include name="**/*.groovy"/>
                        </fileset>
                    </filepath>
                </available>
            </or>
        </condition>
        <!-- NOTE: Seam does not properly detect uncompiled groovy classes in an EAR -->
        <condition property="groovy.dynamic" value="true">
            <and>
                <isset property="groovy.present"/>
                <istrue value="${debug}"/>
            </and>
        </condition>
        <condition property="groovy.static" value="true">
            <and>
                <isset property="groovy.present"/>
                <isfalse value="${debug}"/>
            </and>
        </condition>
    </target>

    <target name="groovy.compile" if="groovy.static">
        <groovyc classpathref="build.classpath"
            destdir="${jar.dir}"
            srcdir="${src.model.dir}">
        </groovyc>
        <path id="groovy.action.classpath">
            <path refid="build.classpath"/>
            <dirset dir="${jar.dir}"/>
        </path>
        <groovyc classpathref="groovy.action.classpath"
            destdir="${jar.dir}"
            srcdir="${src.action.dir}">
        </groovyc>
    </target>

    <target name="groovy.copy" if="groovy.dynamic">
        <copy todir="${jar.dir}">
            <fileset dir="${src.action.dir}">
                <include name="**/*.groovy"/>
            </fileset>
        </copy>
    </target>

    <target name="compile" depends="init,groovy.compile,groovy.copy"
        description="Compile the Java source code"
        unless="eclipse.running">
        <javac classpathref="build.classpath"
            destdir="${jar.dir}"
            debug="${javac.debug}"
            deprecation="${javac.deprecation}"
            nowarn="on">
            <src path="${src.model.dir}"/>
            <src path="${src.action.dir}"/>
        </javac>
    </target>

    <target name="copyclasses" depends="init"
        description="Copy the classes that were compiled by eclipse"
        if="eclipse.running">
        <copy todir="${jar.dir}">
            <fileset dir="classes/main">
                <include name="**/*.class"/>
            </fileset>
            <fileset dir="classes/hot">
                <include name="**/*.class"/>
            </fileset>
        </copy>
    </target>

    <target name="jar" depends="compile,copyclasses"
        description="Build the JAR structure in a staging directory">
        <copy todir="${jar.dir}">
            <fileset dir="${src.model.dir}">
                <include name="**/*.component.xml" />
            </fileset>
            <fileset dir="${basedir}/resources">
                <include name="seam.properties"/>
                <include name="*.drl"/>
                <include name="META-INF/*.drl"/>
            </fileset>
        </copy>
        <copy todir="${jar.dir}/META-INF">
            <fileset dir="${basedir}/resources/META-INF">
                <include name="ejb-jar.xml"/>
                <include name="orm.xml"/>
            </fileset>
        </copy>
        <copy todir="${jar.dir}/">
            <fileset dir="${basedir}/resources">
                <include name="log4j.xml"/>
            </fileset>
        </copy>
        <copy tofile="${jar.dir}/META-INF/persistence.xml"
            file="${basedir}/resources/META-INF/persistence-${profile}.xml">
            <filterset refid="persistence"/>
        </copy>
        <copy tofile="${jar.dir}/import.sql"
            file="${basedir}/resources/import-${profile}.sql"/>
    </target>

    <target name="war" depends="compile"
        description="Build the WAR structure in a staging directory">
        <copy todir="${war.dir}">
            <fileset dir="${basedir}/view"/>
        </copy>
        <copy tofile="${war.dir}/WEB-INF/classes/seam-jndi.properties"
            file="${basedir}/resources/seam-jndi-${profile}.properties">
        </copy>
        <copy tofile="${war.dir}/WEB-INF/classes/components.properties"
            file="${basedir}/resources/components-${profile}.properties">
            <filterset refid="seam"/>
            <filterset refid="profile"/>
        </copy>

        <copy tofile="${war.dir}/WEB-INF/components.xml"
            file="${basedir}/resources/WEB-INF/components-${profile}.xml">
            <filterset refid="seam"/>
            <filterset refid="profile"/>
        </copy>
        <copy todir="${war.dir}/WEB-INF">
            <fileset dir="${basedir}/resources/WEB-INF">
                <include name="*.*"/>
                <include name="lib/*.*"/>
                <exclude name="web-*.xml" />
                <exclude name="components*.xml"/>
            </fileset>
        </copy>



        <copy todir="${war.dir}/WEB-INF/lib">
            <fileset dir="${lib.dir}">
                <includesfile name="deployed-jars-war.list"/>
                <exclude name="jboss-seam-gen.jar"/>
                <exclude name="jboss-seam-debug.jar" unless="is.debug"/>
            </fileset>
        </copy>
        <copy todir="${war.dir}/WEB-INF/classes">
            <fileset dir="${basedir}/resources">
                <include name="*.skin.properties" if="richfaces.present"/>
                <include name="*_theme.properties"/>
                <include name="**/*.xcss" if="richfaces.present"/>
            </fileset>
            <!-- move XCSS into classpath for now
                 loading from web context only works in JBoss AS 4 -->
            <fileset dir="${basedir}/view">
                <include name="**/*.xcss" if="richfaces.present"/>
            </fileset>
        </copy>

        <copy tofile="${war.dir}/WEB-INF/web.xml"
            file="${basedir}/resources/WEB-INF/web-${profile}.xml">
        </copy>

        <native2ascii encoding="UTF-8" src="${basedir}/resources" 
            dest="${war.dir}/WEB-INF/classes" 
            includes="messages*.properties" />      

    </target>

    <target name="ear" description="Build the EAR structure in a staging directory">
        <copy todir="${ear.dir}">
            <fileset dir="${basedir}/resources">
                <include name="*jpdl.xml"/>
                <include name="*hibernate.cfg.xml"/>
                <include name="jbpm.cfg.xml"/>
            </fileset>
            <fileset dir="${lib.dir}">
                <include name="jboss-seam.jar"/>
            </fileset>
        </copy>
        <copy todir="${ear.dir}/lib">
            <fileset dir="${lib.dir}">
                <includesfile name="deployed-jars-ear.list"/>
                <exclude name="icefaces-ahs.jar" if="icefaces.present"/>
            </fileset>
        </copy>
        <copy todir="${ear.dir}/META-INF">
            <fileset dir="${basedir}/resources/META-INF">
                <include name="application.xml"/>
            </fileset>
        </copy>

        <copy tofile="${basedir}/resources/META-INF/jboss-app.xml" 
            file="${basedir}/resources/META-INF/jboss-app-${profile}.xml">
        </copy>

    </target>

    <target name="clear-profile-artifacts" depends="init"
        description="Clear compiled cache of profile-specific artifacts in anticipation of a profile change">
        <delete file="${jar.dir}/META-INF/persistence.xml"/>
        <delete file="${jar.dir}/import.sql"/>
        <delete file="${war.dir}/WEB-INF/classes/components.properties"/>
    </target>

    <target name="stage" depends="jar,war,ear"/>

    <target name="archive" depends="clear-profile-artifacts,stage"
        description="Package the archives">
        <jar jarfile="${dist.dir}/${project.name}.jar" basedir="${jar.dir}"/>
        <jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/>
        <jar jarfile="${dist.dir}/${project.name}.ear">
            <fileset dir="${ear.dir}">
                <exclude name="${project.name}_jar/**"/>
                <exclude name="${project.name}_war/**"/>
            </fileset>
            <fileset dir="${dist.dir}">
                <include name="${project.name}.jar"/>
                <include name="${project.name}.war"/>
            </fileset>
        </jar>
    </target>

    <target name="datasource">
        <fail unless="jboss.home">jboss.home not set</fail>
        <copy file="${basedir}/resources/${project.name}-${profile}-ds.xml"
            tofile="${deploy.dir}/${project.name}-ds.xml"/>
    </target>

    <target name="explode" depends="stage,datasource"
        description="Deploy the exploded archive">
        <fail unless="jboss.home">jboss.home not set</fail>

        <copy todir="${ear.deploy.dir}">
            <fileset dir="${ear.dir}">
                <include name="**/*"/>
                <exclude name="${project.name}_jar/**"/>
                <exclude name="${project.name}_war/**"/>
            </fileset>
        </copy>
        <copy todir="${jar.deploy.dir}">
            <fileset dir="${jar.dir}"/>
        </copy>
        <copy todir="${war.deploy.dir}">
            <fileset dir="${war.dir}"/>
        </copy>
    </target>

    <target name="unexplode" description="Undeploy the exploded archive">
        <delete failonerror="no">
            <fileset dir="${ear.deploy.dir}">
                <exclude name="**/*.jar"/>
            </fileset>
        </delete>
        <delete file="${deploy.dir}/${project.name}-ds.xml" failonerror="no"/>
        <delete dir="${ear.deploy.dir}" failonerror="no"/>
    </target>

    <target name="reexplode" depends="unexplode,clean,explode"
        description="Undeploy the exploded archive, clean, then deploy the exploded archive"/>

    <target name="check-deployed" description="Check to see if packaged archive is currently deployed">
        <fail unless="jboss.home">jboss.home not set</fail>
        <condition property="archive.deployed" value="true">
            <available file="${ear.deploy.dir}" type="file"/>
        </condition>
    </target>

    <target name="restart-exploded" unless="archive.deployed" description="Deploy exploded archive if not deployed as packaged archive">
        <antcall target="explode"/>
        <touch file="${ear.deploy.dir}/META-INF/application.xml"/>
    </target>

    <target name="restart-deployed" if="archive.deployed" description="Deploy packaged archive if deployed as packaged archive">
        <antcall target="deploy"/>
    </target>

    <target name="restart" depends="check-deployed,clear-profile-artifacts,restart-exploded,restart-deployed" description="Restart the exploded archive"/>

    <target name="deploy" depends="archive,datasource" description="Deploy the packaged archive">
        <fail unless="jboss.home">jboss.home not set</fail>
        <copy todir="${deploy.dir}" file="${dist.dir}/${project.name}.ear"/>
    </target>

    <target name="undeploy" description="Undeploy the packaged archive">
        <delete file="${deploy.dir}/${project.name}.ear"/>
        <delete file="${deploy.dir}/${project.name}-ds.xml"/>
    </target>

    <target name="redeploy" depends="undeploy,clean,deploy"
        description="Undeploy the packaged archive, clean, then deploy the packaged archive"/>

    <target name="clean" description="Cleans up the staging directory">
        <delete dir="${dist.dir}"/>
        <delete dir="${basedir}/exploded-archives"/>
        <delete dir="${src.schema.dir}" failonerror="no"/>
        <delete dir="${basedir}/test-report"/>
        <delete dir="${basedir}/test-output"/>
        <delete failonerror="no" includeemptydirs="true">
            <fileset dir="${test.dir}">
                <exclude name="**/*.class" if="eclipse.running"/>
            </fileset>
        </delete>
    </target>

    <target name="compiletest" depends="groovy.compiletest" unless="eclipse.running" description="Compile the Java source code for the tests">
        <mkdir dir="${test.dir}"/>
        <javac classpathref="build.classpath"
            destdir="${test.dir}"
            debug="${javac.debug}"
            deprecation="${javac.deprecation}"
            nowarn="on">
            <src path="${src.action.dir}"/>
            <src path="${src.model.dir}"/>
            <src path="${src.test.dir}"/>
        </javac>
    </target>

    <target name="groovy.compiletest" if="groovy.test.present" description="Compile the Groovy source code for the tests">
        <mkdir dir="${test.dir}"/>
        <groovyc classpathref="build.classpath"
            destdir="${test.dir}">
            <src path="${src.action.dir}"/>
            <src path="${src.model.dir}"/>
            <src path="${src.test.dir}"/>
        </groovyc>
    </target>

    <target name="copytestclasses" if="eclipse.running" description="Copy classes compiled by eclipse to the test dir">
    <mkdir dir="${test.dir}"/>
        <copy todir="${test.dir}">
            <fileset dir="classes/main">
                <include name="**/*.class"/>
            </fileset>
        </copy>
        <copy todir="${test.dir}">
            <fileset dir="classes/hot">
                <include name="**/*.class"/>
            </fileset>
        </copy>
        <copy todir="${test.dir}">
            <fileset dir="classes/test">
                <include name="**/*.class"/>
            </fileset>
        </copy>
    </target>

    <target name="buildtest" depends="init,compiletest,copytestclasses" description="Build the tests">
        <copy todir="${test.dir}">
            <fileset dir="${basedir}/resources">
                <exclude name="META-INF/persistence*.xml"/>
                <exclude name="import*.sql"/>
                <exclude name="${project.name}-*-ds.xml"/>
                <exclude name="components-*.properties"/>
            </fileset>
            <fileset dir="${basedir}/view"/>
        </copy>
        <copy tofile="${test.dir}/META-INF/persistence.xml"
            file="${basedir}/resources/META-INF/persistence-test.xml"/>
        <copy tofile="${test.dir}/import.sql"
            file="${basedir}/resources/import-test.sql"/>
        <copy tofile="${test.dir}/components.properties"
            file="${basedir}/resources/components-test.properties"/>
        <copy todir="${test.dir}" flatten="true">
            <fileset dir="${src.test.dir}">
                <include name="**/*Test.xml"/>
            </fileset>
        </copy>
    </target>

    <target name="test" depends="buildtest" description="Run the tests">
        <fail message="Cannot run tests because path to project contains spaces.">
            <condition>
                <contains string="${basedir}" substring=" "/>
            </condition>
        </fail>
        <condition property="incompatible.jdk" value="true">
            <and>
                <equals arg1="${ant.java.version}" arg2="1.6"/>
                <not><available classname="javax.xml.bind.JAXB"/></not>
            </and>
        </condition>
        <fail if="incompatible.jdk">You are using an incompatible JDK 6. Please use Sun JDK 6 Update 4 (1.6.0_04) or newer or use Open JDK 6.</fail>
        <taskdef resource="testngtasks" classpath="${testng.jar}"/>
        <path id="test.path">
            <path path="${test.dir}"/>
            <fileset dir="${lib.dir}/test">
                <include name="*.jar"/>
            </fileset>
            <path path="${bootstrap.dir}"/>
            <path refid="build.classpath"/>
        </path>
        <testng outputdir="${basedir}/test-report">
            <jvmarg line="-Dsun.lang.ClassLoader.allowArraySyntax=true"/>
            <classpath refid="test.path"/>
            <xmlfileset dir="${test.dir}" includes="*Test.xml"/>
        </testng>
    </target>

    <target name="javadoc" depends="compile">
        <mkdir dir="${dist.dir}/apidoc"/>
        <javadoc classpathref="build.classpath" destdir="${dist.dir}/apidoc" use="true" protected="true" version="true" windowtitle="${project.name} API Documentation" doctitle="${project.name} API Documentation" link="http://java.sun.com/j2se/5.0/docs/api">
            <packageset dir="${src.action.dir}" defaultexcludes="yes">
                <include name="*/**"/>
            </packageset>
            <packageset dir="${src.model.dir}" defaultexcludes="yes">
                <include name="*/**"/>
            </packageset>
        </javadoc>
    </target>

    <!-- deprecated -->
    <target name="validateConfiguration" depends="validate"/>

    <target name="validate" depends="stage" description="Validate the XML configuration files">
        <mkdir dir="${schema.dir}"/>
        <unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}">
            <patternset>
                <include name="org/jboss/seam/*.xsd"/>
                <include name="org/jboss/seam/*.dtd"/>
            </patternset>
        </unjar>
        <ant antfile="validate.xml" target="validateConfiguration"/>
    </target>

    <target name="purge" depends="undeploy" description="Clean out JBoss AS temporary deployment files">
        <delete dir="${jboss.home}/server/default/tmp/deploy"/>
        <mkdir dir="${jboss.home}/server/default/tmp/deploy/"/>
        <delete dir="${jboss.home}/server/default/tmp/sessions"/>
        <mkdir dir="${jboss.home}/server/default/tmp/sessions"/>
        <delete dir="${jboss.home}/server/default/work/jboss.web/localhost/${project.name}"/>
    </target>

</project>

2- components-prod.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:persistence="http://jboss.com/products/seam/persistence"
            xmlns:security="http://jboss.com/products/seam/security"
            xmlns:drools="http://jboss.com/products/seam/drools"
            xmlns:mail="http://jboss.com/products/seam/mail"
            xmlns:web="http://jboss.com/products/seam/web"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation=
                "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
                 http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
                 http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
                 http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
                 http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
                 http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd
                 http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd">



    <persistence:entity-manager-factory name="shbCalc"/>

    <persistence:managed-persistence-context name="entityManager" auto-create="true"
                           entity-manager-factory="#{shbCalc}"/>


    <core:init jndi-pattern="ejblocal:#{ejbName}" debug="true" ></core:init>


    <core:manager concurrent-request-timeout="500"
                 conversation-timeout="120000"
                 conversation-id-parameter="cid"
                 parent-conversation-id-parameter="pid"/>

   <!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
   <web:hot-deploy-filter url-pattern="*.seam"/>


   <security:identity authenticate-method="#{authenticator.authenticate}" />

   <event type="org.jboss.seam.security.notLoggedIn">
      <action execute="#{redirect.captureCurrentView}"/>
   </event>
   <event type="org.jboss.seam.security.loginSuccessful">
      <action execute="#{redirect.returnToCapturedView}"/>
   </event>

   <mail:mail-session host="localhost" port="25"/>

</components>

3- persistence-prod.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for prod profile -->
<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="shbCalc">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>shbCalcDS</jta-data-source>
      <properties>
         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
         <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
         <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.hbm2ddl.auto" value="none"/>
      </properties>
   </persistence-unit>

</persistence>

4- deployed-jars-ear.list

antlr-runtime.jar
commons-beanutils.jar
#core.jar
drools-templates.jar
drools-decisiontables.jar
drools-compiler.jar
drools-api.jar
drools-core.jar
groovy-all.jar
janino.jar
jboss-el.jar
#jboss-seam-remoting.jar
mvel2.jar
richfaces-api.jar
jbpm-jpdl.jar


antlr.jar
commons-collections.jar
commons-digester.jar
dom4j.jar
el-ri.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-core.jar
hibernate-entitymanager.jar
hibernate-validator.jar
javassist.jar
jboss-el.jar
log4j.jar
richfaces-api.jar
slf4j-api.jar
slf4j-log4j12.jar
jboss-common.jar

5- deployed-jars-war.list

#commons-digester.jar
jboss-seam-debug.jar
#jboss-seam-excel.jar
#jboss-seam-ioc.jar
#jboss-seam-mail.jar
## jboss-seam-pdf.jar
#jboss-seam-rss.jar
jboss-seam-ui.jar
jsf-facelets.jar
#jxl.jar
richfaces-impl.jar
richfaces-ui.jar
hibernate-entitymanager.jar