Created attachment 802196 [details] server.log Description of problem: If the JSON request causes an exception then the response is in XML format. Version-Release number of selected component (if applicable): 6.0.0, ER3, BPMS How reproducible: Now I am able to reproduce this issue on BPMS running on IBM JRE (see https://bugzilla.redhat.com/show_bug.cgi?id=1011420) Steps to Reproduce: 1. start BPMS on IBM JRE (without any repository) 2. create new repository by REST: curl -X POST -u "admin:admin1234;" -H "Content-Type: application/json" -d '{"name":"myRepo","description":"","userName":"","password":"","requestType":"clone","gitURL":"git://git.app.eng.bos.redhat.com/bpms-assets.git"}' http://10.16.92.101:8080/business-central/rest/repositories/ 3. create new organization unit by REST: curl -X POST -u "admin:admin1234;" -H "Content-Type: application/json" -d '{"name":"myGroup","description":"","owner":"admin"}' http://10.16.92.101:8080/business-central/rest/organizationalunits/ 4. add new repository to the organization unit by REST: curl -X POST -u "admin:admin1234;" -H "Content-Type: application/json" http://10.16.92.101:8080/business-central/rest/organizationalunits/myGroup/repositories/myRepo/ 5. deploy project from cloned repository by REST: curl -X POST -u "admin:admin1234;" -H "Content-Type: application/json" -d '{"name":"","value":""}' http://10.16.92.101:8080/business-central/rest/repositories/myRepo/projects/console/maven/deploy/ Actual results: If a request accesses then a response contains JSON data (as expected) but if a request causes an exception (step 5) then a response contains XML data: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <response> <status>FAILURE</status> <url>/business-central/rest/repositories/myRepo/projects/console/maven/deploy/</url> <error>org.kie.scanner.embedder.MavenEmbedderException: java.util.NoSuchElementException role: org.apache.maven.execution.MavenExecutionRequestPopulator roleHint: </error> <stackTrace>org.guvnor.common.services.shared.exceptions.GenericPortableException: org.kie.scanner.embedder.MavenEmbedderException: java.util.NoSuchElementException role: org.apache.maven.execution.MavenExecutionRequestPopulator roleHint: at org.guvnor.common.services.backend.exceptions.ExceptionUtilities.handleException(ExceptionUtilities.java:24) at org.guvnor.common.services.builder.BuildServiceImpl.buildAndDeploy(BuildServiceImpl.java:114) at org.guvnor.common.services.builder.BuildServiceImpl$Proxy$_$$_WeldClientProxy.buildAndDeploy(BuildServiceImpl$Proxy$_$$_WeldClientProxy.java) at org.kie.workbench.common.services.rest.ProjectResourceDispatcher.installProject(ProjectResourceDispatcher.java:274) at org.kie.workbench.common.services.rest.ProjectResourceDispatcher$Proxy$_$$_WeldClientProxy.installProject(ProjectResourceDispatcher$Proxy$_$$_WeldClientProxy.java) at org.kie.workbench.common.services.rest.KieSessionAsyncJobRequestObserver.onDeployProjectRequest(KieSessionAsyncJobRequestObserver.java:77) at org.kie.workbench.common.services.rest.KieSessionAsyncJobRequestObserver$Proxy$_$$_WeldClientProxy.onDeployProjectRequest(KieSessionAsyncJobRequestObserver$Proxy$_$$_WeldClientProxy.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267) at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137) at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263) at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170) at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51) at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:245) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:233) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:213) at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:117) at org.jboss.weld.event.TransactionalObserverNotifier.notifyObserver(TransactionalObserverNotifier.java:44) at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:85) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:80) at org.jboss.weld.event.EventImpl.fire(EventImpl.java:68) at org.kie.workbench.common.services.rest.ProjectResource.deployProject(ProjectResource.java:437) at org.kie.workbench.common.services.rest.ProjectResource$Proxy$_$$_WeldClientProxy.deployProject(ProjectResource$Proxy$_$$_WeldClientProxy.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.jbpm.designer.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:389) at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:389) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) at java.lang.Thread.run(Thread.java:738) </stackTrace> </response> Expected results: Return data in JSON format. Additional info: This exception probably depends on https://bugzilla.redhat.com/show_bug.cgi?id=1011420
http://github.com/droolsjbpm/drools-wb/commit/788d10fa3
I couldn't reproduce the described error message. Not with XML nor with JSON. It is a long time since this was reported. Sona, it is necessary to run this on IBM JRE?
Created attachment 849475 [details] server.log I've tested again with IBM JRE 6 ibm-java-x86_64-60-SR12 using the steps above and I got org.kie.scanner.embedder.MavenEmbedderException: java.util.NoSuchElementException in both cases - BRMS6 and BPMS6 ER7. Attaching BRMS server log to see the full stack trace. I've tested the same steps in both BRMS and BPMS ER7 with OpenJDK 1.7.0_25 without problems, so it's IBM JRE specific problem, which still persists.
Regarding to previous comment - the project is however deployed. Project .jar is deployed in BRMS 'Artifact Repository' screen. Also the client response is ok: {"jobId":"1389630485338-1","status":"ACCEPTED","repositoryName":"myRepo","projectName":"console"} So the problem is now only in misleading error message on IBM JRE.
I fixed the error caused by the IBM JVM, but I believe that is only one way to trigger this problem and not it's root cause. I am reassigning this to Toni so he could investigate why, more in general, errors are reported in the wrong format.
After some investigations I think this is what should happen. The original bug that caused the error to show up had been fixed so I broke the codes in few different ways to get some errors. There are two ways that could fire exceptions: #1 The codes that are about to be built and deployed are broken. These kind of exceptions are picked up and do not affect the rest call. The rest call simply fires the build and it either passes or not. The result is not reported, just that the build & deploy was started. #2 The workbench codes are broken. This caused the java.util.NoSuchElementException in this BZ. These are all bugs that we should fix. I don't see any need for any more code changes.
This no longer has a target release of 6.0.0.
Verified in BPMS 6.0.1.ER2.