REST: POST /deployment/create - NullPointer 7.2-alpha5

634 views
Skip to first unread message

Gareth

unread,
Nov 13, 2014, 3:25:05 AM11/13/14
to camunda-...@googlegroups.com
Hi

I am deploying the following into Camunda 7.2-Alpha5 via the rest call /deployment/create but get a null pointer exception will calling isBpmnResource.

If looks like resourceName isn't being set for some reason. ( same code in Alpha 9 ). Is there something wrong with my payload or is this a bug ? ( It looks like its trying to validate the resource name ends with bpmn20.xml or bpmn - but as this is a REST call I cant see where this is set - it feels like a hangover from file deploys? )

protected boolean isBpmnResource(String resourceName) {
for (String suffix : BPMN_RESOURCE_SUFFIXES) {
if (resourceName.endsWith(suffix)) {
return true;
}
}
return false;
}

Is there a guide to setup remote debuging for Camunda ?

Thanks

Gareth

Log:
13 Nov 2014 08:07:47,248 - main - DEBUG - org.springframework.http.client.support.HttpAccessor.createRequest(HttpAccessor.java:78) - Created POST request for "http://localhost:8081/engine-rest/deployment/create"
13 Nov 2014 08:07:47,251 - main - DEBUG - org.springframework.web.client.RestTemplate$AcceptHeaderRequestCallback.doWithRequest(RestTemplate.java:579) - Setting request Accept header to [text/plain, application/json, application/*+json, */*]
13 Nov 2014 08:07:47,251 - main - DEBUG - org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:653) - Writing [{deployment-name=[UnitTestProcess], enable-duplicate-filtering=[true], deploy-changed-only=[true], *=[<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://activiti.org/bpmn" id="federos-definition" targetNamespace="http://activiti.org/bpmn">
<process id="federos-0A02003677BB227AF1DBD1B533C849CA" isExecutable="true" name="PT1">
<laneSet id="laneSet_4bd7ccdd-98f8-4f90-889b-f9407a808d5b">
<lane id="lane_a93ac62b-4437-45a3-9fc9-dff01766e4b5" name="admin">
<flowNodeRef>GUID-0A02004943714A3EFC0D3E1E49D84F27</flowNodeRef>
<flowNodeRef>GUID-0A02004943714A3E7EA6C5F117D14F7A</flowNodeRef>
<flowNodeRef>GUID-0A02004943714A3E96AEC9D00D534F06</flowNodeRef>
</lane>
</laneSet>
<endEvent id="GUID-0A02004943714A3EFC0D3E1E49D84F27" name="Silent end">
<incoming>GUID-7F0000013D0B754553B2316E7BD14DCD</incoming>
</endEvent>
<task id="GUID-0A02004943714A3E7EA6C5F117D14F7A" name="Demo Abstract task">
<incoming>GUID-0A02004943714A3EFA24B46354624470</incoming>
<outgoing>GUID-7F0000013D0B754553B2316E7BD14DCD</outgoing>
</task>
<startEvent camunda:async="true" id="GUID-0A02004943714A3E96AEC9D00D534F06" name="Manual start">
<outgoing>GUID-0A02004943714A3EFA24B46354624470</outgoing>
</startEvent>
<sequenceFlow id="GUID-0A02004943714A3EFA24B46354624470" sourceRef="GUID-0A02004943714A3E96AEC9D00D534F06" targetRef="GUID-0A02004943714A3E7EA6C5F117D14F7A"/>
<sequenceFlow id="GUID-7F0000013D0B754553B2316E7BD14DCD" sourceRef="GUID-0A02004943714A3E7EA6C5F117D14F7A" targetRef="GUID-0A02004943714A3EFC0D3E1E49D84F27"/>
</process>
<collaboration id="collaboration_2131955d-e2ff-41e9-92cf-9a765cf771a7">
<participant id="participant_93dfc05f-cbc7-4f41-8e9b-8f68c8375662" name="admin" processRef="federos-0A02003677BB227AF1DBD1B533C849CA"/>
</collaboration>
</definitions>]}] as "multipart/form-data" using [org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter@6d3b4609]
13 Nov 2014 08:07:47,269 - main - WARN - org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:529) - POST request for "http://localhost:8081/engine-rest/deployment/create" resulted in 500 (Internal Server Error); invoking error handler
13 Nov 2014 08:07:47,270 - main - ERROR - com.tdbfusion.bpm.services.CamundaEngineService.loadProcessDefinitionFromByteArray(CamundaEngineService.java:368) - Error unable to start Process. <html><head><title>Apache Tomcat/7.0.50 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - java.lang.NullPointerException</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>java.lang.NullPointerException</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:169)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:212)
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59)
org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:47)
</pre></p><p><b>root cause</b> <pre>java.lang.NullPointerException
org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.isBpmnResource(BpmnDeployer.java:468)
org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:90)
org.camunda.bpm.engine.impl.persistence.deploy.DeploymentCache.deploy(DeploymentCache.java:58)
org.camunda.bpm.engine.impl.persistence.entity.DeploymentManager.insertDeployment(DeploymentManager.java:44)
org.camunda.bpm.engine.impl.cmd.DeployCmd.deploy(DeployCmd.java:166)
org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:84)
org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:61)
org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:97)
org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
org.camunda.bpm.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:82)
org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:125)
org.camunda.bpm.engine.rest.impl.DeploymentRestServiceImpl.createDeployment(DeploymentRestServiceImpl.java:126)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:169)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:212)
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59)
org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:47)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.50 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.50</h3></body></html>
org.springframework.web.client.HttpServerErrorException: 500 Internal Server Error
--
Confidentiality Notice:
The contents of this e-mail and any attachments are intended for the named
addressee only and may be confidential. Unless you are the named addressee
or authorised to receive the e-mail of the named addressee, you may not
disclose, use or copy the contents of this e-mail. If you have received
this e-mail in error, please contact the sender and delete the e-mail
immediately. TDB Holdings Limited and its associated group companies do not
accept responsibility for this message and any views or opinions contained
within this e-mail are solely those of the author unless expressly stated
otherwise.

Sebastian Menski

unread,
Nov 13, 2014, 3:32:36 AM11/13/14
to camunda-...@googlegroups.com, gar...@tdbfusion.com
Hi Gareth,

could you show us your your POST request? As shown in the example of the rest docs [1] the part with the bpmn
should have a filename set which is then used as resource name. So we can distinguish between
bpmn, cmmn and other files.

Cheers,
Sebastian

gar...@tdbfusion.com

unread,
Nov 13, 2014, 3:58:09 AM11/13/14
to camunda-...@googlegroups.com, gar...@tdbfusion.com
Hi Sebastian

Thanks for your response ( again :) ).

The body is included in the log ( its in a slightly different format, i'm trying to work out how to get it dumped in the same format as shown in the manual. ) However it is passing Camunda validation. Is there an integration test suite for the REST functionality I could look at ? Or a payload that you know works ?

Ill work on trying to capture the raw request ( even if its with fiddler - http://www.telerik.com/fiddler )

Kind Regards

Gareth

gar...@tdbfusion.com

unread,
Nov 13, 2014, 4:01:53 AM11/13/14
to camunda-...@googlegroups.com, gar...@tdbfusion.com
As requested ( Raw request )

--38gBZ7QRQdTjv3aRqUiajRpCmsxkw-y_VY8
Content-Disposition: form-data; name="deployment-name"
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 15

UnitTestProcess
--38gBZ7QRQdTjv3aRqUiajRpCmsxkw-y_VY8
Content-Disposition: form-data; name="enable-duplicate-filtering"
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 4

true
--38gBZ7QRQdTjv3aRqUiajRpCmsxkw-y_VY8
Content-Disposition: form-data; name="deploy-changed-only"
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 4

true
--38gBZ7QRQdTjv3aRqUiajRpCmsxkw-y_VY8
Content-Disposition: form-data; name="*"
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 1836
--38gBZ7QRQdTjv3aRqUiajRpCmsxkw-y_VY8--

gar...@tdbfusion.com

unread,
Nov 13, 2014, 4:08:41 AM11/13/14
to camunda-...@googlegroups.com, gar...@tdbfusion.com
It looks like the payload is incorrect :(

Manual:
--28319d96a8c54b529aa9159ad75edef9
Content-Disposition: form-data; name="data"; filename="test.bpmn"

<?xml version="1.0" encoding="UTF-8"?>

Mine:
--38gBZ7QRQdTjv3aRqUiajRpCmsxkw-y_VY8
Content-Disposition: form-data; name="*"
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 1836

<?xml version="1.0" encoding="UTF-8"?>

I'm missing the filename attribute and took the '*' in the manual literally. Now to work out how to set the filename attribute ....

MultiValueMap<String, Object> formData = new LinkedMultiValueMap<String, Object>();
formData.add( "deployment-name", processId );
formData.add( "enable-duplicate-filtering", "true" );
formData.add( "deploy-changed-only", "true" );
formData.add( "*", new String( bpmn2ByteArray ) );

Sebastian Menski

unread,
Nov 13, 2014, 4:28:25 AM11/13/14
to camunda-...@googlegroups.com, gar...@tdbfusion.com
Hi Gareth,

what do you use to post the request? Apache HTTP Client?

Cheers,
Sebastian

gar...@tdbfusion.com

unread,
Nov 13, 2014, 4:56:27 AM11/13/14
to camunda-...@googlegroups.com, gar...@tdbfusion.com
Im using Springs RestTemplate ( its awesome - not serialisation / deserialisation of json - just strongly typed objects ).

I've figure out how to add the additional parameter and it now says its successful, however its not showing in the Tasklist :(

<200 OK,{"links":[{"method":"GET","href":"http://localhost:8081/engine-rest/deployment/d2cf4177-6b19-11e4-b5f8-92f79dfe1272","rel":"self"}],"id":"d2cf4177-6b19-11e4-b5f8-92f79dfe1272","name":"UnitTestProcess","deploymentTime":"2014-11-13T09:45:38"},{Server=[Apache-Coyote/1.1], Content-Type=[application/json], Transfer-Encoding=[chunked], Date=[Thu, 13 Nov 2014 09:47:23 GMT]}>

gar...@tdbfusion.com

unread,
Nov 13, 2014, 5:37:15 AM11/13/14
to camunda-...@googlegroups.com, gar...@tdbfusion.com
It's working now. You have to set the filename parameter to end "bpmn20.xml" or "bpmn"

Sebastian Menski

unread,
Nov 13, 2014, 7:23:21 AM11/13/14
to camunda-...@googlegroups.com, gar...@tdbfusion.com
Hi Garteh,

nice to hear that it works now. We use the file extension to determine the file type. So if you add bpmn or bpmn20.xml as file extension
the engine will know it is BPMN. Otherwise the engine thinks it is another deployment resource which is saved but not processed.

Cheers,
Sebastian
Reply all
Reply to author
Forward
0 new messages