2013-10-08 51 views
3

我有以下問題:我有一個bean(名爲ImageStorageService),我想用下面的代碼問題實例豆 - 校驗錯誤

WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(httpSession 
      .getServletContext()); 
IImageStorageService dataService = (IImageStorageService) context 
      .getBean("ImageStorageService"); 

明顯bean類工具,以實例化一個servlet這個bean IImageStorageService。

的問題是,這些行執行時,下面的錯誤被扔:

java.lang.VerifyError: (class: myproject/myclass/ImageStorageService, method: writePdfFile signature: (Ljava/lang/String;Ljava/lang/String;Lmyproject/myobjects/IObject;)Ljava/io/File;) Call to wrong initialization method 

有誰知道這是什麼問題?非常感謝

編輯

bean聲明

<bean id="ImageStorageService" scope="session" 
    destroy-method="clean" 
    class="myproject.myclass.ImageStorageService"> 
    <property name="objectService" ref="SuperUserObjectService" /> 
    <property name="dataDictionaryService" ref="DataDictionaryService" /> 
    <property name="runQueryService" ref="RunQueryService" /> 
    <property name="status" ref="ImagesUploadStatus" /> 
</bean> 

[...] 
package myproject.myclass; 
[...] 
public class ImageStorageService implements IImageStorageService { 
private IRunQueryService runQueryService; 
private IObjectService        objectService; 
private IDataDictionaryService      dataDictionaryService; 
private ImagesUploadStatus       status; 

[...] 
public File writePdfFile(String idPlico, String userId) throws Exception { 
    return writePdfFile(idPlico, userId, false, 0, 0, 0.0, null); 
} 

@Override 
public File writePdfFile(String idFascicolo, String userId, boolean discardBlankPages, int verticalOffset, 
     int horizontalOffset, double threshold, IObject fileInfo) throws Exception { 
    File pdfFile; 
    [...] 
    //pdfFile Elaboration 
    [...] 
    return pdfFile; 
    } 
    [...] 
} 

完整的堆棧跟蹤

java.lang.VerifyError: (class: myproject/myclass/ImageStorageService, method: writePdfFile signature: (Ljava/lang/String;Ljava/lang/String;Lmyproject/myobjects/IObject;)Ljava/io/File;) Call to wrong initialization method 
at java.lang.Class.getDeclaredConstructors0(Native Method) 
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) 
at java.lang.Class.getConstructor0(Class.java:2699) 
at java.lang.Class.getDeclaredConstructor(Class.java:1985) 
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:67) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:332) 
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43) 
at org.springframework.web.context.request.SessionScope.get(SessionScope.java:92) 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328) 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) 
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) 
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$2.getObject(AbstractBeanFactory.java:332) 
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43) 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328) 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093) 
at myproject.myfilters.myFilter.doFilter(myFilter.java:76) 
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) 
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) 
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) 
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715) 
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681) 
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) 
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) 
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277) 
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183) 
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454) 
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) 
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178) 
+0

你能向我們展示bean聲明和實現類嗎? –

+0

好的,我將編輯 –

+0

請發佈完整的堆棧跟蹤。 –

回答

1

顯然不是一個長期的解決方案,但你可以很旁路通過將-noverify添加到您的命令行來一起驗證所有類。你也可能想嘗試做一個乾淨的構建。