Service-context.xml file causing login issue

cancel
Showing results for 
Search instead for 
Did you mean: 
erichkey
Active Member II

Re: Service-context.xml file causing login issue

Jump to solution

Hi Roberto,

Is there perhaps a way I can contact you directly, perhaps via skype?

This issue is causing some delay and it would be solved quicker via direct message platform.

roberto_gamiz
Established Member II

Re: Service-context.xml file causing login issue

Jump to solution

You can send me a private mensagge if you want but as you sure understand outside community i don't think that i can give you this kind of support.

It seems that your workflow its trying to tranform a document into pdf and store it in an especific folder. This forder must be located in Alfresco Repository in the same space where the original document (target of the transformation) lives.
Taking into acount that you init the workflow manually you must know where is the original file and so the destination folder.

However if you want to attach workflow files it would be easiest to find your problem.

erichkey
Active Member II

Re: Service-context.xml file causing login issue

Jump to solution

I completely understand. Figured I might give it a try.

Yes, the workflow is configured to transfer the file into a pdf file once the workflow is completed but where it stores the folder is the issue. According to the workflow previously created, it is as you described:

 This forder must be located in Alfresco Repository in the same space where the original document (target of the transformation) lives.

This issue just randomly occurred one day, so to test out the workflow I created a new alfresco install and the same issue persisted. The previous admin created the workflow as per following instructions: 

Adding Workflow to Alfresco

This assumes that you already created an Activiti bpmn workflow in Eclipse

Go to Alfrecso workflow directory and create the spring bean file:

 nano /opt/alfresco-community/tomcat/shared/classes/alfresco/extensions/service-context.xml
 <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <!--     Licensed to the Apache Software Foundation (ASF) under one or more     contributor license agreements.  See the NOTICE file distributed with     this work for additional information regarding copyright ownership.     The ASF licenses this file to You under the Apache License, Version 2.0     (the "License"); you may not use this file except in compliance with     the License.  You may obtain a copy of the License at     	     http://www.apache.org/licenses/LICENSE-2.0     	     Unless required by applicable law or agreed to in writing, software     distributed under the License is distributed on an "AS IS" BASIS,     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.     See the License for the specific language governing permissions and     limitations under the License. --> <beans>         <!-- A simple module component that will be executed once.         Note. this module component will only be executed once, and then there will be an entry for it in the Repo.         So doing for example $ mvn clean install -Pamp-to-war twice will only execute this component the first time.         You need to remove /alf_data_dev for it to be executed again. -->     <bean id="extension.workflowBootstrap" parent="workflowDeployer">         <property name="workflowDefinitions">     	  	<list>                                 <props>                     <prop key="engineId">activiti</prop>                     <prop key="location">alfresco/extension/workflow/MyProcess2.bpmn</prop>                     <prop key="mimetype">text/xml</prop>                     <prop key="redeploy">false</prop>                 </props>  	</list>          </property> 	</bean>  </beans>

Save and exit the editor Create the Workflow directory:

 mkdir -p /opt/alfresco-community/tomcat/shared/classes/alfresco/extensions/workflow/

Create the Workflow file called MyProcess2.bpmn</code> Paste the following defaults and save and exit when done

 <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20" id="review-definitions">   <process id="ksesWorkflow" name="Keystone Document Review" isExecutable="true">     <startEvent id="start" activiti:formKey="wf:submitReviewTask"></startEvent>     <sequenceFlow id="flow1" sourceRef="start" targetRef="reviewTask"></sequenceFlow>     <userTask id="reviewTask" name="Review Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:activitiReviewTask">       <extensionElements>         <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">           <activiti:field name="script">             <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);                         if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>           </activiti:field>         </activiti:taskListener>         <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">           <activiti:field name="script">             <activiti:string><![CDATA[execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));  /* transform to pdf */                      var drafts = bpm_package.children[0].parent;                      var docroot = drafts.parent;                       var dest = docroot.childByNamePath("Released");                      var trans = actions.create("transform");                       trans.parameters["destination-folder"] = dest;                       trans.parameters["assoc-type"] = "{http://www.alfresco.org/model/content/1.0}contains";                      trans.parameters["assoc-name"] = String("{http://www.alfresco.org/model/content/1.0}" + bpm_package.children[0].properties["cm:name"]);                      trans.parameters["mime-type"] = "application/pdf";                       trans.execute(bpm_package.children[0]);]]></activiti:string>           </activiti:field>         </activiti:taskListener>       </extensionElements>     </userTask>     <sequenceFlow id="flow2" sourceRef="reviewTask" targetRef="reviewDecision"></sequenceFlow>     <exclusiveGateway id="reviewDecision" name="Review Decision"></exclusiveGateway>     <sequenceFlow id="flow3" sourceRef="reviewDecision" targetRef="approved">       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>     </sequenceFlow>     <sequenceFlow id="flow4" sourceRef="reviewDecision" targetRef="rejected"></sequenceFlow>     <userTask id="approved" name="Document Approved" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:approvedTask">       <documentation>The document was reviewed and approved.</documentation>       <extensionElements>         <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">           <activiti:field name="script">             <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);                         if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>           </activiti:field>         </activiti:taskListener>       </extensionElements>     </userTask>     <userTask id="rejected" name="Document Rejected" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:rejectedTask">       <documentation>The document was reviewed and rejected.</documentation>       <extensionElements>         <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">           <activiti:field name="script">             <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);                         if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>           </activiti:field>         </activiti:taskListener>       </extensionElements>     </userTask>     <sequenceFlow id="flow5" sourceRef="approved" targetRef="end"></sequenceFlow>     <sequenceFlow id="flow6" sourceRef="rejected" targetRef="end"></sequenceFlow>     <endEvent id="end"></endEvent>   </process>   <bpmndi:BPMNDiagram id="BPMNDiagram_ksesWorkflow">     <bpmndi:BPMNPlane bpmnElement="ksesWorkflow" id="BPMNPlane_ksesWorkflow">       <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">         <omgdc:Bounds height="35.0" width="35.0" x="30.0" y="200.0"></omgdc:Bounds>       </bpmndi:BPMNShape>       <bpmndi:BPMNShape bpmnElement="reviewTask" id="BPMNShape_reviewTask">         <omgdc:Bounds height="55.0" width="105.0" x="105.0" y="190.0"></omgdc:Bounds>       </bpmndi:BPMNShape>       <bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">         <omgdc:Bounds height="40.0" width="40.0" x="250.0" y="197.0"></omgdc:Bounds>       </bpmndi:BPMNShape>       <bpmndi:BPMNShape bpmnElement="approved" id="BPMNShape_approved">         <omgdc:Bounds height="55.0" width="105.0" x="330.0" y="137.0"></omgdc:Bounds>       </bpmndi:BPMNShape>       <bpmndi:BPMNShape bpmnElement="rejected" id="BPMNShape_rejected">         <omgdc:Bounds height="55.0" width="105.0" x="330.0" y="257.0"></omgdc:Bounds>       </bpmndi:BPMNShape>       <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">         <omgdc:Bounds height="35.0" width="35.0" x="620.0" y="147.0"></omgdc:Bounds>       </bpmndi:BPMNShape>       <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">         <omgdi:waypoint x="65.0" y="217.0"></omgdi:waypoint>         <omgdi:waypoint x="105.0" y="217.0"></omgdi:waypoint>       </bpmndi:BPMNEdge>       <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">         <omgdi:waypoint x="210.0" y="217.0"></omgdi:waypoint>         <omgdi:waypoint x="250.0" y="217.0"></omgdi:waypoint>       </bpmndi:BPMNEdge>       <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">         <omgdi:waypoint x="270.0" y="197.0"></omgdi:waypoint>         <omgdi:waypoint x="270.0" y="164.0"></omgdi:waypoint>         <omgdi:waypoint x="330.0" y="164.0"></omgdi:waypoint>       </bpmndi:BPMNEdge>       <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">         <omgdi:waypoint x="270.0" y="237.0"></omgdi:waypoint>         <omgdi:waypoint x="270.0" y="284.0"></omgdi:waypoint>         <omgdi:waypoint x="330.0" y="284.0"></omgdi:waypoint>       </bpmndi:BPMNEdge>       <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">         <omgdi:waypoint x="435.0" y="164.0"></omgdi:waypoint>         <omgdi:waypoint x="620.0" y="164.0"></omgdi:waypoint>       </bpmndi:BPMNEdge>       <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">         <omgdi:waypoint x="435.0" y="284.0"></omgdi:waypoint>         <omgdi:waypoint x="637.0" y="284.0"></omgdi:waypoint>         <omgdi:waypoint x="637.0" y="182.0"></omgdi:waypoint>       </bpmndi:BPMNEdge>     </bpmndi:BPMNPlane>   </bpmndi:BPMNDiagram> </definitions>

Restart Alfresco and Log in with your username and password, go to Task > My Tasks > Select the custom workflow and it worked.

I have uploaded the files mentioned above and also another file that was located along the worklfow files, another bpmn file.

Like I previously said I'm fairly new to Alfresco Repositories and especially when it comes to the workflows.

Dropbox - Alfresco Workflow Files - Simplify your life 

roberto_gamiz
Established Member II

Re: Service-context.xml file causing login issue

Jump to solution

Hello Erich,

I just realized that in your code you up to levels in the spaces hierarchy to find the destination space.

var drafts = bpm_package.children[0].parent;
var docroot = drafts.parent;
var dest = docroot.childByNamePath("Released");

This means that assuming that the document you are trying to transform is in for example:

Repositorio> Community> DocumentReview> Documents

the destination folder Released must be in: 

Repositorio> Community> DocumentReview

Take in count that the user that execute the workflow must have read/write access to the destination space to find it and to create the transformation.

Execute the workflow with admin user to know if you hace permission problems

Regards

erichkey
Active Member II

Re: Service-context.xml file causing login issue

Jump to solution

I have executed with admin but the permissions don't seem to be the problem. Upon starting the workflow as a user for a document to be reviewed, it select approve as the admin that the document has been reviewed and then get the following error message:

org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 0115188195 Failed to execute supplied script: 0115188194 A value for the mandatory parameter destination-folder has not been set on the rule item transform

According to what you stated if I understood correct is that the draft is taken from the original folder and upon releasing the document, it is placed into another folder. Would I be able to resolve this by setting

var dest = docroot.childByNamePath("Released"); to var dest = bpm_package.children[0].parent; ? 
roberto_gamiz
Established Member II

Re: Service-context.xml file causing login issue

Jump to solution

Of course if you want to create the transformed document in the same space that the original one. Other option could be check if the folder exist and create it if not:

var dest = docroot.childByNamePath("Released");
if (dest == null){
dest = docroot.createFolder("Released");
}
erichkey
Active Member II

Re: Service-context.xml file causing login issue

Jump to solution

Okay I seems that the workflow is working for now. I was busy configuring the smtp settings so that notifications emails are sent to an assignee when the workflow has started. I used Outbound SMTP configuration properties | Alfresco Documentation for the configuration but I'm not receiving a email noti when the workflow has started. I thought it might be an problem on our smtp server side so I used the gmail sample with my personal email as sender to see if that made a difference, sadly it didn't.

Here's how I have it configured at the moment.

roberto_gamiz
Established Member II

Re: Service-context.xml file causing login issue

Jump to solution

Hello,

Are there any message in the server logs  (alfresco.log, catalina.out).?

erichkey
Active Member II

Re: Service-context.xml file causing login issue

Jump to solution

Hi,

This is what I got in the alfresco.log file:

2019-02-21 11:17:01,545 ERROR [org.alfresco.repo.action.executer.MailActionExecuter] [mailAsyncAction1] Failed to send email to [erich] : org.springframework.mail.MailSendException: Failed messages: javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 SMTP AUTH is required for message submission on port 587
; message exceptions (1) are:
Failed message 1: javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 SMTP AUTH is required for message submission on port 587

2019-02-21 11:17:18,169 ERROR [org.alfresco.repo.action.executer.MailActionExecuter] [mailAsyncAction2] Failed to send email to [admin] : org.springframework.mail.MailSendException: Failed messages: javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 SMTP AUTH is required for message submission on port 587
; message exceptions (1) are:
Failed message 1: javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 SMTP AUTH is required for message submission on port 587

The catalina.out file does not contain any error messages.

erichkey
Active Member II

Re: Service-context.xml file causing login issue

Jump to solution

Email notification resolved !

The problem was on the smtp server not allowing mail to be relayed due to an unauthorized host. Referred to: Fix SMTP AUTH required for message submission on port 587