在Weblogic中部署Spring Boot应用程序 [英] Deploy Spring Boot app in Weblogic

查看:1562
本文介绍了在Weblogic中部署Spring Boot应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在webLogic 12C中部署Spring启动应用程序时遇到问题。

I'm having a trouble deploying a Spring boot application in webLogic 12C.

10.4.4 403禁止
服务器理解请求,但是拒绝履行它。授权无效,请求不应重复。如果请求方法不是HEAD并且服务器希望公开为什么请求没有得到满足,那么它应该描述实体中拒绝的原因。当服务器不希望明确拒绝请求的原因,或者没有其他响应适用时,通常会使用此状态代码。

10.4.4 403 Forbidden The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

我想知道是否有人可以帮忙。

I was wondering if someone can help with that.

推荐答案

我查看了你的代码并发现了这类代码中的一个问题:
< a href =https://github.com/purrox/Spring-example/blob/master/src/main/java/hello/Application.java =noreferrer> https://github.com/purrox/ Spring-example / blob / master / src / main / java / hello / Application.java

I reviewed your code and saw an issue in this class of your code: https://github.com/purrox/Spring-example/blob/master/src/main/java/hello/Application.java

你正确地执行它(如SpringBoot中所定义) docs)但似乎Weblogic12C存在一个错误(或者可能是标准的解释)。似乎Weblogic12C搜索直接实现WebApplicationInitializer的类。请注意您的代码如何扩展SpringBootServletInitializer(实现WebApplicationInitializer)。 Weblogic12C似乎并不喜欢它。因此,最简单的方法是让Application类实现WebApplicationInitializer。所以,改变这一行:

You're doing it correctly (as defined in the SpringBoot docs) but it seems there's a bug with Weblogic12C (or maybe an interpretation of the standard). It seems like Weblogic12C Searches for a class that implements WebApplicationInitializer DIRECTLY. Notice how your code extends SpringBootServletInitializer (which implements WebApplicationInitializer). Weblogic12C doesn't like it that way it seems. So, the simplest way is to make your Application class implement WebApplicationInitializer. So, change this line:

public class Application extends SpringBootServletInitializer {  

到此:

public class Application extends SpringBootServletInitializer implements WebApplicationInitializer {  

注意:一旦解决了上述问题,您将遇到另一个Weblogic12C部署问题:java。 lang.IllegalArgumentException:LoggerFactory不是Logback LoggerContext,但是Logback在类路径上。要解决其他问题,请创建一个新文件src / main / webapp / WEB-INF / weblogic.xml并将此内容放入其中:

Note: once you fix the above, you'll run into another Weblogic12C deploy issue: "java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath". To fix that other issue, create a new file src/main/webapp/WEB-INF/weblogic.xml and put this content in it:

    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
        <wls:weblogic-version>12.1.1</wls:weblogic-version>
        <wls:context-root>helloApp</wls:context-root>
        <wls:container-descriptor>
            <wls:prefer-application-packages>
                <wls:package-name>org.slf4j.*</wls:package-name>
            </wls:prefer-application-packages>
        </wls:container-descriptor>
    </wls:weblogic-web-app>

这篇关于在Weblogic中部署Spring Boot应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆