Bug 1092839 - "org.guvnor.common.services.builder.Builder" build() method swallow Exception
Summary: "org.guvnor.common.services.builder.Builder" build() method swallow Exception
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.0.1
Hardware: All
OS: All
high
high
Target Milestone: ER4
: 6.1.0
Assignee: manstis
QA Contact: Jiri Locker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-30 05:30 UTC by kylin
Modified: 2020-03-27 20:08 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-27 20:08:41 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Guvnor Builder swallow Exception (5.03 KB, application/x-java-archive)
2014-04-30 05:39 UTC, kylin
no flags Details
Build messages (84.87 KB, image/png)
2014-12-04 10:48 UTC, manstis
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1098111 0 high CLOSED Build of project which includes XLS table fails 2021-02-22 00:41:40 UTC

Internal Links: 1098111

Description kylin 2014-04-30 05:30:37 UTC
"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.

Comment 1 kylin 2014-04-30 05:39:28 UTC
Created attachment 891013 [details]
Guvnor Builder swallow Exception

Comment 3 kylin 2014-04-30 05:47:58 UTC
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.

Comment 4 manstis 2014-12-04 10:48:14 UTC
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 ) );
  ...

Comment 5 manstis 2014-12-04 10:48:45 UTC
Created attachment 964584 [details]
Build messages

Comment 7 Jiri Locker 2015-03-03 17:44:34 UTC
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


Note You need to log in before you can comment on or make changes to this bug.