<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: jbpm, process definitions, jboss - looking for knowledge
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/carek">Piotr Tempes</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/597136#597136">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>one hundred thanks to you for this really great tutorial. I guess I'm now one step from reaching my target. However there's still one problem I can't handle - the persistence layer.  Maybe stack trace first:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>[code]</p><p>[2011:03:90 22:03:122:info] ResourceChangeNotification created</p><p>[2011:03:90 22:03:132:info] ResourceChangeScanner reconfigured with interval=60</p><p>[2011:03:90 22:03:132:info] ResourceChangeScanner created with default interval=60</p><p>[2011:03:90 22:03:132:debug] ResourceChangeNotification monitor added monitor=org.drools.io.impl.ResourceChangeScannerImpl@15a0305</p><p>[2011:03:90 22:03:134:debug] KnowledgeAgent building resource map</p><p>[2011:03:90 22:03:135:info] KnowledgeAgent created, with configuration:</p><p>monitorChangeSetEvents=true scanResources=true scanDirectories=true newInstance=true</p><p>[2011:03:90 22:03:140:info] KnowledgeAgent has started listening for ChangeSet notifications</p><p><span>(null: 3, 183): schema_reference.4: Failed to read schema document '</span><a class="jive-link-external-small" href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd</a><span>', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.</span></p><p>(null: 3, 183): cvc-elt.1: Cannot find the declaration of element 'change-set'.</p><p><span>(null: 4, 10): schema_reference.4: Failed to read schema document '</span><a class="jive-link-external-small" href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd</a><span>', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.</span></p><p><span>(null: 5, 196): schema_reference.4: Failed to read schema document '</span><a class="jive-link-external-small" href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd</a><span>', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.</span></p><p>[2011:03:90 22:03:565:info] KnowledgeAgent applying ChangeSet</p><p><span>[2011:03:90 22:03:578:debug] KnowledgeAgent notifier subscribing to resource=[UrlResource path='</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a><span>']</span></p><p><span>[2011:03:90 22:03:579:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@ad8659 to resource=[UrlResource path='</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a><span>']</span></p><p><span>[2011:03:90 22:03:579:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@4f459c to resource=[UrlResource path='</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a><span>']</span></p><p>[2011:03:90 22:03:580:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet</p><p><span>[2011:03:90 22:03:444:debug] KnowledgeAgent obtaining pkg resource=[UrlResource path='</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a><span>']</span></p><p>[2011:03:90 22:03:445:debug] KnowledgeAgent adding KnowledgeDefinitionsPackage defaultPackage</p><p>[2011:03:90 22:03:461:info] KnowledgeAgent new KnowledgeBase now built and in use</p><p>[2011:03:90 22:03:461:debug] KnowledgeAgent finished rebuilding KnowledgeBase using ChangeSet</p><p><span>[2011:03:90 22:03:462:debug] KnowledgeAgent unsubscribing from resource=[UrlResource path='</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a><span>']</span></p><p><span>[2011:03:90 22:03:462:debug] ResourceChangeNotification unsubscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@ad8659 to resource=[UrlResource path='</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a><span>']</span></p><p><span>[2011:03:90 22:03:462:debug] ResourceChangeScanner unsubcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@4f459c to resource=[UrlResource path='</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a><span>']</span></p><p><span>[2011:03:90 22:03:462:debug] ResourceChangeScanner resource=[UrlResource path='</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a><span>'] now has no subscribers</span></p><p>[2011:03:90 22:03:463:info] KnowledgeAgent has stopped listening for ChangeSet notifications</p><p>jbpm.console.directory property not found</p><p>Loading process from file system: Evaluation.bpmn</p><p>SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".</p><p>SLF4J: Defaulting to no-operation (NOP) logger implementation</p><p><span>SLF4J: See </span><a class="jive-link-external-small" href="http://www.slf4j.org/codes.html#StaticLoggerBinder" target="_blank">http://www.slf4j.org/codes.html#StaticLoggerBinder</a><span> for further details.</span></p><p>Exception in thread "main" java.lang.RuntimeException: Could not initialize stateful knowledge session: [PersistenceUnit: org.drools.persistence.jpa] Unable to build EntityManagerFactory</p><p>    at org.jbpm.integration.console.CommandDelegate.newStatefulKnowledgeSession(CommandDelegate.java:179)</p><p>    at org.jbpm.integration.console.CommandDelegate.getSession(CommandDelegate.java:187)</p><p>    at org.jbpm.integration.console.CommandDelegate.<init>(CommandDelegate.java:70)</p><p>    at org.jbpm.integration.console.CommandDelegate.main(CommandDelegate.java:293)</p><p>Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.drools.persistence.jpa] Unable to build EntityManagerFactory</p><p>    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)</p><p>    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)</p><p>    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)</p><p>    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)</p><p>    at org.jbpm.integration.console.CommandDelegate.newStatefulKnowledgeSession(CommandDelegate.java:125)</p><p>    ... 3 more</p><p>Caused by: org.hibernate.HibernateException: Could not find datasource</p><p>    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:79)</p><p>    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)</p><p>    at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)</p><p>    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)</p><p>    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)</p><p>    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)</p><p>    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)</p><p>    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)</p><p>    ... 7 more</p><p>Caused by: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]</p><p>    at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1678)</p><p>    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1795)</p><p>    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:693)</p><p>    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)</p><p>    at javax.naming.InitialContext.lookup(InitialContext.java:409)</p><p>    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)</p><p>    ... 14 more</p><p>Caused by: java.net.SocketTimeoutException: Receive timed out</p><p>    at java.net.PlainDatagramSocketImpl.receive0(Native Method)</p><p>    at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:135)</p><p>    at java.net.DatagramSocket.receive(DatagramSocket.java:729)</p><p>    at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1647)</p><p>    ... 19 more</p><p>[/code]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have no idea why the database couldn't be reached... I started h2 and I can access it through let's say jpa plugin in eclipse, I started jboss. Configuration files I took from db directory in jboss. Here they are:</p><p>META-INF/persistence.xml:</p><p>[code]</p><p><?xml version="1.0" encoding="UTF-8" standalone="yes"?></p><p><persistence version="1.0"</p><p><span>             xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a></p><p><span>                                 </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" target="_blank">http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd</a></p><p><span>                                 </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm" target="_blank">http://java.sun.com/xml/ns/persistence/orm</a><span> </span></p><p><span>                                 </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" target="_blank">http://java.sun.com/xml/ns/persistence/orm_1_0.xsd</a><span>"</span></p><p><span>             xmlns:orm="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm" target="_blank">http://java.sun.com/xml/ns/persistence/orm</a><span>"</span></p><p><span>             xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"</span></p><p><span>             xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a><span>"></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  <persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA"></p><p>    <provider>org.hibernate.ejb.HibernatePersistence</provider></p><p>    <jta-data-source>java:jdbc/testDS1</jta-data-source></p><p>    <!-- <jta-data-source>jdbc:h2:tcp://localhost/~/test</jta-data-source> --></p><p>    <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class></p><p>    <class>org.drools.persistence.info.SessionInfo</class></p><p>    <class>org.drools.persistence.info.WorkItemInfo</class></p><p>    <properties></p><p>      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>            </p><p>      <property name="hibernate.max_fetch_depth" value="3"/></p><p>      <property name="hibernate.hbm2ddl.auto" value="create" /></p><p>      <property name="hibernate.show_sql" value="false" />    </p><p>      <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /></p><p>    </properties>        </p><p>  </persistence-unit></p><p>    </p><p></persistence></p><p>[/code]</p><p>hibernate.cfg.xml:</p><p>[code]</p><p><?xml version='1.0' encoding='utf-8'?></p><p><!DOCTYPE hibernate-configuration PUBLIC</p><p>        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"</p><p><span>        "</span><a class="jive-link-external-small" href="http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" target="_blank">http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd</a><span>"></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><hibernate-configuration></p><p>    <session-factory></p><p>        <property name="connection.driver_class">org.h2.Driver</property></p><p>        <property name="connection.url">jdbc:h2:tcp://localhost/~/test</property></p><p>        <!--property name="connection.url">jdbc:h2:file:/NotBackedUp/data/mydb</property--></p><p>        <property name="connection.username">sa</property></p><p>        <property name="connection.password"></property></p><p>        <property name="connection.pool_size">1</property></p><p>        <property name="dialect">org.hibernate.dialect.H2Dialect</property></p><p>        <property name="current_session_context_class">thread</property></p><p>        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property></p><p>        <property name="show_sql">false</property></p><p>        <property name="hbm2ddl.auto">create</property></p><p>        <mapping resource="AuditLog.hbm.xml"/></p><p>    </session-factory></p><p></hibernate-configuration></p><p>[/code]</p><p>and from jboss db directory testDS1-ds.xml:</p><p>[code]</p><p><?xml version="1.0" encoding="UTF-8"?></p><p><datasources></p><p>  <local-tx-datasource></p><p>    <jndi-name>jdbc/testDS1</jndi-name></p><p>    <connection-url>jdbc:h2:tcp://localhost/~/test</connection-url></p><p>    <!--connection-url>jdbc:h2:mem:mydb</connection-url--></p><p>    <driver-class>org.h2.jdbcx.JdbcDataSource</driver-class></p><p>    <user-name>sa</user-name></p><p>    <password></password></p><p>  </local-tx-datasource></p><p></datasources></p><p>[/code]</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/597136#597136">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>