Hi Leon,

This definitely seems to be a problem with the database connector; the error 
messages you get are typically the sort you get when JPA can't connect to the 
database properly.

Sometimes - depending on the version of Tomcat - it seems necessary to create 
your context info into a "wookie.xml" file and place into /conf, e.g.:

<Context crossContext="true">

  <Resource name="jdbc/widgetdb"
            auth="Container"
            type="javax.sql.DataSource"
            maxActive="80"
            maxIdle="5"
            username="java"
            password="java"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/widgetdb"/>

</Context>

Also make sure you have the MySQL driver jar in the classpath. E.g. that you 
have mysql-connector-java-5.0.7-bin.jar in /lib.

Hope this helps, also see instructions here:

http://incubator.apache.org/wookie/docs/developer/running.html

S


On 31 Oct 2012, at 23:54, Leon Wu wrote:

> Hello,
> 
> I've import the Wookie in Eclipse, but I cannot make it work for me?
> 
> I've created JNDI for the DataSource in META-INF/context.xml, settings in
> web.xml, widget.persistence.manager.dbtype=mysql in
> widgetserver.properties, and tables in MySQL. However, I am persistently
> getting two exceptions when Tomcat is starting. Please help me to fix the
> problems. Thank you very much.
> 
> Here are the exceptions:
> 
> 28.10.2012 22:31:14 INFO
> [org.apache.wookie.beans.jpa.JPAPersistenceManager.initialize():248]
> Initialized
> 
> 28.10.2012 22:31:14 INFO
> [org.apache.openjpa.lib.log.Log4JLogFactory$LogAdapter.info():81] Starting
> OpenJPA 2.0.0
> 
> 28.10.2012 22:31:14 INFO
> [org.apache.openjpa.lib.log.Log4JLogFactory$LogAdapter.info():81] Using
> dictionary class "org.apache.openjpa.jdbc.sql.MySQLDictionary".
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.core.StandardContext
> listenerStart
> 
> SEVERE: Exception sending context initialized event to listener instance of
> class org.apache.wookie.server.ContextListener
> 
> java.lang.IllegalStateException: Transaction not initiated or already
> closed
> 
> at org.apache.wookie.beans.jpa.JPAPersistenceManager.close(
> JPAPersistenceManager.java:309)
> 
> at
> org.apache.wookie.beans.util.PersistenceManagerFactory.closePersistenceManager(
> PersistenceManagerFactory.java:213)
> 
> at org.apache.wookie.beans.util.PersistenceManagerFactory.initialize(
> PersistenceManagerFactory.java:157)
> 
> at org.apache.wookie.server.ContextListener.contextInitialized(
> ContextListener.java:110)
> 
> at org.apache.catalina.core.StandardContext.listenerStart(
> StandardContext.java:4791)
> 
> at org.apache.catalina.core.StandardContext.startInternal(
> StandardContext.java:5285)
> 
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> 
> at org.apache.catalina.core.ContainerBase.addChildInternal(
> ContainerBase.java:901)
> 
> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
> 
> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
> 
> at org.apache.catalina.startup.HostConfig.deployDescriptor(
> HostConfig.java:650)
> 
> at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(
> HostConfig.java:1582)
> 
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
> 
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
> ThreadPoolExecutor.java:886)
> 
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:908)
> 
> at java.lang.Thread.run(Thread.java:680)
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.core.StandardContext
> startInternal
> 
> SEVERE: Error listenerStart
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.core.StandardContext
> startInternal
> 
> SEVERE: Context [/woookie] startup failed due to previous errors
> 
> 28.10.2012 22:31:14 INFO
> [org.apache.wookie.beans.jpa.JPAPersistenceManager.terminate():273]
> Terminated
> 
> 28.10.2012 22:31:14 INFO
> [org.apache.wookie.beans.util.PersistenceManagerFactory.terminate():247]
> Terminated
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.loader.WebappClassLoader
> checkThreadLocalMapForLeaks
> 
> SEVERE: The web application [/woookie] created a ThreadLocal with key of
> type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@65988886]) and a
> value of type [org.apache.wookie.beans.jpa.JPAPersistenceManager] (value
> [org.apache.wookie.beans.jpa.JPAPersistenceManager@12b4986]) but failed to
> remove it when the web application was stopped. Threads are going to be
> renewed over time to try and avoid a probable memory leak.
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> 
> INFO: Deploying web application directory
> /Library/Tomcat/apache-tomcat-7.0.29/webapps/docs
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> 
> INFO: Deploying web application directory
> /Library/Tomcat/apache-tomcat-7.0.29/webapps/examples
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.core.ApplicationContext log
> 
> INFO: ContextListener: contextInitialized()
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.core.ApplicationContext log
> 
> INFO: SessionListener: contextInitialized()
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.core.ApplicationContext log
> 
> INFO: ContextListener:
> attributeAdded('org.apache.jasper.compiler.TldLocationsCache',
> 'org.apache.jasper.compiler.TldLocationsCache@dc44a6d')
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> 
> INFO: Deploying web application directory
> /Library/Tomcat/apache-tomcat-7.0.29/webapps/host-manager
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.loader.WebappClassLoader
> loadClass
> 
> INFO: Illegal access: this web application instance has been stopped
> already. Could not load org.apache.openjpa.kernel.ManagedCache. The
> eventual following stack trace is caused by an error thrown for debugging
> purposes as well as to attempt to terminate the thread which caused the
> illegal access, and has no functional impact.
> 
> java.lang.IllegalStateException
> 
> at org.apache.catalina.loader.WebappClassLoader.loadClass(
> WebappClassLoader.java:1597)
> 
> at org.apache.catalina.loader.WebappClassLoader.loadClass(
> WebappClassLoader.java:1556)
> 
> at org.apache.openjpa.kernel.BrokerImpl.free(BrokerImpl.java:4303)
> 
> at org.apache.openjpa.kernel.FinalizingBrokerImpl.finalize(
> FinalizingBrokerImpl.java:39)
> 
> at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
> 
> at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
> 
> at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
> 
> at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
> 
> Oct 28, 2012 10:31:14 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> 
> INFO: Deploying web application directory
> /Library/Tomcat/apache-tomcat-7.0.29/webapps/manager
> 
> Oct 28, 2012 10:31:15 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> 
> INFO: Deploying web application directory
> /Library/Tomcat/apache-tomcat-7.0.29/webapps/ROOT
> 
> Oct 28, 2012 10:31:15 PM org.apache.coyote.AbstractProtocol start

Reply via email to