Access uploaded content in a ServiceTask?

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

Access uploaded content in a ServiceTask?

Jump to solution

Hi all,

I need some advice because I'm messing around with a requirement without getting any solution. All I wanna do is to access some previous uploaded files (in a User Task, from the upload form field) in a downstream ServiceTask. For me it looks like that the example behind the following link is the way to go:

https://community.alfresco.com/docs/DOC-6837-getting-started-with-alfresco-activiti-enterprise#jive_... 

I assume I can get the content by injecting (or "Autowireing") the RelatedContentService (?):

RelatedContentService relatedContentService;

The issue I get is already right after copy&paste the demo code from the above link to my project. The project has been created with the org.alfresco.maven.archetype:activiti-jar-archetype (see attached screenshot).

But the following packages can not be resolved (see attached screenshot):

import com.activiti.content.storage.api.ContentObject;
import com.activiti.extension.domain.runtime.RelatedContent;

Which dependencies are missing here? If I double check at maven.alfresco.com/nexus for RelatedContent, it only refers to a class within a org.activiti package. Even the ContentObject seems to be only available in org.activiti group of the content-storage-api artifact. However, if I use the classes from the org.activiti package instead, the startup of the application server crashes with the following:

Caused by: java.lang.IllegalStateException: Failed to introspect bean class [com.activiti.extension.bean.MyTestClass] for persistence metadata: could not find class that it depends on
        at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:401)
        at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:333)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:992)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:523)
        ... 28 more
Caused by: java.lang.NoClassDefFoundError: Lorg/activiti/app/service/runtime/RelatedContentService;

Can anyone help me with that issue, please? Maybe the approach is wrong? Again, what I need is, just to get the uploaded content from a previous UserTask in a ServiceTask.

Thanks!

BR,

1 Solution

Accepted Solutions
fegor
Senior Member

Re: Access uploaded content in a ServiceTask?

Jump to solution

Hi!

You do need activiti-app-logic-1.5.3.jar (or other version) dependency in your pom.xml

For example:

<dependency>
   <groupId>${activiti.groupId}</groupId>
   <artifactId>activiti-app-logic</artifactId>
   <version>${activiti.version}</version>
   <exclusions>
      <!-- Exclude the SLF4J JAR so we don't get multiple binding warnings when running -->
      <exclusion>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-log4j12</artifactId>
      </exclusion>
   </exclusions>
</dependency>

Regards.

View solution in original post

5 Replies
fegor
Senior Member

Re: Access uploaded content in a ServiceTask?

Jump to solution

Hi!

You do need activiti-app-logic-1.5.3.jar (or other version) dependency in your pom.xml

For example:

<dependency>
   <groupId>${activiti.groupId}</groupId>
   <artifactId>activiti-app-logic</artifactId>
   <version>${activiti.version}</version>
   <exclusions>
      <!-- Exclude the SLF4J JAR so we don't get multiple binding warnings when running -->
      <exclusion>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-log4j12</artifactId>
      </exclusion>
   </exclusions>
</dependency>

Regards.

mario_fliegner
Active Member II

Re: Access uploaded content in a ServiceTask?

Jump to solution

Fernando González‌ thanks! The mentioned dependency is available in the POM after creating the project with the org.alfresco.maven.archetype:activiti-jar-archetype artifact. However, I do not see the packages / classes in the JAR file so the IDE doesn't see it either!???

Missing packages / classes in JAR file

Dependencies in POM

Any thoughts what I'm doing wrong?

BR,

Mario

fegor
Senior Member

Re: Access uploaded content in a ServiceTask?

Jump to solution

Ah!!, ok, ok, have you tried doing this from terminal?

mvn eclipse:eclipse

This synchronize dependencies with Eclipse from maven.

Regards.

mario_fliegner
Active Member II

Re: Access uploaded content in a ServiceTask?

Jump to solution

I don't have Eclipse as IDE.

fegor
Senior Member

Re: Access uploaded content in a ServiceTask?

Jump to solution

Ops! I'm sorry. Then do can use maven in command mode for test this dependency and after watch your config with your IDE.