问一个有关JBPM连MySQL数据库的问题,高手请进

06-05-10 liudc
环境: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文件,这个文件究竟应放在哪里呢?

banq
2006-05-11 17:58
hibernate.cfg.xml是放在classpath中,如web项目的WEB-INF/classes目录下

liudc
2006-05-12 09:43
> hibernate.cfg.xml是放在classpath中,如web项目的WEB-INF

> classes目录下

谢谢楼上。

我对ant不是太熟,不是太明白它把class文件放哪了,我估计是打成jar文件放在lib目录下。因为tomcat工程下的classes目录中只有两个文件:messages.properties、messages_fr.properties。

我把%jbpm_home%/src/config.files/ 下的hibernate.cfg.xml和ehcache.xml copy到如你所说的位置,错误照旧,真不知怎么回事,急死了!

可是我搜索了tomcat工程的lib目录也找不到hibernate.cfg.xml文件,ant把它放哪了?

liudc
2006-05-17 16:24
没有遇到这样的问题吗?

猜你喜欢