Bug 1011482 - REST API: Inconsistent response type for error message
Summary: REST API: Inconsistent response type for error message
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ER1
: 6.0.1
Assignee: Toni Rikkola
QA Contact: Jiri Svitak
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-24 11:52 UTC by Sona Mala
Modified: 2014-08-06 19:58 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
Cause: Deploying project into BPMS/BRMS on IBM java virtual machine cause an exception. Consequence: REST response is returned in requested format but the status of request does not correspond with an exception in server.log. Workaround (if any): no workaround Result:
Clone Of:
Environment:
Last Closed: 2014-08-06 19:58:09 UTC
Type: Bug
Embargoed:
jsvitak: needinfo-


Attachments (Terms of Use)
server.log (415.55 KB, text/x-log)
2013-09-24 11:52 UTC, Sona Mala
no flags Details
server.log (91.59 KB, text/plain)
2014-01-13 16:25 UTC, Jiri Svitak
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1011420 0 high CLOSED Unable to open Project screen on IBM java platform 2021-02-22 00:41:40 UTC

Internal Links: 1011420

Description Sona Mala 2013-09-24 11:52:58 UTC
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

Comment 3 Jiri Svitak 2014-01-10 17:27:49 UTC
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?

Comment 4 Jiri Svitak 2014-01-13 16:25:40 UTC
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.

Comment 5 Jiri Svitak 2014-01-13 16:37:57 UTC
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.

Comment 7 Mario Fusco 2014-01-15 12:06:34 UTC
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.

Comment 8 Toni Rikkola 2014-01-28 14:15:44 UTC
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.

Comment 9 Lukáš Petrovický 2014-02-07 16:19:52 UTC
This no longer has a target release of 6.0.0.

Comment 10 Jiri Svitak 2014-03-12 15:28:35 UTC
Verified in BPMS 6.0.1.ER2.


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