Peter Pilgrim's Weblog

« Herbalife Five Product Program... | Weblog | Architecture Note 3: Define Ap... »

20060201 Wednesday February 01, 2006

Weblogic Deployment Stream Corrupted Exception
The cause, obviously, is that BEA have changed the uploading protocol between WebLogic service packs and/or whole versions in some way.

Dear Reader

Your editor has written a bittersweet short note on WebLogic Deployment. I wish there were better human readable error reports.

Problem

I found that I needed to customise the version of WebLogic including inside a project Ant build file, because of a awful StreamCorruptedException that occurred during deployment. I wasted six hours yester at my client trying to investigate the problem. At first I thought it was the EAR, then the EJB-JAR, then the deployment descriptors. All look endlessly through the code and the descriptors attempting to catch the usual typographical errors. This happened whilst deploying to a WLS 8.1sp1 server using more recent a WLS library WLS 8.1sp3. Then this morning, it dawned on me when I looked at the actuall exception type.
     [echo] calling target deploy with the following attributes :
     [echo] source     : '../build/test-ear/test-foo.ear'
     [echo] targets    : 'admin'
     [echo] application: 'test-foo-DEV'
     [echo] server     : 't3://localhost:7001/'
     [echo] username   : 'river'
     [echo] password   : 'pheonix'
     [echo] targets    : 'admin'
     [java] ==WARNING== upload option is deprecated. Use sourcerootforupload instead
     [java] java.io.StreamCorruptedException
     [java] Unexpected Exception
     [java] Java Result: 1

Cause

The cause, obviously, is that BEA have changed the uploading protocol between WebLogic service packs and/or whole versions in some way. The red herring is the suggestion on the error report to use instead -sourcerootforupload argument, because this argument is only available in WebLogic Server 9 (Diablo).

Solution

The solution to the problem is to use weblogic.Deployer from the weblogic.jar actually stored on the remote server. I downloaded the remote JAR and push it somewhere on my box.

I created or edited an user.properties file add the follow definition

deployment.weblogic.jar = /opt/remoteserver/weblogic/server/lib/weblogic.jar

Modified the ANT build target according like so

    <target name="deploy.test" depends="init, BuildTime" 
    	description="Deploys the Unit Test EAR onto WLS">
        <property name="local.tdeployment.source" value="${foo.build.test-ear.dir}/${foo.test-ear.deploy.name}"/>
        <echo message="calling target deploy with the following attributes : " />
        <echo message="source     : '${local.tdeployment.source}'" />
        <echo message="targets    : '${foo.serverDeploy.targets}'" />
        <echo message="application: '${foo.serverDeploy.test-application}'" />
        <echo message="server     : '${foo.serverDeploy.server}'" />
        <echo message="username   : '${foo.serverDeploy.username}'"/>
	<echo message="password   : '${foo.serverDeploy.password}'"/> 
        <echo message="targets    : '${foo.serverDeploy.targets}'"/>
        <echo message="deployment.weblogic.jar = '${deployment.weblogic.jar}'" />
        <java classname="weblogic.Deployer" fork="true">
            <arg value="-adminurl"/>
            <arg value="${foo.serverDeploy.server}"/>
            <arg value="-user"/>
            <arg value="${foo.serverDeploy.username}"/>
            <arg value="-password"/>
            <arg value="${foo.serverDeploy.password}"/>
            <arg value="-name"/>
            <arg value="${foo.serverDeploy.test-application}"/>
            <arg value="-source"/>
            <arg value="${local.tdeployment.source}"/>
            <arg value="-targets"/>
            <arg value="${foo.serverDeploy.targets}"/>
            <arg value="-upload"/>
            <arg value="-activate"/>
            <classpath>
                <pathelement location="${deployment.weblogic.jar}" />
                <pathelement location="${foo.lib.dir}/xerces.jar"/>
            </classpath>
        </java>
    </target>
Birds-of-Feather XV
Friday, 3rd February 2006

Oracle City of London office

See BEA's own Dev2Dev forums for more information, especially the thread Problem deploying ear file with weblogic.Deployer

Hope this helps. This is Peter Pilgrim, Out


( Feb 01 2006, 03:01:35 PM GMT ) Permalink

Comments:

Comments are closed for this entry.