Idea debug mode hanging

Hi all:

I'm trying to run my java spring app in debug mode. However, my application sometimes hang at the "getDeclaredConstructors0" in debug mode. Note that there is no problem when running in non-debug mode. Thread dump is below:

This happens for both jdk 1.5 and 1.6, and intelliJ 9.X and 8.X.

main@1, prio=5, in group 'main', status: 'runnable'

  java.lang.Thread.State: RUNNABLE

              at java.lang.Class.getDeclaredConstructors0(Class.java:-1)

              at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)

              at java.lang.Class.getConstructor0(Class.java:2640)

              at java.lang.Class.getDeclaredConstructor(Class.java:1953)

              at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

              at java.security.AccessController.doPrivileged(AccessController.java:-1)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)

              at org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:91)

              at org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:102)

              at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)

              at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:86)

              at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:64)

              at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:53)

              at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69)

              at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:106)

              at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:97)

              at org.apache.cxf.endpoint.AbstractEndpointFactory.getBus(AbstractEndpointFactory.java:73)

              at org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean.setApplicationContext(JAXRSServerFactoryBeanDefinitionParser.java:162)

              at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:70)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1330)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

              at java.security.AccessController.doPrivileged(AccessController.java:-1)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)

              at org.springframework.test.AbstractSingleSpringContextTests.createApplicationContext(AbstractSingleSpringContextTests.java:213)

              at org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:189)

              at org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:169)

              at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:140)

              at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:98)

              at junit.framework.TestCase.runBare(TestCase.java:132)

              at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)

              at junit.framework.TestResult$1.protect(TestResult.java:110)

              at junit.framework.TestResult.runProtected(TestResult.java:128)

              at junit.framework.TestResult.run(TestResult.java:113)

              at junit.framework.TestCase.run(TestCase.java:124)

              at junit.textui.TestRunner.doRun(TestRunner.java:116)

              at com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:108)

              at junit.textui.TestRunner.doRun(TestRunner.java:109)

              at com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:42)

              at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)

              at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)

Any help would be greatly appreciated.

1 comment

This is an ancient thread, but incase it shows up for anyone else in a search I've also run into similar issues on intellij15, adding the flag  -Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true seems to fix it.
We had tests working in Eclipse (normal and debug), and IDEA15 but only in non-debug modes. We could run tests from commandline with debug flags, but if we attatched intellij as a remote debugger it would hang.
We hooked up jdb to the test to debug and saw a stack trace along the lines of:
java.lang.IllegalArgumentException: Invalid JNI signature character ';'

     at com.sun.tools.jdi.JNITypeParser.nextTypeName(JNITypeParser.java:218)
     at com.sun.tools.jdi.JNITypeParser.typeNameList(JNITypeParser.java:122)
     at com.sun.tools.jdi.JNITypeParser.typeName(JNITypeParser.java:67)
     at com.sun.tools.jdi.TypeImpl.name(TypeImpl.java:26)
     at com.sun.tools.jdi.ReferenceTypeImpl.compareTo(ReferenceTypeImpl.java:132)
     at com.sun.tools.jdi.ReferenceTypeImpl.compareTo(ReferenceTypeImpl.java:15)
     at java.util.TreeMap.put(TreeMap.java:545)
     at java.util.TreeSet.add(TreeSet.java:238)
     at com.sun.tools.jdi.VirtualMachineImpl.addReferenceType(VirtualMachineImpl.java:764)
     at com.sun.tools.jdi.VirtualMachineImpl.referenceType(VirtualMachineImpl.java:880)
     at com.sun.tools.jdi.EventSetImpl$ClassPrepareEventImpl.<init>(EventSetImpl.java:351)
     at com.sun.tools.jdi.EventSetImpl.createEvent(EventSetImpl.java:698)
     at com.sun.tools.jdi.EventSetImpl.build(EventSetImpl.java:610)
     at com.sun.tools.jdi.EventQueueImpl.removeUnfiltered(EventQueueImpl.java:193)
     at com.sun.tools.jdi.EventQueueImpl.remove(EventQueueImpl.java:78)
     at com.sun.tools.jdi.EventQueueImpl.remove(EventQueueImpl.java:64)

which lead us to this old sun bug report that has been archived https://web.archive.org/web/20090822231531/http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6547438 which suggested the flag. and it seems to work for us

0

Please sign in to leave a comment.