04-12-2011 10:30 AM
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="scwf:publishDocument">
<swimlane name="initiator"/>
<start-state name="Start">
<task name="scwf:assignWorkflow" swimlane="initiator"/>
<transition to="AnalystTask" name="toAnalyst"></transition>
</start-state>
<task-node name="AnalystTask">
<task name="scwf:createDocument" swimlane="initiator">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
</task>
<transition to="TeamLeadTask" name="toTeamLead">
<action class="gov.dhs.ipds.alfresco.AlfrescoHelper" config-type="bean" name="reviewChanges"/>
</transition>
</task-node>
<task-node name="TeamLeadTask">
<task name="scwf:reviewDocument" swimlane="initiator">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
</task>
<transition to="End" name="toProduction">
</transition>
</task-node>
<end-state name="End"></end-state>
</process-definition>
package gov.dhs.ipds.alfresco;
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
import org.springframework.beans.factory.BeanFactory;
import org.jbpm.graph.exe.ExecutionContext;
public class AlfrescoHelper extends JBPMSpringActionHandler {
private static final long serialVersionUID = 1000L;
public void execute(ExecutionContext ctx) throws Exception {
System.out.println("Inside AlfrescoHelp.execute()");
}
public AlfrescoHelper() {
System.out.println("Inside AlfrescoHelper()");
}
@Override
protected void initialiseHandler(BeanFactory factory) {
System.out.println("Inside AlfrescoHelper.initialiseHandler()");
// TODO Auto-generated method stub
}
}
09:06:44,209 ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gov.dhs.ipds.alfresco.AlfrescoHelper' defined in file [C:\Alfresco\tomcat\shared\classes\alfresco\extension\someco-model-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [gov.dhs.ipds.alfresco.AlfrescoHelper]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:946)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [gov.dhs.ipds.alfresco.AlfrescoHelper]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:938)
… 38 more
Caused by: java.lang.NullPointerException
at org.springmodules.workflow.jbpm31.JbpmFactoryLocator.useBeanFactory(JbpmFactoryLocator.java:162)
at org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler.<init>(JBPMSpringActionHandler.java:46)
at gov.dhs.ipds.alfresco.AlfrescoHelper.<init>(AlfrescoHelper.java:15)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
… 40 more
04-29-2011 10:22 AM
04-29-2011 11:20 AM
I am packaging and deploying class using an ant script. I create a jar file and then explode that jar file into the <alfresco_root>/tomcat/shared/classes directory structure. The build script is based off the one from the someCo samples. Right now AlfrescoHelper is the only one that we actually have written as we are still in prototype/proof of concept mode.
One thing I found interesting is that I had to put the following jar files in the C:\Alfresco\tomcat\shared\lib directory, otherwise I received ClassNotFoundException error when I tried to access my class.alfresco-core-3.4.d.jar
I found this odd as they are in the <alfresco_root>/tomcat/webapps/alfresco/lib directory already. As I am writing this, I am wondering if this may be my problem - do I have the right jar files here? Am I missing some? Why do I need to include them here?
alfresco-repository-3.4.d.jar
commons-logging-1.1.jar
jbpm-jpdl.jar
org.springframework.beans-3.0.0.jar
springmodules-jbpm31.jar
Here is my directory structure.
C:\Alfresco\tomcat\shared\classes\alfresco\extension:
someco-model-context.xml
scWorkflow.properties
C:\Alfresco\tomcat\shared\classes\alfresco\extension\model
scWorkflowModel.xml
C:\Alfresco\tomcat\shared\classes\alfresco\extension\workflow\PublishDocument
processdefinition.xml
Thank you for your persistence in trying to solve this issue.
Brenda
04-29-2011 12:16 PM
04-29-2011 02:21 PM
Ok - to make sure I understand your recommendation, I should explode the alfresco.war into a directory called alfresco.war off webapps and put my files there? Everything I have read says to put extensions in shared/classes/alfresco/extension - is that only applicable for configuration and customization files and not my java files? It sounds like it. So I already have a directory alfresco under webapps, which is basically the alfresco.war unzipped from the install - so I do NOT put my files here, but rather in a separate directory off webapps called alfresco.war which would contain duplicate files to webapps/alfresco. Is that correct?
Once they are packaged, you have three options for deploying them as part of the Alfresco web application:
• Copy your files on top of an exploded Alfresco web application.
• Integrate your files with the Alfresco WAR, which you then deploy.
• Package your changes as an Alfresco Module Package (AMP) file. The AMP is then installed in—merged into—an Alfresco WAR, which is then deployed to the application server.
The Java classes you develop as a part of your customization will go into a JAR file. The JAR file will reside in the WEB-INF|lib of the Alfresco web application. Therefore, you should name it such that it is easy to spot among the hundred or so JAR files distributed as part of Alfresco. Similarly, any tag libraries that you develop will reside in WEB-INF alongside Alfresco's taglibs.
Custom JSP pages should be kept separate from Alfresco's to make them easier to identify. One way to do this is to create an extension directory under jsp, but it is completely up to you. The same goes for scripts, images, and CSS.
Like Spring, JSF relies on XML files to configure the framework. Alfresco's JSF files reside in the WEB-INF directory, and all begin with "faces". Custom JSF components and navigation rules are declared in a faces configuration file. Unfortunately, there is not as much flexibility in the location of your JSF configuration files as there is with Spring. For JSF, it comes down to two choices: WEB-INF|faces-config-custom.xml or faces-config.xml in META-INF within a JAR file that resides in Alfresco's WEB-INF|lib directory. Which one you use depends on what you are trying to do. If you are overriding Alfresco's existing JSF navigation rules, you have to go the META-INF route. If you are overriding Alfresco's existing JSF component declarations, you have to go the WEB-INF route. If you aren't overriding anything, you can pick either.
Not all configurations are handled through standard frameworks such as Spring and JSF. Some configuration changes are made using properties files or Alfresco configuration XML. For example, the most commonly customized properties file is custom-repository.properties. In it, you can find things such as the username and password used to connect to the underlying relational database, the database driver, and the data directory file path. Like the Spring files, there are sample properties files in the extensions|extension directory of the Alfresco distribution.
04-29-2011 02:25 PM
04-29-2011 02:28 PM
04-29-2011 02:46 PM
04-29-2011 04:01 PM
05-02-2011 10:21 AM
05-02-2011 02:16 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.