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:
[code]
[2011:03:90 22:03:122:info] ResourceChangeNotification created
[2011:03:90 22:03:132:info] ResourceChangeScanner reconfigured with interval=60
[2011:03:90 22:03:132:info] ResourceChangeScanner created with default interval=60
[2011:03:90 22:03:132:debug] ResourceChangeNotification monitor added monitor=org.drools.io.impl.ResourceChangeScannerImpl@15a0305
[2011:03:90 22:03:134:debug] KnowledgeAgent building resource map
[2011:03:90 22:03:135:info] KnowledgeAgent created, with configuration:
monitorChangeSetEvents=true scanResources=true scanDirectories=true newInstance=true
[2011:03:90 22:03:140:info] KnowledgeAgent has started listening for ChangeSet notifications
(null: 3, 183): schema_reference.4: Failed to read schema document 'http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd', 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>.
(null: 3, 183): cvc-elt.1: Cannot find the declaration of element 'change-set'.
(null: 4, 10): schema_reference.4: Failed to read schema document 'http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd', 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>.
(null: 5, 196): schema_reference.4: Failed to read schema document 'http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd', 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>.
[2011:03:90 22:03:565:info] KnowledgeAgent applying ChangeSet
[2011:03:90 22:03:578:debug] KnowledgeAgent notifier subscribing to resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
[2011:03:90 22:03:579:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@ad8659 to resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
[2011:03:90 22:03:579:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@4f459c to resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
[2011:03:90 22:03:580:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
[2011:03:90 22:03:444:debug] KnowledgeAgent obtaining pkg resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
[2011:03:90 22:03:445:debug] KnowledgeAgent adding KnowledgeDefinitionsPackage defaultPackage
[2011:03:90 22:03:461:info] KnowledgeAgent new KnowledgeBase now built and in use
[2011:03:90 22:03:461:debug] KnowledgeAgent finished rebuilding KnowledgeBase using ChangeSet
[2011:03:90 22:03:462:debug] KnowledgeAgent unsubscribing from resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
[2011:03:90 22:03:462:debug] ResourceChangeNotification unsubscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@ad8659 to resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
[2011:03:90 22:03:462:debug] ResourceChangeScanner unsubcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@4f459c to resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
[2011:03:90 22:03:462:debug] ResourceChangeScanner resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST'] now has no subscribers
[2011:03:90 22:03:463:info] KnowledgeAgent has stopped listening for ChangeSet notifications
jbpm.console.directory property not found
Loading process from file system: Evaluation.bpmn
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.RuntimeException: Could not initialize stateful knowledge session: [PersistenceUnit: org.drools.persistence.jpa] Unable to build EntityManagerFactory
at org.jbpm.integration.console.CommandDelegate.newStatefulKnowledgeSession(CommandDelegate.java:179)
at org.jbpm.integration.console.CommandDelegate.getSession(CommandDelegate.java:187)
at org.jbpm.integration.console.CommandDelegate.<init>(CommandDelegate.java:70)
at org.jbpm.integration.console.CommandDelegate.main(CommandDelegate.java:293)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.drools.persistence.jpa] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at org.jbpm.integration.console.CommandDelegate.newStatefulKnowledgeSession(CommandDelegate.java:125)
... 3 more
Caused by: org.hibernate.HibernateException: Could not find datasource
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:79)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 7 more
Caused by: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1678)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1795)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:693)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:409)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
... 14 more
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:135)
at java.net.DatagramSocket.receive(DatagramSocket.java:729)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1647)
... 19 more
[/code]
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:
META-INF/persistence.xml:
[code]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jdbc/testDS1</jta-data-source>
<!-- <jta-data-source>jdbc:h2:tcp://localhost/~/test</jta-data-source> -->
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
</properties>
</persistence-unit>
</persistence>
[/code]
hibernate.cfg.xml:
[code]
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">org.h2.Driver</property>
<property name="connection.url">jdbc:h2:tcp://localhost/~/test</property>
<!--property name="connection.url">jdbc:h2:file:/NotBackedUp/data/mydb</property-->
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="connection.pool_size">1</property>
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="show_sql">false</property>
<property name="hbm2ddl.auto">create</property>
<mapping resource="AuditLog.hbm.xml"/>
</session-factory>
</hibernate-configuration>
[/code]
and from jboss db directory testDS1-ds.xml:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/testDS1</jndi-name>
<connection-url>jdbc:h2:tcp://localhost/~/test</connection-url>
<!--connection-url>jdbc:h2:mem:mydb</connection-url-->
<driver-class>org.h2.jdbcx.JdbcDataSource</driver-class>
<user-name>sa</user-name>
<password></password>
</local-tx-datasource>
</datasources>
[/code]