Java 不使用Spring时获取Spring异常

Java 不使用Spring时获取Spring异常,java,spring,web-services,Java,Spring,Web Services,在让CDI与JAX-WSWeb服务实现一起工作时,我遇到了一个问题。然而,在尝试调试这个问题时,我在日志中看到一个异常,我很难理解它。日志,异常为(第5行,以“[WARNING]”开头): 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_

在让CDI与JAX-WSWeb服务实现一起工作时,我遇到了一个问题。然而,在尝试调试这个问题时,我在日志中看到一个异常,我很难理解它。日志,异常为(第5行,以“[WARNING]”开头):

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.
我不明白为什么会加载任何spring类。我根本没有使用spring。这是JAX-WS Web服务的纯Java 7实现。以下是我的实现类:

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);
}
package path.not.important.external.service;
导入java.util.List;
导入javax.inject.inject;
导入javax.jws.WebMethod;
导入javax.jws.WebService;
导入javax.xml.soap.SOAPException;
导入org.apache.commons.collections4.CollectionUtils;
导入org.apache.logging.log4j.LogManager;
导入org.apache.logging.log4j.Logger;
导入path.not.important.external.domain.DemographicBean;
导入path.not.important.external.domain.ErrorInfo;
导入path.not.important.external.domain.SubmissionValidationResults;
导入path.not.important.internal.client.FileSubmissionServiceHandler;
导入path.not.important.rules.submission.BRSubmissionService;
导入path.not.important.internal.SubmissionFormData;
导入path.not.important.plugin.IResult;
导入path.not.important.plugin.SubmissionResult;
@WebService(serviceName=“eNC3BusinessWebService”)
公共类eNC3BusinessWebServiceImpl
{
@网络方法
公共SubmissionValidationResults xmlValidation(字符串xml、字符串submissionType、字符串schemaVersion)
抛出SOAPException
{
logger.info(“---正在验证输入表单XML---”;
info(“收到的有效负载:XML[“+XML+”]”);
logger.info(“SubmissionType[“+SubmissionType+”]);
info(“SchemaVersion[“+SchemaVersion+”]);
返回结果;
}
@网络方法
public SubmissionValidationResults flatFileValidation(字符串文件名,字节[]文件)引发SOAPException
{
logger.info(“---转换和验证输入表单平面文件---”;
info(“验证平面文件:”+文件名);
logger.info(“文件大小:”+文件长度);
logger.info(“文件:“+file.toString());
返回结果;
}
@网络方法
公共字符串finalNC3FormSubmission(DemographicBean demographicData,列表nc3,
列表irsW2,列表irs1099)引发SOAPException
{
logger.info(“执行网站表单数据的最终提交…”);
返回messageID;
}
@注入
私有FileSubmissionServiceHandler FileSubmissionServiceHandler;
@注入
私人BRSubmissionService BRSubmissionService;
公共静态最终记录器Logger=LogManager.getLogger(eNC3BusinessWebServiceImpl.class);
}
我不知道我的CDI问题与此问题是否相关,但我正在努力消除问题的任何其他原因。我的CDI问题记录在此处:

好的,我终于找到了问题的原因。这也回答了我的另一个问题

CDI正在加载名为BRSubmissionService的对象。CDI加载被spring异常中断。由于CDI无法完成,剩余的CDI注入不会发生,并且我的FileSubmissionService对象未加载,导致我的空指针异常


解决方案是修复BRSubmissionService对象中的spring错误,该对象位于另一个jar中,不幸的是我从另一个开发人员那里继承了它。这就是生活。

好的,我终于找到了问题的原因。这也回答了我的另一个问题

CDI正在加载名为BRSubmissionService的对象。CDI加载被spring异常中断。由于CDI无法完成,剩余的CDI注入不会发生,并且我的FileSubmissionService对象未加载,导致我的空指针异常

解决方案是修复BRSubmissionService对象中的spring错误,该对象位于另一个jar中,不幸的是,我从另一个开发人员那里继承了它