Bug 1296017 - IllegalAnnotationsException "JAXB can't handle interfaces." in kie-server
IllegalAnnotationsException "JAXB can't handle interfaces." in kie-server
Status: VERIFIED
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: Kie-Server (Show other bugs)
6.2.0
Unspecified Unspecified
high Severity high
: DR1
: 6.3.0
Assigned To: Maciej Swiderski
Karel Suta
:
Depends On:
Blocks: 1297869
  Show dependency treegraph
 
Reported: 2016-01-06 02:24 EST by Toshiya Kobayashi
Modified: 2016-02-17 09:40 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1297869 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
drools-simple-dep-example-brms620-BZ.zip (48.11 KB, application/zip)
2016-01-06 02:25 EST, Toshiya Kobayashi
no flags Details

  None (edit)
Description Toshiya Kobayashi 2016-01-06 02:24:49 EST
Description of problem:

If you have an Interface in your kjar (or dependent jar) and create a container with the kjar, kie-server fails when you execute REST commands.

=====
16:00:42,090 ERROR [org.kie.server.services.impl.KieContainerCommandServiceImpl] (http-localhost.localdomain/127.0.0.1:8080-3) Error calling container 'MyContainer': org.kie.server.api.marshalling.MarshallingException: Error while creating JAXB context from default classes! 1 counts of IllegalAnnotationExceptions
	at org.kie.server.api.marshalling.jaxb.JaxbMarshaller.<init>(JaxbMarshaller.java:208) [kie-server-api-6.3.0.Final-redhat-5.jar:6.3.0.Final-redhat-5]
	at org.kie.server.api.marshalling.MarshallerFactory.getMarshaller(MarshallerFactory.java:39) [kie-server-api-6.3.0.Final-redhat-5.jar:6.3.0.Final-redhat-5]
	at org.kie.server.services.impl.KieContainerInstanceImpl.getMarshaller(KieContainerInstanceImpl.java:111) [kie-server-services-common-6.3.0.Final-redhat-5.jar:6.3.0.Final-redhat-5]
	at org.kie.server.services.impl.KieContainerCommandServiceImpl.callContainer(KieContainerCommandServiceImpl.java:94) [kie-server-services-common-6.3.0.Final-redhat-5.jar:6.3.0.Final-redhat-5]
	at org.kie.server.remote.rest.drools.CommandResource.manageContainer(CommandResource.java:73) [kie-server-rest-drools-6.3.0.Final-redhat-5.jar:6.3.0.Final-redhat-5]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_66]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_66]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_66]
	at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_66]
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:168) [resteasy-jaxrs-2.3.12.Final-redhat-1.jar:]
...
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
com.sample.MyInterface is an interface, and JAXB can't handle interfaces.
	this problem is related to the following location:
		at com.sample.MyInterface

	at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106) [jaxb-impl-2.2.11.jar:2.2.11]
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:460) [jaxb-impl-2.2.11.jar:2.2.11]
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:292) [jaxb-impl-2.2.11.jar:2.2.11]
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139) [jaxb-impl-2.2.11.jar:2.2.11]
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1138) [jaxb-impl-2.2.11.jar:2.2.11]
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:162) [jaxb-impl-2.2.11.jar:2.2.11]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_66]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_66]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_66]
	at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_66]
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:392) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
	at org.kie.server.api.marshalling.jaxb.JaxbMarshaller.<init>(JaxbMarshaller.java:206) [kie-server-api-6.3.0.Final-redhat-5.jar:6.3.0.Final-redhat-5]
	... 33 more
=====



Steps to Reproduce:
1. Start BRMS 6.2.0
2. Unzip attached drools-simple-dep-example-brms620-BZ.zip
3. Run the test as below
$ cd ./drools-simple-dep-jar
$ mvn clean install
$ cd ../drools-simple-dep-kjar
$ mvn clean install
$ cd ../drools-simple-dep-rest
$ mvn clean test

Actual results:

Fails with IllegalAnnotationsException

Expected results:

The rule is executed ([STDOUT] Hello, John)
Comment 1 Toshiya Kobayashi 2016-01-06 02:25 EST
Created attachment 1112038 [details]
drools-simple-dep-example-brms620-BZ.zip
Comment 2 Toshiya Kobayashi 2016-01-06 02:38:11 EST
The extra jaxb classes are added here:

https://github.com/droolsjbpm/droolsjbpm-integration/blob/6.3.x/kie-server-parent/kie-server-services/kie-server-services-drools/src/main/java/org/kie/server/services/drools/DroolsKieServerExtension.java#L91-L114

So, if you follow the steps:

1. Add @org.kie.api.remote.Remotable to your data model classes (or check "Remotable" box in business-central Data Modeler )
2. Start BRMS with -Dorg.drools.server.filter.classes=true

you can avoid the issue.

But I think default behaviour should simply exclude Interface classes.
Comment 5 Maciej Swiderski 2016-01-07 11:54:23 EST
fixed by extending submitted PR and merged into master

droolsjbpm-integration
master:
https://github.com/droolsjbpm/droolsjbpm-integration/commit/0e227ccf1da9752a1e21231574d741ca1c1d716f
Comment 6 Karel Suta 2016-02-17 09:39:57 EST
Verified in 6.3.0 DR1.

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