Description of problem: If a project contains interface java classes, project build fails with the message like: 12:07:48,761 ERROR [org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl] (http-localhost.localdomain/127.0.0.1:8080-6) Deployment of unit org.kie.example:project1:1.0.0-SNAPSHOT failed: Unable to instantiate JAXBContext for deployment 'org.kie.example:project1:1.0.0-SNAPSHOT'.: org.jbpm.console.ng.bd.exception.DeploymentException: Unable to instantiate JAXBContext for deployment 'org.kie.example:project1:1.0.0-SNAPSHOT'. at org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl.deploy(DeploymentManagerEntryPointImpl.java:119) [jbpm-console-ng-business-domain-backend-6.0.3-redhat-4.jar:6.0.3-redhat-4] at org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl.deploy(DeploymentManagerEntryPointImpl.java:103) [jbpm-console-ng-business-domain-backend-6.0.3-redhat-4.jar:6.0.3-redhat-4] at org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl.process(DeploymentManagerEntryPointImpl.java:245) [jbpm-console-ng-business-domain-backend-6.0.3-redhat-4.jar:6.0.3-redhat-4] at org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl$Proxy$_$$_WeldClientProxy.process(DeploymentManagerEntryPointImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-console-ng-business-domain-backend-6.0.3-redhat-4.jar:6.0.3-redhat-4] at org.guvnor.common.services.builder.BuildServiceImpl.buildAndDeploy(BuildServiceImpl.java:108) [guvnor-project-builder-6.0.3-redhat-4.jar:6.0.3-redhat-4] ... Caused by: java.lang.IllegalStateException: Unable to instantiate JAXBContext for deployment 'org.kie.example:project1:1.0.0-SNAPSHOT'. at org.kie.remote.services.rest.jaxb.DynamicJaxbContext.setupDeploymentJaxbContext(DynamicJaxbContext.java:225) [kie-services-remote-6.0.3-redhat-4.jar:6.0.3-redhat-4] at org.kie.remote.services.rest.jaxb.DynamicJaxbContext.setupDeploymentJaxbContext(DynamicJaxbContext.java:152) [kie-services-remote-6.0.3-redhat-4.jar:6.0.3-redhat-4] ... Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions org.kie.example.project1.MyInterface is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at org.kie.example.project1.MyInterface at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106) [jaxb-impl-2.2.5-redhat-5.jar:2.2.5-redhat-5] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:466) [jaxb-impl-2.2.5-redhat-5.jar:2.2.5-redhat-5] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298) [jaxb-impl-2.2.5-redhat-5.jar:2.2.5-redhat-5] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141) [jaxb-impl-2.2.5-redhat-5.jar:2.2.5-redhat-5] at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163) [jaxb-impl-2.2.5-redhat-5.jar:2.2.5-redhat-5] at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145) [jaxb-impl-2.2.5-redhat-5.jar:2.2.5-redhat-5] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45] at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45] at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-2.jar:1.0.4.Final-redhat-2] at javax.xml.bind.ContextFinder.find(ContextFinder.java:392) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-2.jar:1.0.4.Final-redhat-2] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-2.jar:1.0.4.Final-redhat-2] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-2.jar:1.0.4.Final-redhat-2] at org.kie.remote.services.rest.jaxb.DynamicJaxbContext.setupDeploymentJaxbContext(DynamicJaxbContext.java:221) [kie-services-remote-6.0.3-redhat-4.jar:6.0.3-redhat-4] ... 96 more Steps to Reproduce: 1. Create a new project in business-central 2. Clone the project to local filesystem 3. Add an interface java source to the project (e.g. ./project1/src/main/java/org/kie/example/project1/MyInterface.java) === package org.kie.example.project1; public interface MyInterface { } === 4. Commit and push 5. Press "Build&Deploy" Actual results: Build fails with the message: 12:07:48,761 ERROR [org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl] (http-localhost.localdomain/127.0.0.1:8080-6) Deployment of unit org.kie.example:project1:1.0.0-SNAPSHOT failed: Unable to instantiate JAXBContext for deployment 'org.kie.example:project1:1.0.0-SNAPSHOT'.: org.jbpm.console.ng.bd.exception.DeploymentException: Unable to instantiate JAXBContext for deployment 'org.kie.example:project1:1.0.0-SNAPSHOT'. ... Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions org.kie.example.project1.MyInterface is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at org.kie.example.project1.MyInterface Expected results: Build successful
For those following the bugs: this is not a kie-wb/BPMS issue: this is a matter of adding documentation about JAXB usage: JAXB can not handle fields that are interfaces without adding specific JAXB annotations to the field.
Yes... but does this mean that users have to add JAXB annotations to all interfaces in a project in business-cental? (Note that users may not use those interfaces for REST access)
Users need to do the following: - do not add JAXB annotations to interfaces - do not use interfaces classes to define fields Basically, they need to follow JAXB conventions when annotating classes with JAXB annotations.
Ah, sorry, Marco. Please forget my stupid comment#3. My main point is that users may want to add their own classes/interfaces to implement internal logic, not as data models. However, DynamicJaxbContext.setupDeploymentJaxbContext() picks up *all* classes/interfaces in a project to JAXBContext.newInstance() so results in the Exception. If it's expected, we would need to document guidance like: "All Java sources in a project are considered as data models so need to follow JAXB conventions." Is it fine?
Fixed for 6.3/community 6.4. Commits: master: https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/c0bd4a50 https://github.com/droolsjbpm/jbpm/commit/4c6d1aca https://github.com/droolsjbpm/droolsjbpm-integration/commit/6c22dff9 https://github.com/droolsjbpm/kie-docs/commit/319f0c78 Waiting on https://github.com/droolsjbpm/jbpm-console-ng/pull/237
Verified with DR2 - interface is automatically excluded from serialization.