AbstractTransactionalJUnit4SpringContextTests
I am using AbstractTransactionalJUnit4SpringContextTests
as super class for my test classes.
but "mvn test" runs out of memory.
Here is a snippet my BaseTest class :
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations=
{"classpath:**/applicationContext.xml",
"classpath:**/simple-test-datasource.xml"})
@TransactionConfiguration(
transactionManager="myService.transactionManager",defaultRollback=true)
public class ServiceBaseTest extends AbstractTransactionalJUnit4SpringContextTests{
----
}
Am i missing something like @Before
@After
or @BeforeClass
@AfterClass
that is making these tests really heavy, and hence I am running out of memory?
Please help!
Thanks!
Here is the stack trace:
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at com.apple.crypto.provider.Apple.doSelfVerification(Apple.java:271)
at com.apple.c开发者_如何转开发rypto.provider.Apple.verifySelfIntegrity(Apple.java:192)
at com.apple.crypto.provider.HmacCore.<init>(HmacCore.java:45)
at com.apple.crypto.provider.HmacSHA1.<init>(HmacSHA1.java:30)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at java.security.Provider$Service.newInstance(Provider.java:1221)
at javax.crypto.Mac.a(DashoA13*..)
at javax.crypto.Mac.init(DashoA13*..)
at org.springframework.security.oauth.common.signature.HMAC_SHA1SignatureMethod.verify(HMAC_SHA1SignatureMethod.java:122)
at org.springframework.security.oauth.provider.OAuthProviderProcessingFilter.validateSignature(OAuthProviderProcessingFilter.java:261)
at org.springframework.security.oauth.provider.OAuthProviderProcessingFilter.doFilter(OAuthProviderProcessingFilter.java:146)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.oauth.provider.OAuthProviderProcessingFilter.doFilter(OAuthProviderProcessingFilter.java:193)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
You appear to be loading the entire Spring application context into memory via the ContextConfiguration annotation. This could use up a lot of memory, depending on what beans you have defined.
Try increasing the memory available to the JVM by setting M2_OPTS=-Xmx256m
in your environment.
The stack trace is about the perm gen memory and not the heap. So please try to increase the per gen memory e.g -XX:MaxPermSize=1024M
精彩评论