Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

too much data exception from javassist #310

Open
johanhaleby opened this issue Jul 24, 2015 · 7 comments
Open

too much data exception from javassist #310

johanhaleby opened this issue Jul 24, 2015 · 7 comments

Comments

@johanhaleby
Copy link
Collaborator

From ssuyam...@gmail.com on November 09, 2010 17:58:16

What steps will reproduce the problem? 1.call mockstatic in test class
2. in the test class unmarshall xml using JAXB. JAXBContext.newInstance call fails with the exception. But initialization works fine with easymock and issues appear with powermock-easymock-junit extension.

java.lang.RuntimeException: javassist.CannotCompileException: by java.io.IOException: too much data
at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:188)
at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:148)
at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:144)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:297)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:383)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:348)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:255)
3. I tried with javassist 3.13 and 3.3 , all ended in same exception. What is the expected output? What do you see instead? expected output is business class which is mocked What version of the product are you using? On what operating system? powermock-easymock-junit-1.4.6.zip Please provide any additional information below.

Original issue: http://code.google.com/p/powermock/issues/detail?id=290

@johanhaleby
Copy link
Collaborator Author

From johan.ha...@gmail.com on November 14, 2010 23:34:06

Issue 291 has been merged into this issue.

@johanhaleby
Copy link
Collaborator Author

From johan.ha...@gmail.com on November 14, 2010 23:34:37

Hm, which class is it that causes the exception?

@johanhaleby
Copy link
Collaborator Author

From ssuyam...@gmail.com on November 15, 2010 07:28:46

Hi,
Please see the log and the test attached. Test will give an idea about what I am trying. In my application I use the XML data as input. Thats why I instantiate JAXB instance in the test class.

Thanks,
Sundar

log4j:ERROR Could not instantiate appender named "stat".
java.lang.RuntimeException: javassist.CannotCompileException: by java.io.IOException: too much data
at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:188)
at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:148)
at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:144)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:297)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:383)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:348)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:255)
at com.lincoln.abob.business.processors.TooMuchDataErrorProof.getTXWrapper(TooMuchDataErrorProof.java:93)
at com.lincoln.abob.business.processors.TooMuchDataErrorProof.testProcessHistoricAccountValues(TooMuchDataErrorProof.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:322)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:309)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:297)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:222)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:161)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:135)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:133)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:112)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:57)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: javassist.CannotCompileException: by java.io.IOException: too much data
at javassist.CtClassType.toBytecode(CtClassType.java:1441)
at javassist.CtClass.toBytecode(CtClass.java:1277)
at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:185)
... 41 more
Caused by: java.io.IOException: too much data
at javassist.ClassPoolTail.copyStream(ClassPoolTail.java:440)
at javassist.ClassPoolTail.writeClassfile(ClassPoolTail.java:290)
at javassist.ClassPool.writeClassfile(ClassPool.java:634)
at javassist.CtClassType.toBytecode(CtClassType.java:1429)
... 43 more

Attachment: TooMuchDataErrorProof.java

@johanhaleby
Copy link
Collaborator Author

From ssuyam...@gmail.com on November 17, 2010 07:08:27

Hi Johan,
Do you have any update or suggestion on this issue?

Thanks,
Sundar

@johanhaleby
Copy link
Collaborator Author

From johan.ha...@gmail.com on December 27, 2010 05:02:21

Unfortunately not :/ Perhaps you can try with the latest version of Javassist?

@johanhaleby
Copy link
Collaborator Author

From philvar...@gmail.com on August 30, 2011 23:16:26

This is a bug with javassist: https://issues.jboss.org/browse/JASSIST-142 It is fixed as of 3.15.0-GA.

If you're using Maven, the dependency now uses the groupID "org.javassist" instead of "javassist" as it did in older versions.

    \<dependency>
        \<groupId>org.javassist</groupId>
        \<artifactId>javassist</artifactId>
        \<version>3.15.0-GA</version>
        \<scope>test</scope>
    \</dependency>

@johanhaleby
Copy link
Collaborator Author

From johan.ha...@gmail.com on August 30, 2011 23:51:53

PowerMock 1.4.10 depends on Javassist 3.15

Status: Accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant