問一個有關JBPM連MySQL資料庫的問題,高手請進

liudc發表於2006-05-10
環境:JDK:j2sdk1.4.2
Tomcat:5.0
JBPM:3.1.1
MySQL:5.0
我想讓方法getInstance()查詢jbpm.hibernate.cfg.xml的值,用該值作為配置檔案建立一個JbpmSessionFactory,所以我的jbpm.properties檔案是這樣的:

jbpm.scheduler.service.factory=org.jbpm.scheduler.impl.SchedulerServiceImpl
jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance

# uncomment the next line if JbpmSessionFactory.getInstance()
# should lookup the singleton instance from JNDI instead of creating
# a default one.
#
jbpm.session.factory.jndi.name=java:comp/env/jdbc/jbpm

# uncomment the next line to use the file system instead of the database for
# storing files related to a process definition
#
# jbpm.files.dir=c:/jbpm.data

# resource path to a properties file that will overwrite all the hibernate
# properties. For database specific builds in db project there is a different
# hibernate.properties file on the classpath for each database. You could change
# the default database for any testing runs by uncommenting the next line and
# adding a hibernate.properties file in the basedir.
#
jbpm.hibernate.cfg.xml=jbpm.hibernate.cfg.xml
jbpm.hibernate.properties=jbpm.hibernate.properties

jbpm.hibernate.properties檔案中的內容全部註釋掉,之後用ant生成jbpm.war,部署到tomcat中,啟動時出現以下異常:

2006-5-10 15:28:09 org.jbpm.msg.command.CommandExecutorThread run
嚴重: java.lang.NoClassDefFoundError: org/hibernate/Session
2006-5-10 15:28:09 org.apache.catalina.core.StandardHostDeployer install
資訊: Installing web application at context path /tomcat-docs from URL file:D:\T
omcat 5.0\webapps\tomcat-docs
2006-5-10 15:28:09 org.apache.catalina.core.StandardHostDeployer install
資訊: Installing web application at context path /jsp-examples from URL file:D:\
Tomcat 5.0\webapps\jsp-examples
2006-5-10 15:28:10 org.apache.catalina.core.StandardHostDeployer install
資訊: Installing web application at context path /servlets-examples from URL fil
e:D:\Tomcat 5.0\webapps\servlets-examples
java.lang.NoClassDefFoundError: org/hibernate/Session
at org.jbpm.persistence.db.DbPersistenceServiceFactory.openService(DbPer
sistenceServiceFactory.java:55)
at org.jbpm.svc.Services.getService(Services.java:136)
at org.jbpm.svc.Services.getPersistenceService(Services.java:175)
at org.jbpm.JbpmContext.getPersistenceService(JbpmContext.java:515)
at org.jbpm.JbpmContext.getSchedulerSession(JbpmContext.java:423)
at org.jbpm.scheduler.impl.SchedulerThread.executeTimers(SchedulerThread
.java:103)
at org.jbpm.scheduler.impl.SchedulerThread.run(SchedulerThread.java:70)
2006-5-10 15:28:14 org.jbpm.msg.command.CommandExecutorThread run
嚴重: java.lang.NoClassDefFoundError: org/hibernate/Session
2006-5-10 15:28:47 org.apache.catalina.core.StandardHostDeployer install
資訊: Installing web application at context path /webdav from URL file:D:\Tomcat
5.0\webapps\webdav
2006-5-10 15:28:48 org.apache.catalina.core.StandardHostDeployer install
資訊: Installing web application at context path /bgzdh from URL file:D:\Tomcat
5.0\webapps\bgzdh
2006-5-10 15:28:50 org.apache.coyote.http11.Http11Protocol start
資訊: Starting Coyote HTTP/1.1 on port 80
2006-5-10 15:28:51 org.apache.jk.common.ChannelSocket init
資訊: JK2: ajp13 listening on /0.0.0.0:8009
2006-5-10 15:28:51 org.apache.jk.server.JkMain start
資訊: Jk running ID=0 time=20/110 config=D:\Tomcat 5.0\conf\jk2.properties
2006-5-10 15:28:51 org.apache.catalina.startup.Catalina start
資訊: Server startup in 80886 ms
2006-5-10 15:28:52 org.jbpm.msg.command.CommandExecutorThread run
嚴重: java.lang.NoClassDefFoundError: org/hibernate/Session
2006-5-10 15:28:57 org.jbpm.msg.command.CommandExecutorThread run
嚴重: java.lang.NoClassDefFoundError: org/hibernate/Session
2006-5-10 15:29:02 org.jbpm.msg.command.CommandExecutorThread run
嚴重: java.lang.NoClassDefFoundError: org/hibernate/Session
2006-5-10 15:29:07 org.jbpm.msg.command.CommandExecutorThread run
嚴重: java.lang.NoClassDefFoundError: org/hibernate/Session

執行http://localhost/jbpm後出現以下異常:
javax.servlet.ServletException: org.apache.jasper.JasperException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:109)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:712)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:682)
org.apache.jsp.index_jsp._jspService(index_jsp.java:46)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.jbpm.webapp.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:55)
org.jbpm.web.JbpmContextFilter.doFilter(JbpmContextFilter.java:83)
org.jbpm.webapp.filter.LogFilter.doFilter(LogFilter.java:59)


root cause

javax.faces.FacesException: org.apache.jasper.JasperException
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:425)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:712)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:682)
org.apache.jsp.index_jsp._jspService(index_jsp.java:46)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.jbpm.webapp.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:55)
org.jbpm.web.JbpmContextFilter.doFilter(JbpmContextFilter.java:83)
org.jbpm.webapp.filter.LogFilter.doFilter(LogFilter.java:59)


note The full stack trace of the root cause is available in the Tomcat logs.

請問這是怎麼回事啊?我覺得是jbpm沒有連線上資料庫,可能是沒有找到hibernate.cfg.xml檔案,這個檔案究竟應放在哪裡呢?

相關文章