2012-11-02 4 views
0

Eclipse에서 Spring 애플리케이션을 디버깅 할 때 긴 예외 체인이 발생합니다. 예를 들어, 내가 가진봄에 숨겨진 중첩 예외 추적을 보는 법?

 
Error creating bean with name '...' defined in file [...Tester.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property '...' threw exception; nested exception is java.lang.IllegalArgumentException: ... 

등등. 흥미롭지 않은 Spring 내부의 예외를 가진 다중 스택. 그것은 아래 어딘가에서 나의 예외적이어야하지만, 봄은 그들을 보여주지 않습니다.

예외로 클릭하여 문제가있는 곳으로 이동할 수는 없습니다.

How to say 모든 예외를 출력하는 스프링?

UPDATE 아래

전체 출력됩니다. IllegalArgumentException이 발생한 곳이 잘 렸을 수 있습니다. 잠재적으로 여러 예외가 있기 때문에

 
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mybean' defined in file [D:\mypath\myconfig.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'myproperty' threw exception; nested exception is java.lang.IllegalArgumentException: my exception message 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) 
    at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140) 
    at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84) 
    at springtests.SpringRunner.main(SpringRunner.java:8) 
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'target.partner' threw exception; nested exception is java.lang.IllegalArgumentException: Illegal frame length 1 in explicit constructor 
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102) 
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358) 
    ... 13 more 
+0

예외가 잘리지 않습니다. 그것이 중첩 예외가있을 때 얻을 수있는 것입니다. – artbristol

+0

예, 중첩 예외입니다. 그들 모두를 표시하는 방법은 무엇입니까? – Dims

+0

*이 모두 표시됩니다. 스택 추적을 읽는 것은 혼란 스러울 수 있습니다. http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html#printStackTrace%28%29 – artbristol

답변

1

, 당신은 PropertyBatchUpdateException을 잡아 특별한 예외의 스택 추적을 검토 getPropertyAccessExceptions()를 호출해야합니다.

public void printStackTrace(PrintWriter pw) { 
     synchronized (pw) { 
      pw.println(getClass().getName() + "; nested PropertyAccessException details (" + 
        getExceptionCount() + ") are:"); 
      for (int i = 0; i < this.propertyAccessExceptions.length; i++) { 
       pw.println("PropertyAccessException " + (i + 1) + ":"); 
       this.propertyAccessExceptions[i].printStackTrace(pw); 
      } 
     } 
    } 

것은 그것은 중첩 된 스택 추적을 포함한다 :

편집

는 사실은 내가 여기

PropertyBatchUpdateExceptionprintStackTrace 방법입니다 여기에 무슨 일이 일어나고 있는지 확실히 모르겠어요. 최신 버전의 Spring을 사용하고 있습니까?

편집 :

내가 제안 할 수있는 최선은 다음 AbstractAutowireCapableBeanFactory.java:1361에 중단 점을 넣고 무슨 일이 일어나고 있는지보고, 디버그 모드에서 실행하는 것입니다

.

+0

일부 봄 구성이있어 모든 구성 요소를 표시 할 수 있습니까? – Dims

+0

Spring의 로깅 설정을 DEBUG로 설정 했습니까? – artbristol

+0

잘 모르겠습니다. 나는 classpath에'log4j.rootLogger = DEBUG, A1'을 가지고 자신의'log4.properties' 파일을 가지고 있습니다. – Dims

관련 문제