简体   繁体   English

在SpringBoot CXF应用程序中使用@WebParam的WebLogic部署异常

[英]WebLogic deploy exception using @WebParam in SpringBoot CXF application

I am developing an application with SpringBoot 1.4.1 as the main framework. 我正在开发一个以SpringBoot 1.4.1为主要框架的应用程序。 The app is a Maven Dynamic Web Project that exposes some web services and connects to various databases. 该应用程序是一个Maven动态Web项目,它公开了一些Web服务并连接到各种数据库。 It holds both servers and clients to connect with some other programs like Microsoft Dynamics or AutoCad. 它同时容纳服务器和客户端,以与其他一些程序(例如Microsoft Dynamics或AutoCad)连接。

It works as a "walkway" between some applications and some databases. 它充当某些应用程序和某些数据库之间的“走道”。

Web services are developed with CXF 3.1.8 and database access is done with Spring JPA for CRUD methods and MyBatis for complex queries. Web服务使用CXF 3.1.8开发,Spring JPA用于CRUD方法访问数据库,而MyBatis用于复杂查询。

Everything is configured through java clases and java beans (no xml config files used). 一切都通过java clases和java bean配置(不使用xml配置文件)。

The app works fine both in spring boot embedded Tomcat (deploying it as spring boot app) and in WebLogic 12c server (deployed as a maven-build war). 该应用程序在Spring Boot嵌入式Tomcat(部署为Spring Boot应用程序)和WebLogic 12c服务器(部署为Maven-Build War)中均能正常工作。

But I have a strange behaviour with some of the web services methods. 但是我对某些Web服务方法有一个奇怪的行为。 Specifically all methods work fine except for delete methods. 具体来说,除删除方法外,所有方法都可以正常工作。

Here's a little part of the code. 这是代码的一小部分。

I have a java parent class that implements methods that will be shared by web services. 我有一个Java父类,该类实现了将由Web服务共享的方法。 Then I have 2 or more java classes that extend this parent class and call super.method(). 然后,我有2个或更多扩展该父类并调用super.method()的Java类。

Here the parent class: 这里是父类:

@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class)
public class FooService extends ServiceConfigurator {

    @Autowired
    protected FooRepository fooRepository;
    @Autowired
    protected FooMapper fooMapper;
    @Autowired
    protected FooFacade fooFacade;

    public ServiceResult persistFoo(final Foo foo) {
        this.getServiceResult();
        try {
            Foo result = this.fooFacade.persistFoo(foo, this.serviceResult);
            if (CollectionUtils.isEmpty(this.serviceResult.getErrors())) {
                result = this.fooMapper.findOne(result.getId());
                this.serviceResult.getResults().add(result);
                this.serviceResult.setSuccess(true);
            }
        } catch (final Exception e) {
            logger.error("ERROR", e);
            this.serviceResult.getErrors().addAll(Utils.addErrors(e));
            e.printStackTrace();
        }
        return this.serviceResult;
    }

    public ServiceResult deleteFoo(final Foo foo) {
        this.getServiceResult();
        try {
            final Helper helper = this.fooMapper.findById(helper.getId());
            final Foo existing = this.fooMapper.find(helper.getId(),     foo.getNumber(), foo.getVersion());
            this.fooFacade.deleteFoo(existing, this.serviceResult);
            if (CollectionUtils.isEmpty(this.serviceResult.getErrors())) {
                this.serviceResult.setSuccess(true);
            }
        } catch (final Exception e) {
            logger.error("ERROR", e);
            this.serviceResult.getErrors().addAll(Utils.addErrors(e));
            e.printStackTrace();
        }
        return this.serviceResult;
    }
}

And here one of the child classes: 这里是子类之一:

@Service("fooImpService ")
@WebService(serviceName = "FooImpService ")
public class FooImpService extends FooService {

    public ServiceResult createFoo(@WebParam(name = "foo") final Foo foo) {
        return super.persistFoo(foo);
    }

This method above is working fine wherever I deploy my app, and so does this other (as example): 无论我在哪里部署我的应用程序,上述方法都可以正常工作,其他方法(例如)也可以:

@Transactional(readOnly = false)
public ServiceResult findId(@WebParam(name = "idOne") final String idOne, @WebParam(name = "idTwo") final String idTwo,
        @WebParam(name = "version") final String version) {
    this.getServiceResult();
    try {
        final Foo foo = this.fooMapper.findById(idOne);
        final Fooresult = this.fooMapper.findByVersion(foo.getId(), idTwo, version);
        if (result != null) {
            this.serviceResult.getResults().add(result.getId());
            this.serviceResult.setSuccess(true);
        }
    } catch (final Exception e) {
        logger.error("ERROR", e);
        this.serviceResult.getErrors().addAll(Utils.addErrors(e));
        e.printStackTrace();
    }
    return this.serviceResult;
}

These methods work both as spring boot app, jar file o war file deployed in WebLogic. 这些方法既可以用作Spring Boot应用程序,也可以用作WebLogic中部署的jar文件或war文件。

But then, this method: 但是然后,此方法:

public ServiceResult deleteFoo(@WebParam(name = "foo") final Foo foo) {
    return super.deleteFoo(foo);
}

works fine in embedded Tomcat if I deploy the app as spring boot app, but when I try to deploy war to WebLogic I get the following exception: 如果将应用程序部署为春季启动应用程序,则在嵌入式Tomcat中可以正常工作,但是当我尝试将war部署到WebLogic时,出现以下异常:

Caused by: java.lang.NullPointerException:
    at com.sun.xml.ws.spi.db.JAXBWrapperAccessor.getPropertyAccessor(JAXBWrapperAccessor.java:261)
    at com.sun.xml.ws.db.toplink.JAXBContextWrapper.getElementPropertyAccessor(JAXBContextWrapper.java:170)
    at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:598)
    at com.sun.xml.ws.server.sei.TieHandler.createArgumentsBuilder(TieHandler.java:143)
    at com.sun.xml.ws.server.sei.TieHandler.<init>(TieHandler.java:115)
    at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:118)
    at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)
    at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)
    at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:120)
    at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:521)
    at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:300)
    at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:164)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:639)
    at weblogic.wsee.jaxws.JAXWSDeployedServlet.getEndpoint(JAXWSDeployedServlet.java:355)
    at weblogic.wsee.jaxws.JAXWSServlet.registerEndpoint(JAXWSServlet.java:167)
    at weblogic.wsee.jaxws.JAXWSServlet.init(JAXWSServlet.java:79)
    at weblogic.wsee.jaxws.JAXWSDeployedServlet.init(JAXWSDeployedServlet.java:91)
    at javax.servlet.GenericServlet.init(GenericServlet.java:244)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:343)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:294)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
    at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
    at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
    at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:99)
    at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:87)
    at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:71)
    at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:57)
    at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:31)
    at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:673)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:612)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2054)
    at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:2031)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1920)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3091)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1823)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:882)
    at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360)
    at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)

This exception may be caused by something related to @WebParam annotation, because when I remove the annotation from delete method, the app is deployed correctly and method works fine in WebLogic. 此异常可能是由于与@WebParam批注相关的某些原因引起的,因为当我从delete方法中删除批注时,该应用已正确部署,并且该方法在WebLogic中可以正常工作。

The following link https://axis.apache.org/axis2/java/core/docs/app_server.html is for Axis, but seems more generally applicable to custom wars on weblogic. 以下链接https://axis.apache.org/axis2/java/core/docs/app_server.html用于Axis,但似乎更普遍地适用于Weblogic上的自定义战争。 It states 它指出

if you want to deploy custom WARs, say in a clustering environment, you need to add two additional files into the WEB-INF named "services.list" and "modules.list" under the modules and services directory respectively. 如果要部署自定义WAR,例如在集群环境中,则需要在模块和服务目录下分别将两个附加文件添加到WEB-INF中,分别名为“ services.list”和“ modules.list”。

WEB-INF/services/services.list : should list all the services (aar files) that you want to expose. WEB-INF / services / services.list:应该列出要公开的所有服务(AAR文件)。 WEB-INF/modules/modules.list : should list all the modules (mar files) that you want to use. WEB-INF / modules / modules.list:应该列出您要使用的所有模块(mar文件)。

NOTE: In both cases, please list one entry per line. 注意:在两种情况下,请每行列出一个条目。

WebLogic ships with JARs that conflict with JARs present in Axis2. WebLogic附带了与Axis2中存在的JAR冲突的JAR。 Therefore use to ensure that JARs packaged in Axis2 WAR are picked up from WEB-INF/lib. 因此,用于确保从WEB-INF / lib中拾取了Axis2 WAR中打包的JAR。 You can do this by setting the element in WEB-INF/weblogic.xml to true. 您可以通过将WEB-INF / weblogic.xml中的元素设置为true来实现。 An example of weblogic.xml is shown below: 下面显示了weblogic.xml的示例:

<weblogic-web-app>
     <container-descriptor>
         <prefer-web-inf-classes>true</prefer-web-inf-classes>
     </container-descriptor>
</weblogic-web-app>

If set to true, the element will force WebLogic's classloader to load classes located in the WEB-INF directory of a Web application in preference to application or system classes. 如果设置为true,则该元素将强制WebLogic的类加载器优先于应用程序或系统类加载Web应用程序的WEB-INF目录中的类。 This is a recommended approach since it only impacts a single Web module. 这是推荐的方法,因为它只影响单个Web模块。

For CXF, a similar document is at http://cxf.apache.org/docs/application-server-specific-configuration-guide.html#ApplicationServerSpecificConfigurationGuide-WebLogic : 对于CXF,类似的文档位于http://cxf.apache.org/docs/application-server-specific-configuration-guide.html#ApplicationServerSpecificConfigurationGuide-WebLogic

Create a weblogic-application.xml (Weblogic specific) in the META-INF folder. 在META-INF文件夹中创建一个weblogic-application.xml(特定于Weblogic)。

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
    <application-param>
        <param-name>webapp.encoding.default</param-name>
        <param-value>UTF-8</param-value>
    </application-param>
    <prefer-application-packages>
        <package-name>javax.jws.*</package-name>
    </prefer-application-packages>
</weblogic-application>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Weblogic应用服务器上部署SpringBoot应用程序? - How to deploy SpringBoot Application on Weblogic application server? 在CXF Web服务中使用@WebParam(header = true) - Using @WebParam(header = true) in CXF web service WebLogic - 在WebLogic Server中部署SpringBoot战争 - WebLogic - Deploy SpringBoot war in WebLogic Server 使用Weblogic Adapter部署Web应用程序以进行Eclipse - Deploy the web application using weblogic adaptor for eclipse 使用wlfullclient.jar在WebLogic 10.3.4上部署已安装的应用程序 - deploy already installed application on WebLogic 10.3.4 using wlfullclient.jar 如何在 weblogic 12C 中使用 REST 异步部署应用程序? - How to deploy asynchronously an application using REST in weblogic 12C? CXF忽略WebParam批注中的标头参数 - CXF ignores header argument from WebParam annotation 无法使用 AWS CodeDeploy 部署 Springboot 应用程序 AWS Ubuntu 实例 - Not able to deploy Springboot application AWS Ubuntu instance using AWS CodeDeploy Springboot 独立应用部署在生产中 - Springboot standalone application deploy in production 使用wlst脚本的Weblogic应用程序部署会发出内存不足异常 - Weblogic application deployment using wlst script gives out of memory exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM