cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Third-party review doesn't work well

Not applicable
Hi everybody Smiley Happy
I am currently ready Alfresco Developer Guide. I'm ready chapter 7, about the advanced workflows. I made a workflow that works well. Here comes the diagram:
http://www.benichka.fr/images/processimage.jpg
When Operation Review and Marketing Review approve a file, an email is sent to a Third Party. The email sent is like that:
You have been assigned to a task named Third Party Review. Take the appropriate action by clicking one of the links below:

third_reject
http://localhost:8080/alfresco/service/someco/bpm/review?id=jbpm$43-@&action=third_reject&guest=true

third_approve
http://localhost:8080/alfresco/service/someco/bpm/review?id=jbpm$43-@&action=third_approve&guest=tru...
Good Smiley Happy but when I click on a link:
The Web Script /alfresco/service/someco/bpm/review has responded with a status of 500 - Erreur Interne de Servlet.

500 Description: Le serveur a recontrer une erreur interne qui l''a empêché de satisfaire la requête.
 
Message: Wrapped Exception (with status template): null
  
Exception: org.alfresco.web.scripts.WebScriptException - Wrapped Exception (with status template): null
  
org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:595)
  
Server: Alfresco Labs v3.0.0 (Stable 1526) schema 1 002
Time: 12 mars 2009 16:46:58
  
Diagnostics: Inspect Web Script (com/someco/bpm/review.get)

Here come my configuration files:
review.get.desc.xml:

<webscript>
   <shortname>BPM Review</shortname>
   <description>Review and approve a BPM task</description>
   <url>/someco/bpm/review?id={idArgument}&amp;action={transArgument}</url>
   <format default="html">extension</format>
   <authentification>guest</authentification>
   <transaction>none</transaction>
</webscript>

review.get.html.ftl:

<html>
   <body>
      <p>Signaled ${args.id} for transition ${args.action}</p>
   </body>
</html>

GetReview.java:

package com.someco.scripts;

import java.util.HashMap;
import java.util.Map;

import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.web.scripts.Status;
import org.alfresco.web.scripts.WebScriptRequest;
import org.apache.log4j.Logger;

public class GetReview extends org.alfresco.web.scripts.DeclarativeWebScript {
   
   private WorkflowService workflowService;
   private Logger logger;

   @Override
   protected Map<String, Object> executeImpl(WebScriptRequest req, Status status) {
      final String id = req.getParameter("id");
      final String action = req.getParameter("action");
      
      if (id == null || action == null) {
         status.setCode(400);
         status.setMessage("Required data has not been provided");
         status.setRedirect(true);
      }
      
      Map<String, Object> model = new HashMap<String, Object>();
      
      model.put("response", AuthenticationUtil.runAs(new RunAsWork<String>() {
         public String doWork() throws Exception {
            logger.debug("About to signal id:" + id + " with transition:" + action);
            workflowService.signal(id, action);
            logger.debug("Signal sent.");
            return "Success";
         }
      },
      "admin"));
      return model;
   }

   public WorkflowService getWorkflowService() {
      return workflowService;
   }

   public void setWorkflowService(WorkflowService workflowService) {
      this.workflowService = workflowService;
   }
}

I just don't know why this exception is raised, I've spent my day on it 😕

Any idea ?

Thanks a lot !

Benoit
6 REPLIES 6

jayjayecl
Confirmed Champ
Confirmed Champ
could you please provide us with the definition of your webscript in the webscript-application-context.xml …

mrogers
Star Contributor
Star Contributor
I agree with JayJayECL  that you need to provide more input.   

Do you see the result of logger.debug("Signal sent."); ?
Does your workflow have script components - if it does let's see it.
Is there a stacktrace in the logfile.   Lets see it.

Although not the cause of your problem, I do note that if "id" or "action" are null you set status and then carry on regardless  :wink:

Not applicable
Thanks for your replies Smiley Very Happy
@JeyJeyECL:
- I didn't touch the file web-script-application-context.xml. I created a someco-script-context.xml file that is located in config/alfresco/extension/. :
someco-scripts-context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   <bean id="webscript.com.someco.bpm.review.get" class="com.someco.scripts.GetReview" parent="webscript">
      <property name="workflowService">
         <ref bean="WorkflowService" />
      </property>
   </bean>
</beans>
Actually I done what was written on the book :s (I didn't create extra files or modify something that weren't supposed to be ^^')

@mrogers:
I inserted the line:

logger.debug("id: " + id + "\r\n" + "action: " + action);
Just after declaring the strings id and action in the class GetReview.java. Guess what ? the line didn't show up in the log:

09:36:41,921 DEBUG [com.someco.bpm.ExternalReviewNotification] Mail action executed
09:37:41,750 INFO  [org.alfresco.web.scripts.AbstractRuntime] Caught exception & redirecting to status template: Wrapped Exception (with status template): null
(I declared my logger in the log4j.properties files, if you're asking):

# Mail Getter reviewer
log4j.logger.com.someco.scripts.GetReview=debug
The first line indicates that the mail is sent (which is normal because I received it lol).
The second line is the exception Smiley Happy

Also, if id or action are, I think that status is not set but that's right, the method carry on…No a perfect way to do thing, but it's an example in the book Smiley Very Happy

script component? don't know that yet :s (or not in these terms)

And noooooo there is no stacktrace, the error is even harder to decrypt Smiley Sad

I think that my scripts didn't call well my class, I'm gonna take a look…

Thanks for helping Smiley Surprised

Not applicable
Errrrrrrrrr I don't know what I've done, but it works Smiley Sad

I forgot to instantiate well the logger:

logger = Logger.getLogger(GetReview.class);

I've done it, it solved it…

I just don't know why a logger that isn't instantiate can block a whole script, but nevermind, it's solved Smiley Surprised

Thanks for your help Smiley Happy

prethi
Champ in-the-making
Champ in-the-making
Hi everyone..
I followed the steps as described in advanced workflow article…..
Mail is gettng sent with the transition links perfectly…
But when i click on it…no necessary action is action….
i think i have missed out something…
but couldn't get wat is that????
can anyone please help if u have tried this…

Thanks in advance.. Smiley Happy

khinendra
Champ on-the-rise
Champ on-the-rise
Hi,

I did the same descibed above but I am unable to send mail.
I am getting the null poiner exception from ExternalReviewNotification.

A brief Stack trace I am writting below.

18:49:07,235 ERROR [org.jbpm.graph.def.GraphElement] action threw exception: null
java.lang.NullPointerException

18:49:07,265 ERROR [org.alfresco.web.ui.common.Utils] A system error happened during the operation: Failed to signal transition 'Approve' from workflow task 'jbpm$51'
org.alfresco.service.cmr.workflow.WorkflowException: Failed to signal transition 'Approve' from workflow task 'jbpm$51'

Caused by: org.jbpm.graph.def.DelegationException
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:387)

Caused by: java.lang.NullPointerException
   at com.tcs.bpm.ExternalReviewNotification.execute(ExternalReviewNotification.java:60)




getting null pointer exception from below line of class ExternalReviewNotification.java
      Action mailAction = this.actionService.createAction(MailActionExecuter.NAME);

Please resond







Regard,

Khinendra