Spring Boot + Eclipse + Weblogic 12.2.1

半城伤御伤魂 提交于 2019-12-10 16:24:00

问题


I'm having an issue when I deploy a spring boot application in weblogic 12.2.1 through Eclipse Neon. This are the components

  • Simple spring boot application with web dependency.
  • Eclipse neon
  • Weblogic 12.2.1.1 embed in eclipse

The error is:

weblogic.management.DeploymentException: java.lang.ClassNotFoundException: org.springframework.security.oauth2.client.token.AccessTokenRequest
    at weblogic.application.internal.BaseDeployment.throwAppException(BaseDeployment.java:132)
    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:246)
    at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:66)
    at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65)
    Truncated. see log file for complete stacktrace

But I'm not using security in the application. If I run it as "Spring Boot App" the application runs.

I guess the problem is with weblogic, how can I solve it?


回答1:


For anybody else hitting this, it appears this is a bug in Spring Boot (spring-boot-autoconfigure) induced by the Oracle WebLogic team's pesky adherence to the EE spec. See here for more info: https://github.com/spring-projects/spring-boot/issues/9441

The 1.5.5.RELEASE version of Spring Boot has this fixed. So if you're using gradle for example, changing your dependency as follows (and any other Spring Boot dependencies you have) should fix it:

compile "org.springframework.boot:spring-boot-autoconfigure:1.5.5.RELEASE"

I've just confirmed this works for me after getting the same problem.




回答2:


For me this exception disappeared when deployed the war file using the WebLogic console. Seems to be a bug in Eclipse-WebLogic integration.




回答3:


Another guy here forced to deploy to weblogic :\

This is what I've done in order to fix the integration issue beetween weblogic, eclipse and spring-boot:

  1. I've added oauth dependency to my pom:

```

<dependency>
   <groupId>org.springframework.security.oauth</groupId>
   <artifactId>spring-security-oauth2</artifactId>
</dependency>
```

But after that, weblogic asked my user and password for every rest endpoint (not actuator ones)

So, here comes the second point:

  1. Exclude security from autoconfiguration (or adjust it as you wish)

```

    @EnableAutoConfiguration(exclude = {      org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class 
})

``` Hope it helps!



来源:https://stackoverflow.com/questions/43767211/spring-boot-eclipse-weblogic-12-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!