2016-01-25 34 views
1

我遇到了讓CDI與JAX-WS Web服務實現一起工作的問題。然而,在試圖調試這個問題時,我發現日誌中有一個例外,我無法理解。日誌,異常是(5日線下來開始「[警告]」:。在不使用Spring時發生Spring異常

Launching defaultServer (WebSphere Application Server 8.5.5.6/wlp-1.0.9.cl50620150610-1749) on Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_79-b15 (en_US) 
[AUDIT ] CWWKE0001I: The server defaultServer has been launched. 
[AUDIT ] CWWKE0100I: This product is licensed for development, and limited production use. The full license terms can be viewed here: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/base_ilan/ilan/8.5.5.6/lafiles/en.html 
[AUDIT ] CWWKZ0058I: Monitoring dropins for applications. 
[WARNING ] CWNEN0047W: Resource annotations on the fields of the path.not.important.external.service.eNC3BusinessWebServiceImpl class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware 
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9090/eNC3BusinessWebService/ 
[AUDIT ] CWWKZ0001I: Application eNC3BusinessWebService_EAR started in 2.841 seconds. 
[AUDIT ] CWWKF0012I: The server installed the following features: [jaxws-2.2, cdi-1.2, servlet-3.1, jndi-1.0, javaMail-1.5, jaxb-2.2]. 
[AUDIT ] CWWKF0011I: The server defaultServer is ready to run a smarter planet. 

我很困惑,爲什麼任何彈簧類會被加載,我不使用彈簧在所有這是一個。純Java 7的實施JAX-WS Web服務的下面是我的實現類:

package path.not.important.external.service; 

import java.util.List; 

import javax.inject.Inject; 
import javax.jws.WebMethod; 
import javax.jws.WebService; 
import javax.xml.soap.SOAPException; 

import org.apache.commons.collections4.CollectionUtils; 
import org.apache.logging.log4j.LogManager; 
import org.apache.logging.log4j.Logger; 

import path.not.important.external.domain.DemographicBean; 
import path.not.important.external.domain.ErrorInfo; 
import path.not.important.external.domain.SubmissionValidationResults; 
import path.not.important.internal.client.FileSubmissionServiceHandler; 
import path.not.important.rules.submission.BRSubmissionService; 
import path.not.important.internal.SubmissionFormData; 
import path.not.important.plugin.IResult; 
import path.not.important.plugin.SubmissionResult; 

@WebService(serviceName="eNC3BusinessWebService") 
public class eNC3BusinessWebServiceImpl 
{ 

    @WebMethod 
    public SubmissionValidationResults xmlValidation(String xml, String submissionType, String schemaVersion) 
      throws SOAPException 
    { 
     logger.info("--- Validating Incomming Form XML ---"); 

     logger.info("Received Payload: XML [" + xml + "]"); 
     logger.info("SubmissionType [" + submissionType + "]"); 
     logger.info("SchemaVersion [" + schemaVersion + "]"); 

     return results; 
    } 

    @WebMethod 
    public SubmissionValidationResults flatFileValidation(String filename, byte[] file) throws SOAPException 
    { 
     logger.info("--- Converting and Validating Incomming Form Flat File ---"); 

     logger.info("Validating flat file: " + filename); 
     logger.info("file size: " + file.length); 
     logger.info("file: " + file.toString()); 

     return results; 
    } 

    @WebMethod 
    public String finalNC3FormSubmission(DemographicBean demographicData, List<SubmissionFormData> nc3, 
      List<SubmissionFormData> irsW2, List<SubmissionFormData> irs1099) throws SOAPException 
    { 
     logger.info("Executing final submission of website form data..."); 

     return messageID; 
    } 

    @Inject 
    private FileSubmissionServiceHandler fileSubmissionServiceHandler; 

    @Inject 
    private BRSubmissionService brSubmissionService; 

    public static final Logger logger = LogManager.getLogger(eNC3BusinessWebServiceImpl.class); 
} 

我不知道如果我的CDI的問題,這個問題是相關的,但我試圖消除的任何其他原因問題:我的CDI問題記錄在這裏: JAX-WS and CDI not working together on WAS Liberty Profile 8.5.5.6

回答

0

好的,我終於隔離了問題的原因。這也回答了我的其他問題。

CDI正在加載名爲BRSubmissionService的對象。春季例外,CDI加載正在中斷。由於CDI無法完成,剩餘的CDI注入不會發生,並且我的FileSubmissionService對象未加載,從而導致我的空指針異常。

解決方案是修復位於另一個jar中的BRSubmissionService對象內部的彈簧錯誤,不幸的是我從其他開發者繼承了該錯誤。這就是生活。

相關問題