在WebLogic上部署JHipster应用程序:java.lang.ClassNotFoundException:afu.com.sun.source.tree.Tree $ Kind

时间:2018-10-31 12:08:24

标签: spring-boot jhipster weblogic12c

我正在尝试在WebLogic中部署JHipster App。我刚刚开始一个基本项目,所以我可以弄清楚该怎么做。我正在使用WebLogic和JHipster的最新版本。

我已经对基本项目进行了更改:

  1. spring-boot-starter-tomcat添加到pom.xml:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>
    
  2. 添加ServletInitializer类:

    package com.my.jhtest;
    
    import org.springframework.boot.builder.SpringApplicationBuilder;
    import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
    
    public class ServletInitializer extends SpringBootServletInitializer {
        @Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
            return application.sources(JhTestApp.class);
        }
    }
    
  3. weblogic.xml添加到src/main/webapp/WEB-INF

    <?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://xmlns.oracle.com/weblogic/weblogic-web-app
            http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
    
        <wls:context-root>/jh-test</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>
    
  4. dispatcherServlet-servlet.xlm添加到src/main/webapp/WEB-INF

    <?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>
    

我已经运行mvnw -Pprod package以便将该项目打包为.war文件。我已经尝试部署jh-test-0.0.1-SNAPSHOT.warjh-test-0.0.1-SNAPSHOT.war.original(这个由JHipster documentation推荐),在两种情况下,在安装过程中都会得到相同的错误:

    <31-oct-2018 11H44' CET> <Warning> <JAXRSIntegration> <BEA-2192511> <The list of resource packages: com.netflix.eureka.resources;com.netflix.discovery.provider;com.netflix.appinfo;com.papertrail.profiler.jaxrs>
    <31-oct-2018 11H44' CET> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "78970619757759" for task "0" on [partition-name: DOMAIN]. Error is: "java.lang.ClassNotFoundException: afu.com.sun.source.tree.Tree$Kind"
    java.lang.ClassNotFoundException: afu.com.sun.source.tree.Tree$Kind
            at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:104)
            at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
            at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
            Truncated. see log file for complete stacktrace
    Caused By: java.lang.ClassNotFoundException: afu.com.sun.source.tree.Tree$Kind
            at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:104)
            at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
            at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
            Truncated. see log file for complete stacktrace
    >
    <31-oct-2018 11H44' CET> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application "jh-test-0.0.1-SNAPSHOT.original".>
    <31-oct-2018 11H44' CET> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    java.lang.ClassNotFoundException: afu.com.sun.source.tree.Tree$Kind
            at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:104)
            at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
            at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
            Truncated. see log file for complete stacktrace
    Caused By: java.lang.ClassNotFoundException: afu.com.sun.source.tree.Tree$Kind
            at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:104)
            at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
            at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
            Truncated. see log file for complete stacktrace
    >
    <31-oct-2018 11H44' CET> <Error> <Console> <BEA-240003> <Administration Console encountered the following error: weblogic.application.WrappedDeploymentException: afu.com.sun.source.tree.Tree$Kind
            at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:104)
            at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
            at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
            at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:496)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:72)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:53)
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
            at java.lang.Class.getDeclaredMethods(Class.java:1975)
            at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:112)
            at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:109)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:109)
            at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
            at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266)
            at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
            at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
            at java.lang.Class.createAnnotationData(Class.java:3521)
            at java.lang.Class.annotationData(Class.java:3510)
            at java.lang.Class.getAnnotations(Class.java:3446)
            at weblogic.application.utils.annotation.AnnotationAncestry.isExtendedAnnotationDeep(AnnotationAncestry.java:107)
            at weblogic.application.utils.annotation.AnnotationAncestry.isExtendedAnnotation(AnnotationAncestry.java:93)
            at weblogic.application.utils.annotation.ClassfinderClassInfos$Cache.getAnnotationsOfInterest(ClassfinderClassInfos.java:872)
            at weblogic.application.utils.annotation.ClassfinderClassInfos$Cache.access$700(ClassfinderClassInfos.java:840)
            at weblogic.application.utils.annotation.ClassfinderClassInfos.getAnnotatedClassesByTargetsAndSources(ClassfinderClassInfos.java:656)
            at weblogic.application.utils.annotation.ClassfinderClassInfos.hasAnnotatedClasses(ClassfinderClassInfos.java:705)
            at com.oracle.injection.integration.CDIUtils.hasCDIEnablingAnnotations(CDIUtils.java:782)
            at com.oracle.injection.integration.CDIUtils.isWebModuleCDIEnabled(CDIUtils.java:401)
            at com.oracle.injection.integration.CDIUtils.isModuleCdiEnabled(CDIUtils.java:651)
            at com.oracle.injection.integration.CDIModuleExtensionFactory.create(CDIModuleExtensionFactory.java:39)
            at weblogic.application.internal.ExtensibleModuleWrapper.createModuleExtensions(ExtensibleModuleWrapper.java:264)
            at weblogic.application.internal.ExtensibleModuleWrapper.initDrivenObjectArray(ExtensibleModuleWrapper.java:232)
            at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:107)
            at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
            at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
            at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
            at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
            at weblogic.application.utils.StateMachineDriver.nextStateInParallel(StateMachineDriver.java:144)
            at weblogic.application.internal.flow.ModuleStateDriver.parallelPrepare(ModuleStateDriver.java:46)
            at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:75)
            at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:55)
            at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:729)
            at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
            at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:241)
            at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:52)
            at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
            at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65)
            at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:229)
            at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:103)
            at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:242)
            at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:800)
            at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1352)
            at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:270)
            at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:177)
            at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:186)
            at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:14)
            at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:47)
            at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:670)
            at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
            at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
            at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
            at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
            at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:644)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:415)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:355)
    >

我已经阅读了这篇文章:java.lang.ClassNotFoundException: afu.com.sun.source.tree.Tree$Kind,但是所引用的依赖项在生成的.war中。

1 个答案:

答案 0 :(得分:0)

链接java.lang.ClassNotFoundException: afu.com.sun.source.tree.Tree$Kind非常接近。是的,期望此类的是Google Guava中的某种依赖关系问题,但不存在。看起来25.0使用了org.checkerframework:checker-compat-qual,但是27.0现在使用了org.checkerframework:checker-qual

为了解决此问题,您可以显式添加依赖项org.checkerframework:checker-qual

行家:

<dependency>
    <groupId>org.checkerframework</groupId>
    <artifactId>checker-qual</artifactId>
    <version>2.5.6</version>
</dependency>

等级:

dependencies {

    compile "org.checkerframework:checker-qual:2.5.6"

    //The rest of JHipster's pre-defined dependencies...

}