trainli 2008-07-31 11:12 采纳率: 0%
浏览 244
已采纳

CXF+spring+hibernate客户端调用总出错

问题在这里:
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

[b]问题补充:[/b]
这个我已经都加入,问题已经解决上面的问题!一个是因为我的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
信息: Hibernate Annotations 3.3.0.GA
2008-8-1 9:26:47 org.hibernate.cfg.Environment
信息: Hibernate 3.2.5
2008-8-1 9:26:47 org.hibernate.cfg.Environment
信息: 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
信息: 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"?>
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">

contextConfigLocation
/WEB-INF/beans.xml



org.springframework.web.context.ContextLoaderListener



CXFServlet

org.apache.cxf.transport.servlet.CXFServlet

1

<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>

而bean.xml如下:

<?xml version="1.0" encoding="UTF-8"?>

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>

[b]问题补充:[/b]
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");
}

}
[b]问题补充:[/b]
什么都没有!只是hibernate自动生成的方法!
[b]问题补充:[/b]
刚刚把问题以上的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)

[b]问题补充:[/b]
提交得太快,问题还是一样:
信息: Configured SessionFactory: null
[b]问题补充:[/b]

代码是这样写的:
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);

}

应该已经注入了吧?

[b]问题补充:[/b]
我在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.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(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

[b]问题补充:[/b]
后面的信息:

信息: 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
[b]问题补充:[/b]
这个我也不明白!但我可以看到值已经传回到服务端!
就是存取的时候出问题!看来是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

[b]问题补充:[/b]
都为空呀!

现在我按别人给的提示但我回传给服务器的时候怎么是long型的数据全为null
但是是String的就有

[b]问题补充:[/b]
问题得到了 lggege 的提示问题基本上解决,现在的问题是只要我的jobseekeruser里的一些字段为long型的,传到服务端时都为null了,但在客户端的时候是有值,而其他为string的都可以传到服务端!不知道大家有没有碰到这样的问题!
[b]问题补充:[/b]
问题都解决了!原来是C#代码写得有问题,附值时还要把对应的更新让系统知道把对应的 Specified = true;

  • 写回答

8条回答 默认 最新

  • llade163 2008-08-01 14:31
    关注

    感觉用了spring就在spring配置Hibernate的设置好了。不用搞他的cfg.xml。
    你的配置管理有点混乱。不大好猜问题出在哪。上面你的错误是:javax/persistence/JoinTable 这个类找不到啊。看看jar是否冲突或者classpath是否正确。

    一个灵活的spring配置例子,你可以参考一下。在spring配置能做完的事情一般就不要在其他地方做了:
    [code="xml"]

    com.mysql.jdbc.Driver


    jdbc:mysql://standard:3306/yourdb?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8


    user


    password


    40








    org.hibernate.dialect.Oracle10gDialect
    false
    com.opensymphony.oscache.hibernate.OSCacheProvider
    true
    true




    WEB-INF/mappings/core<!--把mapping文件放在这些目录即可,或者如下的classpath目录下也行-->
    <!--
    classpath:com/your/vo/hibernate/
    -->













    PROPAGATION_REQUIRED,readOnly

    PROPAGATION_REQUIRED,readOnly

    PROPAGATION_REQUIRED

    PROPAGATION_REQUIRED

    PROPAGATION_REQUIRED

    PROPAGATION_REQUIRED

    PROPAGATION_REQUIRED

    PROPAGATION_REQUIRED,readOnly




    true







    [/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

悬赏问题

  • ¥15 MATLAB代码补全插值
  • ¥15 Typegoose 中如何使用 arrayFilters 筛选并更新深度嵌套的子文档数组信息
  • ¥15 前后端分离的学习疑问?
  • ¥15 stata实证代码答疑
  • ¥50 husky+jaco2实现在gazebo与rviz中联合仿真
  • ¥15 dpabi预处理报错:Error using y_ExtractROISignal (line 251)
  • ¥15 在虚拟机中配置flume,无法将slave1节点的文件采集到master节点中
  • ¥15 husky+kinova jaco2 仿真
  • ¥15 zigbee终端设备入网失败
  • ¥15 金融监管系统怎么对7+4机构进行监管的