简体   繁体   中英

War file generated out of Spring Boot is not getting deployed to Weblogic 12c

I'm using Spring Boot(2.0.5.RELEASE) to build a war file to deploy into weblogic 12c. I'm following the below tutorial to do that:

https://o7planning.org/en/11901/deploying-spring-boot-application-on-oracle-weblogic-server

But not able deploy in weblogic (through weblogic console), and getting below errors:

Message icon - Error Unable to access the selected application.
Message icon - Error java.io.IOException
Message icon - Error weblogic.utils.compiler.ToolFailureException

And also observed the below error in the admin server log:

####<Oct 3, 2018 11:33:46 PM EDT> <Error> <J2EE> <wloki> <AdminServer> <[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <> <1538624026936> <BEA-160228> <AppMerge failed to merge your application. If you are running AppMerge on the command-line, merge again with the -verbose option for more details. See the error message(s) below.>

Could anyone help me here as where I'm going wrong?

My pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.springBoot</groupId>
    <artifactId>DemoSpringBoot</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>DemoSpringBoot</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

weblogic.xml:

<?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/ejb-jar_3_0.xsd
    http://xmlns.oracle.com/weblogic/weblogic-web-app
    http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web- 
 app.xsd">
<wls:context-root>/myweb</wls:context-root>
<wls:container-descriptor>
    <wls:prefer-application-packages>
        <wls:package-name>org.slf4j</wls:package-name>
         <wls:package-name>org.springframework.*</wls:package-name>
    </wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>

dispatcherServlet-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
   <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd">

  </beans>

ServletInitializer.java

package com.springboot;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.web.WebApplicationInitializer;

public class ServletInitializer extends SpringBootServletInitializer 
                             implements WebApplicationInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(DemoSpringBootApplication.class);
    }

}

DemoSpringBootApplication.java

package com.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoSpringBootApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoSpringBootApplication.class, args);
    }
}

Please let me know if I'm doing anything wrong as I'm not able to progress on this.

Thanks.

The issue is resolved. After adding the below property in the pom.xml :

 <properties>
  ...
  <log4j2.version>2.8.2</log4j2.version>
  ...

Now able to deploy to weblogic 12c.

It's late but to those who need it, This issue might happen due to different version of java check your java_home before you compile your code, in my case i have changed it to 11->1.8(because in my project we are using 1.8) and it works fine for me,before changing anything you can use war decompiler(jd) and check your manifest file's build jdk(if you use manifest file then you must, incase you don't need manifest file you can delete it so that you don't need to change any java_home, i hope it will work too). I think weblogic 12c complains if jdk is 1.8+ btw i am not sure about it. best way to solve trial and error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM