简体   繁体   中英

ClassNotFoundException with Vaadin Application running in .ear in JBoss

There is a vaadin application packaged as war file within the ear file. This ear file is deployed within the JBoss. whenever the vaadin application is tried to be reached, there is ClassNotFoundException thrown with the binder instantiation while trying to open the page. The required class file is actually available within the WEB-INF/lib folder of the war file. The log of the exception is below.

java.lang.TypeNotPresentException: Type com.vaadin.flow.component.Component not present
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117) ~[?:?]
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125) ~[?:?]
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) ~[?:?]
    at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68) ~[?:?]
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138) ~[?:?]
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) ~[?:?]
    at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68) ~[?:?]
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138) ~[?:?]
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) ~[?:?]
    at sun.reflect.generics.repository.ConstructorRepository.computeParameterTypes(ConstructorRepository.java:111) ~[?:?]
    at sun.reflect.generics.repository.ConstructorRepository.getParameterTypes(ConstructorRepository.java:87) ~[?:?]
    at java.lang.reflect.Executable.getGenericParameterTypes(Executable.java:279) ~[?:?]
    at java.lang.reflect.Method.getGenericParameterTypes(Method.java:330) ~[?:?]
    at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:391) ~[?:?]
    at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:118) ~[?:?]
    at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:74) ~[?:?]
    at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:58) ~[?:?]
    at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1047) ~[?:?]
    at java.beans.Introspector.getBeanInfo(Introspector.java:462) ~[?:?]
    at java.beans.Introspector.getBeanInfo(Introspector.java:205) ~[?:?]
    at com.vaadin.flow.internal.BeanUtil.getBeanPropertyDescriptors(BeanUtil.java:83) ~[flow-server-2.7.15.jar:2.7.15]
    at com.vaadin.flow.data.binder.BeanPropertySet.<init>(BeanPropertySet.java:323) ~[flow-data-2.7.15.jar:2.7.15]
    at com.vaadin.flow.data.binder.BeanPropertySet.lambda$get$2(BeanPropertySet.java:439) ~[flow-data-2.7.15.jar:2.7.15]
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) ~[?:?]
    at com.vaadin.flow.data.binder.BeanPropertySet.get(BeanPropertySet.java:438) ~[flow-data-2.7.15.jar:2.7.15]
    at com.vaadin.flow.data.binder.Binder.<init>(Binder.java:1547) ~[flow-data-2.7.15.jar:2.7.15]

Caused by: java.lang.ClassNotFoundException: com.vaadin.flow.component.Component from [Module "deployment.xyz.ear" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255) ~[?:?]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410) ~[?:?]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) ~[?:?]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116) ~[?:?]
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Class.java:398) ~[?:?]
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114) ~[?:?]
    ... 120 more

Thanks

Found the fix, the project structuring was not fine. Although it compiles, the classes could not be fetched at runtime.

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