"org.guvnor.common.services.builder.Builder" at the end of build() method swallow Exception: ~~~ for ( final String packageName : kieModuleMetaData.getPackages() ) { for ( final String className : kieModuleMetaData.getClasses( packageName ) ) { final String fullyQualifiedClassName = packageName + "." + className; try { final Class clazz = kieModuleMetaData.getClass( packageName, className ); final TypeSource typeSource = getClassSource( kieModuleMetaData, clazz ); if ( TypeSource.JAVA_DEPENDENCY == typeSource ) { verifyExternalClass( clazz ); } } catch ( NoClassDefFoundError e ) { final String msg = MessageFormat.format( ERROR_EXTERNAL_CLASS_VERIFICATON, fullyQualifiedClassName ); logger.warn( msg ); results.addBuildMessage( makeWarningMessage( msg ) ); } catch ( Throwable e ) { final String msg = MessageFormat.format( ERROR_EXTERNAL_CLASS_VERIFICATON, fullyQualifiedClassName ); logger.error( msg ); results.addBuildMessage( makeErrorMessage( msg ) ); } } } ~~~ Note that NoClassDefFoundError be swallowed, the output didn't contain No exist class.
Created attachment 891013 [details] Guvnor Builder swallow Exception
How to Reproduce: ================ 1. start BPMS 6.0.1 2. login to business-central, select Authoring -> Artifact repository ->Upload, upload attached checkservice-1.0.jar 3. create a new project, add checkservice-1.0.jar as dependency 4. Build & Deploy the new created project. Build & Deploy successful, but logs of warning throw as below: ~~~ 10:58:23,286 WARN [org.guvnor.common.services.builder.Builder] (http-/10.66.218.46:8080-3) Verification of class org.springframework.scripting.jruby.JRubyScriptUtils failed and will not be available for authoring. Please check the necessary external dependencies for this project are configured correctly. ~~~ Note that JRubyScriptUtils depend on org/jruby/ast/Node, and org/jruby/ast/Node didn't exist in classpath, this the root cause, NoClassDefFoundError contain no found class name, but the exception be swallowed, it confused.
Can you please explain a little more? The code, as you have pasted, logs the "NoClassDefFoundError" to both the server's logs and the list of build messages shown to the user (see attached screenshot). ... logger.warn( msg ); results.addBuildMessage( makeWarningMessage( msg ) ); ...
Created attachment 964584 [details] Build messages
checkservice-1.0.jar in attachment 891013 [details] depends on spring-context, which has a lot of optional dependencies [1], that seem to be ignored (unless they are also declared with compile scope). This is the reason why classes imported in JRubyScriptUtils cannot be found, which is in my opinion correctly reported on warning level. During 6.0.1 release, there was a commit which indeed removed the exception from logging statement and made it more difficult to find out why class verification failed. Currently on 6.2.x branch the exception is again logged [3] (although it is not included in Messages console in Workbench). NoClassDefFoundError with missing class name can be found in server log which, I hope, will be helpful in finding problems with dependencies. [1] https://repo1.maven.org/maven2/org/springframework/spring-context/3.1.1.RELEASE/spring-context-3.1.1.RELEASE.pom [2] https://github.com/droolsjbpm/guvnor/commit/c7c3b7f683ed1121b4da229bd9ed78767bd0214d#diff-b28cae43a47bd8cb749c586ac39f70c2L177 [3] https://github.com/droolsjbpm/kie-wb-common/blob/250e55c683349685adeba2e92d7c87052e1c1aa9/kie-wb-common-services/kie-wb-common-services-backend/src/main/java/org/kie/workbench/common/services/backend/builder/Builder.java#L198