Развертывание приложения jhipster в weblogic: java.lang.classnotfoundexception: afu.com.sun.source.tree.tree $ kind

Я пытаюсь развернуть приложение JHipster в WebLogic. Я только что начал базовый проект, поэтому могу понять, как это сделать. Я использую последние версии 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.war и jh-test-0.0.1-SNAPSHOT.war.original (этот рекомендован Документация JHipster), и в обоих случаях во время установки получаю ту же ошибку:

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

0
0
598
2

Ответы 2

Ссылка 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.

Maven:

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

Gradle:

dependencies {

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

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

}

Для гуавы-25. * И старше используйте org.checkerframework: checker-compat-qual

Или обновите свою версию гуавы выше 25 и используйте org.checkerframework: checker-qual

Другие вопросы по теме