1. Fix Syntax Error
1) Use WLS8.1 Tools “Weblogic Builder” Re-Gen the EJB description files (weblogic-ejb-jar.xml, ejb-jar.xml, weblogic-cmp-rdbms-jar.xml)
由于在EJB的描述文件中的头部指明了server的版本,所以在使用的时候6.0的版本文件不能被8.1的版本识别。可以在本地(win环境)中安装wl8.1后使用Start Menu/Programs/BEA WebLogic Platform 8.1/Other Development Tools/WebLogic Builder实现。只需要指向打你的ejb的source文件就可以实现那!
执行后会在产生一个build的文件夹里面的描述文件转换为8.1 的了!
2) Fixed All EJB description files EJB-QL syntax error (weblogic-ejb-jar.xml, ejb-jar.xml, weblogic-cmp-rdbms-jar.xml)
For example:
Example 1)
File:ejb-jar.xml
<ejb-ql>
FROM ManufacturerEJB AS m
</ejb-ql>
Should be changed to:
<ejb-ql><![CDATA[SELECT OBJECT(m) FROM ManufacturerEJB AS m]]></ejb-ql>
Example 2)
File: weblogic-cmp-rdbms-jar.xml
<weblogic-ql>
FROM ManufacturerEJB AS m ORDERBY m.shortname
</weblogic-ql>
Should be changed to:
<weblogic-ql>
<![CDATA[SELECT OBJECT(m) FROM ManufacturerEJB AS m ORDERBY m.shortname]]>
</weblogic-ql>
Example 3)
File: weblogic-cmp-rdbms-jar.xml
<weblogic-ql>
<![CDATA[SELECT OBJECT(a) FROM ManufacturerEJB AS a WHERE a.shortname = ?1 ORDERBY shortname]]>
</weblogic-ql>
Should be changed to:
<weblogic-ql>
<![CDATA[SELECT OBJECT(a) FROM ManufacturerEJB AS a WHERE a.shortname = ?1 ORDERBY a.shortname]]>
</weblogic-ql>
8.1的中对描述文件中的格式要求严格,所以注意有关在其中的修改!
2. Package all EJB into one EJB named “WizdomEJB.jar” (Fix the local interface problem)
2.1 Combine ejb-jar.xml into one.
a)Retrieve the statements between <enterprise-beans> and </enterprise-beans> from ejb-jar.xml in every EJB jars, and insert into the place between <enterprise-beans> and </enterprise-beans> in ejb-jar.xml of the WizdomEJB.jar.
b) Retrieve the statements between <assembly-descriptor> and </assembly-descriptor> from ejb-jar.xml in every EJB jars, and insert into the place between <assembly-descriptor> and </assembly-descriptor> in ejb-jar.xml of the WizdomEJB.jar.
2.2 Combine weblogic-cmp-rdbms-jar.xml into one.
Retrieve the statements between <weblogic-rdbms-jar> and </weblogic-rdbms-jar> from weblogic-cmp-rdbms-jar.xml in every EJB jars, and insert into the place between <weblogic-rdbms-jar> and </weblogic-rdbms-jar> in weblogic-cmp-rdbms-jar.xml of the WizdomEJB.jar.
2.3 Combine weblogic-ejb-jar.xml into one.
Retrieve the statements between <weblogic-ejb-jar> and </weblogic-ejb-jar> from weblogic-ejb-jar.xml in every EJB jars, and insert into the place between <weblogic-ejb-jar> and </weblogic-ejb-jar> in weblogic-ejb-jar.xml of the WizdomEJB.jar.
2.4 Combine class files into one.
Copy the class files in every EJB jars into the class path of the WizdomEJB.jar.
3. Re-Compile EJB use WLS8.1 library and EJBC
a) Change property file:
/apps/maps/src/old/components/com/wisdom/maps.properties
Change Weblogic Home to WLS 8.1 Home:
For example: WL_HOME=/bea/weblogic81
2) Change build.xml file to meet the new environment
For example:
<classpath><pathelement path="${WL_HOME}/lib/weblogic.jar” /></classpath>
Should be changed to:
<classpath><pathelement path="${WL_HOME}/server/lib/weblogic.jar” /></classpath>
两个例子build.xml文件:
一:
<project name="ejb20-basic-containerManaged" default="all" basedir=".">
<!-- set global properties for this build -->
<property environment="env"/>
<property file="../maps.properties"/>
<property name="source" value="."/>
<property name="build" value="${source}/build"/>
<property name="dist" value="${source}/dist"/>
<target name="all" depends="clean, init, compile_ejb, jar_ejb, ejbc "/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile
and copy the deployment descriptors into it-->
<mkdir dir="${build}"/>
<mkdir dir="${build}/META-INF"/>
<mkdir dir="${dist}"/>
<copy todir="${build}/META-INF">
<fileset dir="${source}">
<include name="*.xml"/>
<exclude name="build.xml"/>
</fileset>
</copy>
</target>
<!-- Compile ejb classes into the build directory (jar preparation) -->
<target name="compile_ejb">
<javac srcdir="${source}" destdir="${build}"
includes="
ApplicationAccount.java, ApplicationAccountBean.java, ApplicationAccountHome.java,ApplicationAccountInfo.java,
IsvProfile.java, IsvProfileBean.java, IsvProfileHome.java
User.java, UserBean.java, UserHome.java,
UsrVCard.java, UsrVCardBean.java, UsrVCardHome.java,
ManufacturerBean.java, ManufacturerHome.java, Manufacturer.java,
Handset.java, HandsetBean.java, HandsetHome.java,
Category.java, CategoryBean.java, CategoryHome.java,
MidletHome.java, MidletBean.java, Midlet.java,
MidletVersion.java, MidletVersionHome.java, MidletVersionBean.java,
MidletFeature.java, MidletFeatureHome.java, MidletFeatureBean.java,
MidletSupportHandset.java, MidletSupportHandsetBean.java, MidletSupportHandsetHome.java,
MidletCertificate.java, MidletCertificateBean.java, MidletCertificateHome.java,
BugReport.java, BugReportBean.java, BugReportHome.java,
RequestReport.java, RequestReportBean.java, RequestReportHome.java,
ReviewReport.java, ReviewReportBean.java, ReviewReportHome.java,
MidletPurchasedLog.java, MidletPurchasedLogBean.java, MidletPurchasedLogHome.java,
CreditCard.java, CreditCardBean.java, CreditCardHome.java,
CardPaymentLog.java, CardPaymentLogBean.java, CardPaymentLogHome.java,
Operator.java, OperatorBean.java, OperatorHome.java,
DownloadTraceLog.java, DownloadTraceLogBean.java, DownloadTraceLogHome.java,
DownloadCountLog.java, DownloadCountLogBean.java, DownloadCountLogHome.java,
Wallet.java, WalletBean.java, WalletHome.java,
DownloadInfoLog.java, DownloadInfoLogBean.java, DownloadInfoLogHome.java,
MidletAppidBean.java,MidletAppidHome.java,MidletAppid.java,
MidletDescHome.java,MidletDescBean.java,MidletDesc.java,
MidletApp.java,MidletAppBean.java,MidletAppHome.java,
TestMobileBean.java,TestMobile.java,TestMobileHome.java,
OperatraceLog.java,OperatraceLogBean.java,OperatraceLogHome.java,
MidletVerifyReport.java,MidletVerifyReportHome.java,MidletVerifyReportBean.java,
PromotionMessage.java,PromotionMessageHome.java,PromotionMessageBean.java,
MimeMapping.java,MimeMappingHome.java,MimeMappingBean.java
"/>
</target>
<!-- Make a standard ejb jar file, including XML deployment descriptors -->
<target name="jar_ejb" depends="compile_ejb">
<jar jarfile="${dist}/std_ejb20_WizdomEJB.jar"
basedir="${build}">
</jar>
</target>
<!-- Run ejbc to create the deployable jar file -->
<target name="ejbc" depends="jar_ejb">
<java classname="weblogic.ejbc" fork="yes">
<sysproperty key="weblogic.home" value="${WL_HOME}"/>
<arg line="-compiler javac ${dist}/std_ejb20_WizdomEJB.jar ${APPLICATIONS}/WizdomEJB.jar"/>
<classpath>
<pathelement path="${WL_HOME}/lib/weblogic_sp.jar;${WL_HOME}/lib/weblogic.jar;/apps/maps/jclass/object.jar"
/>
</classpath>
</java>
</target>
<!-- Compile EJB interfaces & client app into the clientclasses directory -->
<target name="compile_client">
<javac srcdir="${source}"
destdir="${CLIENT_CLASSES}"
includes=""/>
</target>
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
二:
<project name="com-wizdom-maps-profile" default="all" basedir=".">
<!-- set global properties for this build -->
<property environment="env"/>
<!-- ?????? -->
<property file="../../maps.properties"/>
<property name="source" value="."/>
<property name="build" value="${source}/build"/>
<property name="dist" value="${source}/dist"/>
<target name="all" depends="clean, init, compile_ejb, jar_ejb, ejbc"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile
and copy the deployment descriptors into it-->
<mkdir dir="${build}"/>
<mkdir dir="${build}/META-INF"/>
<mkdir dir="${dist}"/>
<copy todir="${build}/META-INF">
<fileset dir="${source}">
<include name="*.xml"/>
<exclude name="build.xml"/>
</fileset>
</copy>
</target>
<!-- Compile ejb classes into the build directory (jar preparation) -->
<target name="compile_ejb">
<javac srcdir="${source}" destdir="${build}"
includes="SystemUserProfile.java, SystemUserProfileHome.java, SystemUserProfileBean.java"/>
</target>
<!-- Make a standard ejb jar file, including XML deployment descriptors -->
<target name="jar_ejb" depends="compile_ejb">
<jar jarfile="${dist}/std_ejb20_SystemUserProfile.jar"
basedir="${build}">
</jar>
</target>
<!-- Run ejbc to create the deployable jar file -->
<target name="ejbc" depends="jar_ejb">
<java classname="weblogic.ejbc" fork="yes">
<sysproperty key="weblogic.home" value="${WL_HOME}"/>
<arg line="-compiler javac ${dist}/std_ejb20_SystemUserProfile.jar ${APPLICATIONS}/SystemUserProfile.jar"/>
<classpath>
<pathelement path="${WL_HOME}/lib/weblogic_sp.jar;${WL_HOME}/lib/weblogic.jar"/>
</classpath>
</java>
</target>
<!-- Compile EJB interfaces & client app into the clientclasses directory -->
<!-- <target name="compile_client">
<javac srcdir="${source}"
destdir="${CLIENT_CLASSES}"
includes=""
/>
</target>
-->
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>