Thursday, September 1, 2016

WebLogic deployment plan for a EAR with EJB deployed in a WAR and not in a separate JAR module

https://docs.oracle.com/cd/E19798-01/821-1841/gippi/index.html

"To include enterprise bean class files in a WAR module, the class files should be in the WEB-INF/classes directory. To include a JAR file that contains enterprise beans in a WAR module, add the JAR to the WEB-INF/lib directory of the WAR module. WAR modules that contain enterprise beans do not require an ejb-jar.xml deployment descriptor. If the application uses ejb-jar.xml, it must be located in the WAR module’s WEB-INF directory. "

in this case you MUST put an empty weblogic-ejb-jar.xml in the WAR's file WEB-INF directory:


<weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/weblogic-ejb-jar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-ejb-jar http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd">
</weblogic-ejb-jar>





then you can provide a deployment plan plan.xml :


<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd">
  <application-name>PippoApplication.ear</application-name>
  <variable-definition>
    <variable>
      <name>WeblogicEnterpriseBean_com.pippo.PippoBean_CreateAsPrincipalName_14562212116401</name>
      <value>SERVERSTARTUP.CREATE.PRINCIPAL</value>
    </variable>
  </variable-definition>
  <module-override>
    <module-name>PippoDashboard.war</module-name>
    <module-type>war</module-type>
    <module-descriptor external="false">
      <root-element>weblogic-ejb-jar</root-element>
      <uri>WEB-INF/weblogic-ejb-jar.xml</uri>
      <variable-assignment>
        <name>WeblogicEnterpriseBean_com.pippo.PippoBean_CreateAsPrincipalName_14562212116401</name>
        <xpath>/weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="PippoBean"]/create-as-principal-name</xpath>
      </variable-assignment>
    </module-descriptor>
    <module-descriptor external="false">
      <root-element>ejb-jar</root-element>
      <uri>META-INF/ejb-jar.xml</uri>
    </module-descriptor>
  </module-override>
  <config-root>/path/to/envconfig/deployplans/</config-root>
</deployment-plan>


and in the config.xml you configure the deployment plan:

  <app-deployment>
    <name>PippoApplication</name>
    <target>mywlsserver</target>
    <module-type>ear</module-type>
    <source-path>/path/to/PippoApplication.ear</source-path>
    <deployment-principal-name>PIPPO.deployment.principal</deployment-principal-name>
    <plan-dir>/path/to/plan</plan-dir>
    <plan-path>/path/to/envconfig/deployplans/plan.xml</plan-path>
    <security-dd-model>Advanced</security-dd-model>
    <staging-mode>nostage</staging-mode>
  </app-deployment>




No comments: