cancel
Showing results for 
Search instead for 
Did you mean: 

Droolls drl file included in bar is not deployed.

mutcha
Champ in-the-making
Champ in-the-making
Hi I tried to deploy process with rule, but it didn't work. Can you help?

private ProcessEngine createProcessEngineInMemory() {
        return ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
                .setDatabaseSchemaUpdate( ProcessEngineConfiguration.DB_SCHEMA_UPDATE_CREATE_DROP )
                .setJdbcUrl( "jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000" ).setJobExecutorActivate( true ).buildProcessEngine();
    }
private void deployBar( RepositoryService repositoryService ) {
        try {
            repositoryService
                    .createDeployment()
                    .addZipInputStream(
                        new ZipInputStream( new FileInputStream( "R:/MHServer2/mhcc.app.incidentservice.app/bpmn/Incident.bar" ) ) )
                    .deploy().getId();
        } catch ( FileNotFoundException e ) {
            theLog.error( IncidentServiceAppPlugin.theLogMarker, "%%%%%%%% exception: [ message={} ]", e.getMessage() );
        }
    }

private void test1() {

// Create process engine in memory
ProcessEngine processEngine = createProcessEngineInMemory();
RepositoryService repositoryService = processEngine.getRepositoryService();

//Deploy it
deployBar( repositoryService );

}

I got exception:
org.activiti.engine.ActivitiException: deployment 1 doesn't contain any rules

But I placed in the bar, the *.drl file.
Do you know what can be wrong?
7 REPLIES 7

frederikherema1
Star Contributor
Star Contributor
I see you are using StandaloneInMem configuration… Use a configuration-file instead where you actually define that you're going to use the rules. Example here:

https://svn.codehaus.org/activiti/activiti/trunk/modules/activiti-engine/src/test/resources/org/acti...


<property name="customPostDeployers">
      <list>
        <bean class="org.activiti.engine.impl.rules.RulesDeployer" />
      </list>
    </property>

mutcha
Champ in-the-making
Champ in-the-making
Hi,
Thank you for fast reply.
I tried it before to use configuration from file, but then should I use just "ProcessEngines.getDefaultProcessEngine()" ???
Because when I try to get process engine using this method then I got "null" without any exception or detailed message which could indicate what was wrong, that's why I left this approach and tried to configure the process engine in the code.

So solutions to my problem could be:
1. Setting custom post deployer from code, NOT from configuration. Is there some possibility to do this?
2. Try to find the reason, why I cannot get the process engine in the "file configuration" approach? How could I get some information about the error why the ProcessEngines.getDefaultProcessEngine() returns null ? Maybe I use wrong method? Maybe I should use some different than getDefaultProcessEngine() ?

frederikherema1
Star Contributor
Star Contributor
You can use ProcessEngineConfiguration.createProcessEngineFromResource(…) passing in your configuration-file containing the config.
Alternatively, If you want to use the ProcessEngines.getDefaultProcessEngine(), make sure the config-file is on the class path and is named activiti.cfg.xml.

By code it's also possible. This forces you to cast the ProcessEngineConfiguration to a ProcessEngineConfigurationImpl and calling setCustomPostDeployers()…

mutcha
Champ in-the-making
Champ in-the-making
Thanks, I will check all these possibilities,
And again, nice to see that support from Activiti team is so fast.
Regards.

frederikherema1
Star Contributor
Star Contributor
You're just lucky Smiley Wink

mutcha
Champ in-the-making
Champ in-the-making
Smiley Wink

Now I'm one step further, but it seems that during parsing of rule following exception occured:

: java.lang.NoSuchMethodError: org.antlr.runtime.Lexer.<init>(Lorg/antlr/runtime/CharStream;Lorg/antlr/runtime/RecognizerSharedStateSmiley WinkV
14:17:23.054 INFO  [p.application.0] System.out                [component=incidentservice]  at org.drools.lang.DRLLexer.<init>(DRLLexer.java:134)
14:17:23.054 INFO  [p.application.0] System.out                [component=incidentservice]  at org.drools.lang.DRLLexer.<init>(DRLLexer.java:131)
14:17:23.054 INFO  [p.application.0] System.out                [component=incidentservice]  at org.drools.compiler.DrlParser.getParser(DrlParser.java:287)
14:17:23.054 INFO  [p.application.0] System.out                [component=incidentservice]  at org.drools.compiler.DrlParser.parse(DrlParser.java:135)
14:17:23.055 INFO  [p.application.0] System.out                [component=incidentservice]  at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
14:17:23.055 INFO  [p.application.0] System.out                [component=incidentservice]  at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:394)
14:17:23.055 INFO  [p.application.0] System.out                [component=incidentservice]  at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:586)
14:17:23.055 INFO  [p.application.0] System.out                [component=incidentservice]  at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)

I have following jars which I suppose are needed for drools:
drools-compiler-5.3.0.Final.jar
drools-core-5.3.0.Final.jar
antlr-3.3.jar
antlr-runtime-3.3.jar

Do I use good jars? Or maybe in wrong versions or something? Or some are missing ?

frederikherema1
Star Contributor
Star Contributor
Looks like the drools-pom doesn't specify any versions for antlr. Try earlier versions…