java.io.NotActiveException: Fields were never written

JBoss Issue Tracker | Rune Steinseth | 3 years ago
  1. 0

    After moving from glassfish (3.1.2 and 4.0) to WildFly, I get the following stacktrace when reading an object (EvoteSAMLCredentials) containing an instance of org.bouncycastle.jce.provider.JCERSAPrivateKey (found in bcprov-jdk14-1.38.jar or bcprov-jdk16-1.46.jar): {noformat} 2014-01-30 11:08:14,639 ERROR [io.undertow.request] (default task-7) UT005023: Exception handling request to /secure/index.xhtml: javax.ejb.EJBException: java.io.EOFException: Read past end of file at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:236) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at $Proxy277.getDIFICredential(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_05] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_05] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_05] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_05] at no.evote.service.cache.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:84) [classes:] at no.evote.service.cache.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:115) [classes:] at $Proxy277.getDIFICredential(Unknown Source) at no.evote.service.security.saml.SAMLAccessFilter.doAuthenticationRedirect(SAMLAccessFilter.java:90) [classes:] at no.evote.service.security.saml.SAMLAccessFilter.doFilter(SAMLAccessFilter.java:69) [classes:] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at no.evote.lifecycle.LifecycleFilter.doFilter(LifecycleFilter.java:50) [classes:] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at no.evote.presentation.util.filters.IEModeFilter.doFilter(IEModeFilter.java:45) [classes:] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at no.evote.presentation.util.filters.ForceLocaleFilter.doFilter(ForceLocaleFilter.java:56) [classes:] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_05] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_05] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_05] Caused by: java.io.EOFException: Read past end of file at org.jboss.marshalling.SimpleDataInput.eofOnRead(SimpleDataInput.java:155) at org.jboss.marshalling.SimpleDataInput.readUnsignedByteDirect(SimpleDataInput.java:298) at org.jboss.marshalling.SimpleDataInput.readIntDirect(SimpleDataInput.java:347) at org.jboss.marshalling.SimpleDataInput.readInt(SimpleDataInput.java:320) at org.jboss.marshalling.river.RiverObjectInputStream.readFields(RiverObjectInputStream.java:120) at java.math.BigInteger.readObject(BigInteger.java:3096) [rt.jar:1.7.0_05] at sun.reflect.GeneratedMethodAccessor458.invoke(Unknown Source) [:1.7.0_05] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_05] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_05] at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:311) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1612) at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1273) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:153) at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:139) at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:57) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:363) [rt.jar:1.7.0_05] at org.bouncycastle.jce.provider.JCERSAPrivateKey.readObject(Unknown Source) [bcprov-jdk14-1.38.jar:1.38.0] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_05] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_05] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_05] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_05] at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:311) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1612) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1273) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213) at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1715) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1631) at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1273) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213) at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:45) at org.jboss.ejb.client.remoting.MethodInvocationResponseHandler$MethodInvocationResultProducer.getResult(MethodInvocationResponseHandler.java:103) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:272) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBObjectInterceptor.handleInvocationResult(EJBObjectInterceptor.java:64) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:274) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBHomeInterceptor.handleInvocationResult(EJBHomeInterceptor.java:88) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:274) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:46) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:274) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.ReceiverInterceptor.handleInvocationResult(ReceiverInterceptor.java:129) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:262) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:437) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:202) [jboss-ejb-client-2.0.0.Beta5.jar:2.0.0.Beta5] ... 48 more Caused by: an exception which occurred: in field signum in object of type java.math.BigInteger in object of type org.bouncycastle.jce.provider.JCERSAPrivateCrtKey in field privateKey in object of type no.evote.util.EvoteSAMLCredentials {noformat} I have tried to reproduce this in a unit test by adding {code} public static class MyKey extends JCERSAPrivateKey { public MyKey() { this.modulus = BigInteger.ONE; this.privateExponent = BigInteger.TEN; } } @Test public void testMyKey() throws Throwable { final Serializable serializable = new MyKey(); runReadWriteTest(new ReadWriteTest() { public void runWrite(final Marshaller marshaller) throws Throwable { marshaller.writeObject(serializable); } public void runRead(final Unmarshaller unmarshaller) throws Throwable { assertEquals(serializable, unmarshaller.readObject()); assertEOF(unmarshaller); } }); } {code} to org.jboss.test.marshalling.SimpleMarshallerTests with the following output: {noformat} Read Configuration = org.jboss.marshalling.MarshallingConfiguration@7da5b607: instanceCount=256 classCount=64 bufferSize=512 version=3 Marshaller = org.jboss.marshalling.river.RiverMarshaller@71aeef97 (version set to 3) java.io.NotActiveException: Fields were never written at org.jboss.marshalling.river.RiverObjectOutputStream.finish(RiverObjectOutputStream.java:175) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1012) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1001) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:888) at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62) at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:115) at org.jboss.test.marshalling.SimpleMarshallerTests$5.runWrite(SimpleMarshallerTests.java:248) at org.jboss.test.marshalling.TestBase.runReadWriteTest(TestBase.java:109) at org.jboss.test.marshalling.SimpleMarshallerTests.testMyKey(SimpleMarshallerTests.java:246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:643) at org.testng.internal.Invoker.invokeMethod(Invoker.java:559) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:723) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1027) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121) at org.testng.TestRunner.runWorkers(TestRunner.java:1030) at org.testng.TestRunner.privateRun(TestRunner.java:709) at org.testng.TestRunner.run(TestRunner.java:579) at org.testng.SuiteRunner.runTest(SuiteRunner.java:331) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:326) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:288) at org.testng.SuiteRunner.run(SuiteRunner.java:193) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:910) at org.testng.TestNG.runSuitesLocally(TestNG.java:879) at org.testng.TestNG.run(TestNG.java:787) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:120) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: an exception which occurred: in object org.jboss.test.marshalling.SimpleMarshallerTests$MyKey@b {noformat} The sourcecode for EvoteSAMLCredentials is available here: https://sourcecode.valg.no/websvn/filedetails.php?repname=Admin&path=%2Fadmin-common%2Fsrc%2Fmain%2Fjava%2Fno%2Fevote%2Futil%2FEvoteSAMLCredentials.java

    JBoss Issue Tracker | 3 years ago | Rune Steinseth
    java.io.NotActiveException: Fields were never written
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Can't serialize org.dom4j.Document using JBoss Marshalling API

    Stack Overflow | 2 years ago | Ahmed MANSOUR
    java.io.NotActiveException: writeFields() may only be called when the fields have not yet been written
  4. 0

    A question regarding defaultXxxObject()

    Coderanch | 6 years ago | Mr.Gaurav Saxena
    java.io.NotActiveException: not in call to writeObject

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.NotActiveException

      Fields were never written

      at org.jboss.marshalling.river.RiverObjectOutputStream.finish()
    2. JBoss Marshalling River
      RiverMarshaller.doWriteObject
      1. org.jboss.marshalling.river.RiverObjectOutputStream.finish(RiverObjectOutputStream.java:175)
      2. org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1012)
      3. org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1001)
      4. org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:888)
      4 frames
    3. JBoss Marshalling API
      AbstractMarshaller.writeObject
      1. org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
      2. org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:115)
      2 frames
    4. org.jboss.test
      SimpleMarshallerTests.testMyKey
      1. org.jboss.test.marshalling.SimpleMarshallerTests$5.runWrite(SimpleMarshallerTests.java:248)
      2. org.jboss.test.marshalling.TestBase.runReadWriteTest(TestBase.java:109)
      3. org.jboss.test.marshalling.SimpleMarshallerTests.testMyKey(SimpleMarshallerTests.java:246)
      3 frames
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:601)
      4 frames
    6. TestNG
      RemoteTestNGStarter.main
      1. org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:643)
      2. org.testng.internal.Invoker.invokeMethod(Invoker.java:559)
      3. org.testng.internal.Invoker.invokeTestMethod(Invoker.java:723)
      4. org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1027)
      5. org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
      6. org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
      7. org.testng.TestRunner.runWorkers(TestRunner.java:1030)
      8. org.testng.TestRunner.privateRun(TestRunner.java:709)
      9. org.testng.TestRunner.run(TestRunner.java:579)
      10. org.testng.SuiteRunner.runTest(SuiteRunner.java:331)
      11. org.testng.SuiteRunner.runSequentially(SuiteRunner.java:326)
      12. org.testng.SuiteRunner.privateRun(SuiteRunner.java:288)
      13. org.testng.SuiteRunner.run(SuiteRunner.java:193)
      14. org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:910)
      15. org.testng.TestNG.runSuitesLocally(TestNG.java:879)
      16. org.testng.TestNG.run(TestNG.java:787)
      17. org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75)
      18. org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:120)
      18 frames
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:601)
      4 frames
    8. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      1 frame