Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
556 views
in Technique[技术] by (71.8m points)

java - Deploy Spring Boot app in Weblogic

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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 {  

to this:

public class Application extends SpringBootServletInitializer implements WebApplicationInitializer {  

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...