Posts Tagged ‘sun.lang.ClassLoader.allowArraySyntax’
java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser / java.io.StreamCorruptedException: invalid type code: 31
Case
Following an upgrade from Java 5 “Tiger” to Java 6 “Mustang”, I tried to deploy a WAR with Maven-WebLogic plugin. I got this error:
weblogic.deploy.api.tools.deployer.DeployerException: Unable to connect to 't3://localhost:7001': invalid type code: 31. Ensure the url represents a running admin server and that the credentials are correct. If using http protocol, tunneling must be enabled on the admin server. (...) Caused by: javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException (...) Caused by: weblogic.deploy.api.spi.exceptions.ServerConnectionException (...) Caused by: javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is: java.io.StreamCorruptedException: invalid type code: 31] (...) Caused by: java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is: java.io.StreamCorruptedException: invalid type code: 31 (...) Caused by: java.io.StreamCorruptedException: invalid type code: 31
Complete Stacktrace
weblogic.deploy.api.tools.deployer.DeployerException: Unable to connect to 't3://localhost:7001': invalid type code: 31. Ensure the url represents a running admin server and that the credentials are correct. If using http protocol, tunneling must be enabled on the admin server. at weblogic.deploy.api.tools.deployer.Jsr88Operation.connect(Jsr88Operation.java:314) at weblogic.deploy.api.tools.deployer.Deployer.perform(Deployer.java:137) at weblogic.deploy.api.tools.deployer.Deployer.runBody(Deployer.java:88) at weblogic.utils.compiler.Tool.run(Tool.java:158) at weblogic.utils.compiler.Tool.run(Tool.java:115) at weblogic.Deployer.run(Deployer.java:70) at org.codehaus.mojo.weblogic.DeployMojoBase.executeDeployer(DeployMojoBase.java:510) at org.codehaus.mojo.weblogic.DeployMojo.execute(DeployMojo.java:49) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:454) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:345) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:132) at org.apache.maven.cli.MavenCli.main(MavenCli.java:290) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.<init>(WebLogicDeploymentManagerImpl.java:121) at weblogic.deploy.api.spi.factories.internal.DeploymentFactoryImpl.getDeploymentManager(DeploymentFactoryImpl.java:84) at weblogic.deploy.api.tools.SessionHelper.getRemoteDeploymentManager(SessionHelper.java:482) at weblogic.deploy.api.tools.deployer.Jsr88Operation.connect(Jsr88Operation.java:295) ... 25 more Caused by: weblogic.deploy.api.spi.exceptions.ServerConnectionException at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(ServerConnectionImpl.java:143) at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.getNewConnection(WebLogicDeploymentManagerImpl.java:148) at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.<init>(WebLogicDeploymentManagerImpl.java:118) ... 28 more Caused by: javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is: java.io.StreamCorruptedException: invalid type code: 31] at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:85) at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:41) at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:765) at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:665) at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:465) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:372) at weblogic.jndi.Environment.getContext(Environment.java:307) at weblogic.jndi.Environment.getContext(Environment.java:277) at weblogic.jndi.Environment.createInitialContext(Environment.java:200) at weblogic.jndi.Environment.getInitialContext(Environment.java:184) at weblogic.jndi.Environment.getInitialContext(Environment.java:162) at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getContext(ServerConnectionImpl.java:330) at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getEnvironment(ServerConnectionImpl.java:302) at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(ServerConnectionImpl.java:141) ... 30 more Caused by: java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is: java.io.StreamCorruptedException: invalid type code: 31 at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:219) at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224) at weblogic.common.internal.RMIBootServiceImpl_922_WLStub.authenticate(Unknown Source) at weblogic.security.acl.internal.Security$1.run(Security.java:185) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147) at weblogic.security.acl.internal.Security.authenticate(Security.java:181) at weblogic.jndi.WLInitialContextFactoryDelegate.authenticateRemotely(WLInitialContextFactoryDelegate.java:726) at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:659) ... 40 more Caused by: java.io.StreamCorruptedException: invalid type code: 31 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195) at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:191) at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62) at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:217) ... 48 more
Fix
Edit your pom.xml
, and add the two following properties:
<com.sun.xml.namespace.QName.useCompatibleSerialVersionUID>1.0</com.sun.xml.namespace.QName.useCompatibleSerialVersionUID> <sun.lang.ClassLoader.allowArraySyntax>1.5</sun.lang.ClassLoader.allowArraySyntax>
If needed, and if your current pom is only intented at package and deploying a WAR, you can also downgrade the Java compilation version, adding the block:
<maven.compiler.target>1.5</maven.compiler.target> <maven.compiler.source>1.5</maven.compiler.source>
You can also append those properties on the head of environment variable MAVEN_OPTS
.