-
CXF+spring+hibernate客户端调用总出错3
问题在这里:
http://www.iteye.com/problems/2056
因为不会用这个javaeye,没有回复自己的提问,点错了,把回复上一人的答案,所以只好点了采纳答案给结了贴!
请各位帮帮忙!
正如前面的贴子我也加入了cjlig包但还是有错误:
2008-7-31 12:54:51 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
信息: Application has thrown exception, unwinding now: Error creating bean with name sessionFactory defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
问题补充:
这个我已经都加入,问题已经解决上面的问题!一个是因为我的cxf用的是cxf-2.1.1.jar
所以要用asm-2.2.3.jar包,并且要把asm.jar,asm-attrs.jar包删掉!不然冲突!
但现在客户端连接的时候出现以下错误:
2008-8-1 9:26:46 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1374765: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1374765]; startup date [Fri Aug 01 09:26:46 CST 2008]; root of context hierarchy
2008-8-1 9:26:46 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [applicationContext.xml]
2008-8-1 9:26:46 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@1374765]: org.springframework.beans.factory.support.DefaultListableBeanFactory@10ad7c
2008-8-1 9:26:46 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@10ad7c: defining beans [spingSF,JobseekeruserDAO,transactionManager,personDao]; root of factory hierarchy
2008-8-1 9:26:47 org.hibernate.cfg.annotations.Version <clinit>
信息: Hibernate Annotations 3.3.0.GA
2008-8-1 9:26:47 org.hibernate.cfg.Environment <clinit>
信息: Hibernate 3.2.5
2008-8-1 9:26:47 org.hibernate.cfg.Environment <clinit>
信息: hibernate.properties not found
2008-8-1 9:26:47 org.hibernate.cfg.Environment buildBytecodeProvider
信息: Bytecode provider name : cglib
2008-8-1 9:26:47 org.hibernate.cfg.Environment <clinit>
信息: using JDK 1.4 java.sql.Timestamp handling
2008-8-1 9:26:47 org.hibernate.cfg.Configuration configure
信息: configuring from url: file:/F:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/hib3/WEB-INF/classes/hibernate.cfg.xml
2008-8-1 9:26:47 org.hibernate.cfg.Configuration addResource
信息: Reading mappings from resource : com/spingDao/Jobseekeruser.hbm.xml
2008-8-1 9:26:48 org.hibernate.cfg.Configuration doConfigure
信息: Configured SessionFactory: null
2008-8-1 9:26:48 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@10ad7c: defining beans [spingSF,JobseekeruserDAO,transactionManager,personDao]; root of factory hierarchy
2008-8-1 9:26:48 com.spingDao.JobseekeruserDAO findAll
严重: find all failed
java.lang.NullPointerException
at com.spingDao.JobseekeruserDAO.findAll(JobseekeruserDAO.java:128)
at com.spingDao.cxfWebServerImpl.getJobseekeruser(cxfWebServerImpl.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:136)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:97)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:279)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:161)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:174)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
2008-8-1 9:26:48 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
信息: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:119)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.createFault(JAXWSMethodInvoker.java:73)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:107)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:97)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:279)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:161)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:174)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.spingDao.JobseekeruserDAO.findAll(JobseekeruserDAO.java:128)
at com.spingDao.cxfWebServerImpl.getJobseekeruser(cxfWebServerImpl.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:136)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
... 26 more
总是说:信息: Configured SessionFactory: null
不知道这个应该是不是要在web.xml里配置什么吗?
而我的web.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
而bean.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!-- START SNIPPET: beans -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint id="cxfWebServer"
implementor="com.spingDao.cxfWebServerImpl" address="/cxfWebServer">
</jaxws:endpoint>
</beans>
问题补充:
package com.spingDao;
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.orm.toplink.SessionFactory;
/**
* A data access object (DAO) providing persistence and search support for
* Jobseekeruser entities. Transaction control of the save(), update() and
* delete() operations can directly support Spring container-managed
* transactions or they can be augmented to handle user-managed Spring
* transactions. Each of these methods provides additional information for how
* to configure it for the desired type of transaction control.
*
* @see com.spingDao.Jobseekeruser
* @author MyEclipse Persistence Tools
*/
public class JobseekeruserDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(JobseekeruserDAO.class);
// property constants
public static final String JOBSEEKERLOGIN = "jobseekerlogin";
public static final String JOBSEEKERCODE = "jobseekercode";
public static final String EMAIL = "email";
public static final String PASSWORD = "password";
public static final String CHECKSTATUS = "checkstatus";
public static final String EMAILSTATUS = "emailstatus";
protected void initDao() {
// do nothing
}
public void save(Jobseekeruser transientInstance) {
log.debug("saving Jobseekeruser instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Jobseekeruser persistentInstance) {
log.debug("deleting Jobseekeruser instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Jobseekeruser findById(java.lang.Long id) {
log.debug("getting Jobseekeruser instance with id: " + id);
try {
Jobseekeruser instance = (Jobseekeruser) getHibernateTemplate()
.get("com.spingDao.Jobseekeruser", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Jobseekeruser instance) {
log.debug("finding Jobseekeruser instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Jobseekeruser instance with property: "
+ propertyName + ", value: " + value);
try {
String queryString = "from Jobseekeruser as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByJobseekerlogin(Object jobseekerlogin) {
return findByProperty(JOBSEEKERLOGIN, jobseekerlogin);
}
public List findByJobseekercode(Object jobseekercode) {
return findByProperty(JOBSEEKERCODE, jobseekercode);
}
public List findByEmail(Object email) {
return findByProperty(EMAIL, email);
}
public List findByPassword(Object password) {
return findByProperty(PASSWORD, password);
}
public List findByCheckstatus(Object checkstatus) {
return findByProperty(CHECKSTATUS, checkstatus);
}
public List findByEmailstatus(Object emailstatus) {
return findByProperty(EMAILSTATUS, emailstatus);
}
public List findAll() {
log.debug("finding all Jobseekeruser instances");
try {
String queryString = "from Jobseekeruser";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Jobseekeruser merge(Jobseekeruser detachedInstance) {
log.debug("merging Jobseekeruser instance");
try {
Jobseekeruser result = (Jobseekeruser) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Jobseekeruser instance) {
log.debug("attaching dirty Jobseekeruser instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Jobseekeruser instance) {
log.debug("attaching clean Jobseekeruser instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static JobseekeruserDAO getFromApplicationContext(
ApplicationContext ctx) {
return (JobseekeruserDAO) ctx.getBean("JobseekeruserDAO");
}
}
问题补充:
什么都没有!只是hibernate自动生成的方法!
问题补充:
刚刚把问题以上的JobseekeruserDAO改了一下:
public static JobseekeruserDAO getFromApplicationContext(
ApplicationContext ctx) {
return (JobseekeruserDAO) ctx.getBean("personDao"); ---- 这里和配置文件不一样,写错了,原因是加了事务!没有和配置一样
}
但是还是出错以下错误:
2008-8-1 11:05:26 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet CXFServlet threw exception
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:78)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:279)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:161)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:174)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
问题补充:
提交得太快,问题还是一样:
信息: Configured SessionFactory: null
问题补充:
代码是这样写的:
public Jobseekeruser getJobseekeruser(long id) {
ApplicationContext ap = new ClassPathXmlApplicationContext(
"applicationContext.xml");
System.out.println("insert Start oK!");
JobseekeruserDAO jdo = (JobseekeruserDAO) ap.getBean("personDao");
//JobseekeruserDAO jdo = new JobseekeruserDAO();
// TODO Auto-generated method stub
return (Jobseekeruser) jdo.findAll().get(0);
}
应该已经注入了吧?
问题补充:
我在Tomcat中打印出来的。
2008-8-1 13:49:21 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@135fd95: display name [org.springframework.context.support.ClassPathXmlApplicationContext@135fd95]; startup date [Fri Aug 01 13:49:21 CST 2008]; root of context hierarchy
2008-8-1 13:49:21 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [applicationContext.xml]
2008-8-1 13:49:21 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@135fd95]: org.springframework.beans.factory.support.DefaultListableBeanFactory@f1735
2008-8-1 13:49:21 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@f1735: defining beans [spingSF,JobseekeruserDAO,transactionManager,personDao]; root of factory hierarchy
2008-8-1 13:49:21 org.hibernate.cfg.Configuration configure
信息: configuring from url: file:/F:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/hib3/WEB-INF/classes/hibernate.cfg.xml
2008-8-1 13:49:21 org.hibernate.cfg.Configuration addResource
信息: Reading mappings from resource : com/spingDao/Jobseekeruser.hbm.xml
2008-8-1 13:49:21 org.hibernate.cfg.Configuration doConfigure
信息: Configured SessionFactory: null
2008-8-1 13:49:21 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@f1735: defining beans [spingSF,JobseekeruserDAO,transactionManager,personDao]; root of factory hierarchy
2008-8-1 13:49:21 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1c47dd5: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1c47dd5]; startup date [Fri Aug 01 13:49:21 CST 2008]; root of context hierarchy
2008-8-1 13:49:21 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [applicationContext.xml]
2008-8-1 13:49:21 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@1c47dd5]: org.springframework.beans.factory.support.DefaultListableBeanFactory@10f8ed
2008-8-1 13:49:21 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@10f8ed: defining beans [spingSF,JobseekeruserDAO,transactionManager,personDao]; root of factory hierarchy
2008-8-1 13:49:21 org.hibernate.cfg.Configuration configure
信息: configuring from url: file:/F:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/hib3/WEB-INF/classes/hibernate.cfg.xml
2008-8-1 13:49:21 org.hibernate.cfg.Configuration addResource
信息: Reading mappings from resource : com/spingDao/Jobseekeruser.hbm.xml
2008-8-1 13:49:21 org.hibernate.cfg.Configuration doConfigure
信息: Configured SessionFactory: null===========这里!!!
2008-8-1 13:49:21 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@10f8ed: defining beans [spingSF,JobseekeruserDAO,transactionManager,personDao]; root of factory hierarchy
2008-8-1 13:49:21 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
信息: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Error creating bean with name 'spingSF' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/JoinTable
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:119)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.createFault(JAXWSMethodInvoker.java:73)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:107)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:97)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:279)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:161)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:174)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spingSF' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/JoinTable
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.spingDao.cxfWebServerImpl.getJobseekeruser(cxfWebServerImpl.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:136)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
... 26 more
Caused by: java.lang.NoClassDefFoundError: javax/persistence/JoinTable
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:263)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:673)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
... 47 more
Caused by: java.lang.ClassNotFoundException: javax.persistence.JoinTable
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 53 more
问题补充:
后面的信息:
信息: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Error creating bean with name 'spingSF' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/JoinTable
问题补充:
这个我也不明白!但我可以看到值已经传回到服务端!
就是存取的时候出问题!看来是spring的问题!或者是如llade说的一样!
但是我现在还是不明白是那里出了问题!
在服务端写的测试也可以通过,但到了客户端为什么不可以,
public boolean insertData(Jobseekeruser user) {
try {
System.out.println(user.getEmail());
jobseekeruserDAO.save(user);
} catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
System.out.println("kdkd");
return false;
}
return true;
}
如方法改成了这样,在服务端的打印出来这样:
4454667@126.com
null
kdkd
2008-8-1 16:05:41 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
信息: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:119)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.createFault(JAXWSMethodInvoker.java:73)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:107)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:97)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:279)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:161)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:174)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.spingDao.cxfWebServerImpl.getJobseekeruser(cxfWebServerImpl.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:136)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
... 26 more
问题补充:
都为空呀!
现在我按别人给的提示但我回传给服务器的时候怎么是long型的数据全为null
但是是String的就有
问题补充:
问题得到了 lggege 的提示问题基本上解决,现在的问题是只要我的jobseekeruser里的一些字段为long型的,传到服务端时都为null了,但在客户端的时候是有值,而其他为string的都可以传到服务端!不知道大家有没有碰到这样的问题!
问题补充:
问题都解决了!原来是C#代码写得有问题,附值时还要把对应的更新让系统知道把对应的 Specified = true;2008年7月31日 11:12
8个答案 按时间排序 按投票排序
-
采纳的答案
感觉用了spring就在spring配置Hibernate的设置好了。不用搞他的cfg.xml。
你的配置管理有点混乱。不大好猜问题出在哪。上面你的错误是:javax/persistence/JoinTable 这个类找不到啊。看看jar是否冲突或者classpath是否正确。
一个灵活的spring配置例子,你可以参考一下。在spring配置能做完的事情一般就不要在其他地方做了:<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:mysql://standard:3306/yourdb?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8</value> </property> <property name="username"> <value>user</value> </property> <property name="password"> <value>password</value> </property> <property name="maxActive"> <value>40</value> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.cache.provider_class">com.opensymphony.oscache.hibernate.OSCacheProvider</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.use_query_cache">true</prop> </props> </property> <property name="mappingDirectoryLocations"> <list> <value>WEB-INF/mappings/core</value><!--把mapping文件放在这些目录即可,或者如下的classpath目录下也行--> <!-- <value>classpath:com/your/vo/hibernate/</value> --> </list> </property> </bean> <bean id="commonDAO" class="com.your.dao.CommonDAOImpl"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <!-- 使用事务的DAO,把注释去掉,注释上面那个DAO就可以了。 <bean id="commonDAO" parent="baseTransactionProxy"> <property name="target"> <bean class="com.your.dao.CommonDAOImpl"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> </property> </bean> --> <!--如果必要,加上事务--> <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true" lazy-init="default" autowire="default" dependency-check="default"> <property name="transactionManager"> <ref bean="transactionManager"/> </property> <property name="transactionAttributes"> <props> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="set*">PROPAGATION_REQUIRED</prop> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> <property name="optimize"> <value>true</value> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" lazy-init="default" autowire="default" dependency-check="default"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean>
2008年8月01日 14:31
-
System.out.println(ex.getLocalizedMessage());
打印出来是Null?
那用ex.pringStackTrace();呢?2008年8月01日 16:48
-
同意楼上的说法 cglib-nodep-2.1_3.jar 将asm 包含到了cglib中了, 这样既不能能解决CXF asm 和 cglib asm的版本冲突问题。
2008年8月01日 08:28
相关推荐
总的来说,"cxf+spring+hibernate整合添加功能实现修改版"是一个提升系统稳定性和性能的实践案例,开发者通过深入理解和灵活运用这三个技术,实现了服务功能的优化。对于学习和研究Java企业级应用开发的人员来说,这...
总结来说,这个项目展示了如何利用CXF、Spring和Hibernate这三大框架实现一个完整的Web服务,涵盖了从数据层到服务层再到客户端调用的全过程。对于学习者来说,这是一个很好的实践案例,有助于深入理解这些框架的...
在结合 Spring 框架使用时,CXF 可以方便地与 Spring 集成,实现服务的发布和调用。Spring 可以管理 CXF 组件的生命周期,提供事务、安全等服务,并通过配置简化服务的实现。 **一、搭建开发环境** 1. **选择依赖...
在IT行业中,CXF、Spring和Hibernate是三个非常重要的开源框架,它们分别在Web服务、依赖管理和持久化层发挥着关键作用。这个压缩包文件"CXF接口Spring+Hibernate的添加完整版"提供了将这三个技术整合在一起的一个...
Struts2+Spring3+Hibernate4+Maven+EasyUI+CXF 是一个经典的Java Web开发框架集成,常用于构建高效、稳定的企业级应用。这个整合涵盖了前端展示、后端控制、持久化、依赖注入、项目管理和Web服务等多个层面,为...
【标题】:“cxf+hibernate3.0+spring3.0 完整整合代码实现” 【描述】:“此项目实现了将CXF、Hibernate3.0和Spring3.0这三个开源框架集成到一起,提供了在WebLogic和Tomcat两种应用服务器上的无缝兼容。” ...
同时,配置WSDL文件生成和发布,以便客户端能够发现和调用服务。 6. **测试与调试**: 使用JUnit进行单元测试,验证服务功能的正确性。对于Web服务,可以使用 SoapUI 这样的工具进行功能测试和性能测试。 7. **...
【标题】"cxf-spring 服务端and客户端"揭示了这个项目是关于Apache CXF框架与Spring框架的集成,用于构建服务端和客户端应用程序。Apache CXF是一个开源的Java框架,它允许开发者创建和消费Web服务,而Spring框架则...
【标题】"基于CXF+servlet整合spring接口系统"揭示了这个项目的核心是构建一个集成了Spring、CXF和Servlet的Web服务接口系统。这里主要涉及的技术栈包括Spring框架、CXF作为服务消费和发布的工具,以及Servlet 3.0...
CXF允许开发者轻松地创建和部署服务,同时也提供了丰富的客户端API来调用这些服务。在CXF中,我们可以定义服务接口和服务实现,然后通过CXF的工具将其暴露为Web服务。 **Spring** 是一个全面的Java企业级应用开发...
“客户端测试”是指使用 CXF 客户端 API 或生成的客户端代码来调用服务端发布的服务,进行功能验证。这通常涉及: 1. 通过 WSDL 文件生成客户端代理类。 2. 在测试代码中实例化客户端并调用服务方法。 3. 检查响应...
总的来说,"springmvc_cxf_hibernate.zip"是一个展示Spring MVC、CXF和Hibernate集成的实践案例,对于想要提升企业级Web应用开发技能的学习者来说,这是一个宝贵的学习资源。通过深入研究这个项目,开发者不仅可以...
【标题】"CXF Spring Hibernate 搭建Web服务" 在IT行业中,Web服务是一种用于应用程序之间通信的技术,它允许不同系统之间的数据交换。本项目是关于如何利用Apache CXF、Spring框架和Hibernate ORM工具来构建一个...
在开发Java Web应用程序时,整合Spring 3.0.6、Hibernate 3和Apache CXF是常见的技术栈,用于构建高效、可维护的服务导向架构。这些框架分别在依赖注入、对象关系映射以及Web服务提供方面发挥着重要作用。以下是关于...
7. **注意事项**:尽管这种整合方式在当时是流行的,但随着技术的发展,现在更常见的是使用Spring Boot和Spring MVC来替代Spring的XML配置,使用JAX-WS或JAX-RS(如Jersey、CXF)来提供Web服务,而Hibernate则可能被...
本主题将深入探讨如何使用Spring、Hibernate和Xfire来实现远程分布式调用。这些技术都是Java开发中的重要工具,Spring作为全面的框架提供了服务管理和依赖注入,Hibernate则是流行的ORM(对象关系映射)解决方案,而...
使用spring集成cxf,在两个web project里发布及调用webservice server端使用spring+springmvc+mybatis+cxf,client端使用struts2+spring+hibernate+cxf 两个工程均为myeclipse project,包含所有除myeclipse自带以外...
9. **客户端调用**:使用CXF的`JaxWsProxyFactoryBean`生成客户端代理,进行远程调用。 10. **测试**:编写JUnit测试用例,验证各层功能的正确性。 ### 示例应用 这个Demo项目可能包含一个简单的用户管理系统,允许...
总的来说,整合CXF和Spring使我们能够灵活地创建支持多种数据格式的Web服务。同时,Spring的强大管理能力帮助我们更好地组织和控制应用程序的各个部分。这个“CXF整合spring同时支持JSON和XML配置的HelloWorld”示例...
CXF可与其他Java EE技术如Spring、Hibernate等无缝集成,提供更强大的功能。例如,通过Spring容器管理CXF服务,可以实现依赖注入和事务管理。 总结,CXF作为一个强大的Web服务框架,提供了从服务端到客户端的全方位...