Tuesday, June 4, 2013

Caused by: java.lang.NoClassDefFoundError: org/apache/xmlbeans/SchemaTypeLoader while trying to export OSB Project from eclipse workspace

Recently I encountered a problem while trying to export OSB project from eclipse workspace.

Even though I set the class path properly, still it was throwing the following error

Caused by: java.lang.NoClassDefFoundError: org/apache/xmlbeans/SchemaTypeLoader.

After a long search in net, I found the following recommendation and it works!

Add the additional property for the java activity
 <sysproperty key="middleware.home" value="${fmw.home}"/>


The complete structure as follows

First create the classpath variable

 <path id="library.osb">
      <fileset dir="${osb.home}/modules">
        <include name="com.bea.common.configfwk_1.6.0.0.jar"/>
        <include name="com.bea.core.xml.xmlbeans_2.2.0.0_2-5-1.jar"/>
      </fileset>
      <fileset dir="${weblogic.home}/server/lib">
        <include name="weblogic.jar"/>
      </fileset>
      <fileset dir="${osb.home}/lib">
        <include name="alsb.jar"/>
      </fileset>
   </path>



<target name="exportFromWorkspace">
          <java dir="${eclipse.home}" classpathref="library.osb"
           jar="${eclipse.home}/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar"
           fork="true" failonerror="true" maxmemory="768m">
         <jvmarg line="-XX:MaxPermSize=256m"/>
        <arg line="-data ${workspace.dir}"/>
        <arg line="-application com.bea.alsb.core.ConfigExport"/>
        <arg line="-configProject ${config.project}"/>
        <arg line="-configJar ${config.jar}"/>
        <arg line="-configSubProjects ${config.subprojects}"/>
        <arg line="-includeDependencies ${config.includeDependencies}"/>
        <sysproperty key="weblogic.home" value="${weblogic.home}"/>
        <sysproperty key="osb.home" value="${osb.home}"/>
        <sysproperty key="osgi.bundlefile.limit" value="500"/>
        <sysproperty key="harvester.home" value="${osb.home}/harvester"/>
        <sysproperty key="osgi.nl" value="en_US"/>
        <sysproperty key="sun.lang.ClassLoader.allowArraySyntax" value="true"/>
      <sysproperty key="middleware.home" value="${fmw.home}"/>
     </java>
   </target>

Even after that if export fails, try to add the section to delete .metadata folder as shown below

<target name="exportFromWorkspace">
      <delete failonerror="false" includeemptydirs="true"
              dir="${metadata.dir}"/>
      <java dir="${eclipse.home}" classpathref="library.osb"
            jar="${eclipse.home}/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar"
            fork="true" failonerror="true" maxmemory="768m">
         <jvmarg line="-XX:MaxPermSize=256m"/>
         <arg line="-data ${workspace.dir}"/>
         <arg line="-application com.bea.alsb.core.ConfigExport"/>
         <arg line="-configProject ${config.project}"/>
         <arg line="-configJar ${config.jar}"/>
         <arg line="-configSubProjects ${config.subprojects}"/>
         <arg line="-includeDependencies ${config.includeDependencies}"/>
         <sysproperty key="weblogic.home" value="${weblogic.home}"/>
         <sysproperty key="osb.home" value="${osb.home}"/>
         <sysproperty key="osgi.bundlefile.limit" value="500"/>
         <sysproperty key="harvester.home" value="${osb.home}/harvester"/>
         <sysproperty key="osgi.nl" value="en_US"/>
         <sysproperty key="sun.lang.ClassLoader.allowArraySyntax" value="true"/>
        <sysproperty key="middleware.home" value="${fmw.home}"/>
      </java>
   </target>



1 comment:

  1. You are absolutely right. I had this problem and with your advice I've been able to solve it.

    Thak you very much.

    ReplyDelete