cxf2.7.0做RestFul时启动一直出问题

问题描述

最近使用cxf2.7.0做一个简单的restful例子,郁闷一直都在启动时出错,检查配置没发现有什么问题,大家帮忙看一下。 出现的错误如下:2013-3-11 15:25:33 org.apache.catalina.core.AprLifecycleListener init信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:Program FilesJavajdk1.6.0_12bin;D:GXMCCtoolstomcat7bin2013-3-11 15:25:33 org.apache.coyote.AbstractProtocolHandler init信息: Initializing ProtocolHandler ["http-bio-9999"]2013-3-11 15:25:33 org.apache.coyote.AbstractProtocolHandler init信息: Initializing ProtocolHandler ["ajp-bio-8009"]2013-3-11 15:25:33 org.apache.catalina.startup.Catalina load信息: Initialization processed in 921 ms2013-3-11 15:25:33 org.apache.catalina.core.StandardService startInternal信息: Starting service Catalina2013-3-11 15:25:33 org.apache.catalina.core.StandardEngine startInternal信息: Starting Servlet Engine: Apache Tomcat/7.0.102013-3-11 15:25:33 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory cxf2013-3-11 15:25:34 org.apache.catalina.loader.WebappClassLoader validateJarFile信息: validateJarFile(D:GXMCCtoolstomcat7webappscxfWEB-INFlibgeronimo-servlet_3.0_spec-1.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class2013-3-11 15:25:36 org.apache.catalina.core.ApplicationContext log信息: Initializing Spring root WebApplicationContext2013-3-11 15:25:36 org.springframework.web.context.ContextLoader initWebApplicationContext信息: Root WebApplicationContext: initialization started2013-3-11 15:25:36 org.springframework.context.support.AbstractApplicationContext prepareRefresh信息: Refreshing Root WebApplicationContext: startup date [Mon Mar 11 15:25:36 CST 2013]; root of context hierarchy2013-3-11 15:25:37 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [spring/applicationContext.xml]2013-3-11 15:25:37 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [spring/integrationContext.xml]2013-3-11 15:25:37 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]2013-3-11 15:25:37 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-soap.xml]2013-3-11 15:25:37 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml]2013-3-11 15:25:38 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@17e9134: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,userRS,userRsImpl]; root of factory hierarchy2013-3-11 15:25:39 org.apache.cxf.bus.spring.OldSpringSupport logWarning警告: Import of META-INF/cxf/cxf-extension-soap.xml has been deprecated and is unnecessary.UserRS constructor2013-3-11 15:25:40 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@17e9134: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,userRS,userRsImpl]; root of factory hierarchy2013-3-11 15:25:40 org.springframework.web.context.ContextLoader initWebApplicationContext严重: Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRS': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionExceptionat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4651)at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5154)at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5149)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:619)Caused by: org.apache.cxf.service.factory.ServiceConstructionExceptionat org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:201)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1546)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1487)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)... 20 moreCaused by: java.lang.RuntimeException: Resource class interface com.sky.oa.cxf.service.IUserRS has no valid constructorat org.apache.cxf.jaxrs.lifecycle.PerRequestResourceProvider.<init>(PerRequestResourceProvider.java:45)at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:387)at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:151)... 27 more2013-3-11 15:25:40 org.apache.catalina.core.StandardContext listenerStart严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRS': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionExceptionat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4651)at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5154)at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5149)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:619)Caused by: org.apache.cxf.service.factory.ServiceConstructionExceptionat org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:201)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1546)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1487)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)... 20 moreCaused by: java.lang.RuntimeException: Resource class interface com.sky.oa.cxf.service.IUserRS has no valid constructorat org.apache.cxf.jaxrs.lifecycle.PerRequestResourceProvider.<init>(PerRequestResourceProvider.java:45)at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:387)at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:151)... 27 more2013-3-11 15:25:40 org.apache.catalina.core.StandardContext startInternal严重: Error listenerStart2013-3-11 15:25:40 org.apache.catalina.core.StandardContext startInternal严重: Context [/cxf] startup failed due to previous errors2013-3-11 15:25:41 org.apache.catalina.core.ApplicationContext log信息: Closing Spring root WebApplicationContext2013-3-11 15:25:41 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory docs2013-3-11 15:25:41 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory examples2013-3-11 15:25:41 org.apache.catalina.core.ApplicationContext log信息: ContextListener: contextInitialized()2013-3-11 15:25:41 org.apache.catalina.core.ApplicationContext log信息: SessionListener: contextInitialized()2013-3-11 15:25:41 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory host-manager2013-3-11 15:25:41 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory manager2013-3-11 15:25:41 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory Root2013-3-11 15:25:41 org.apache.coyote.AbstractProtocolHandler start信息: Starting ProtocolHandler ["http-bio-9999"]2013-3-11 15:25:41 org.apache.coyote.AbstractProtocolHandler start信息: Starting ProtocolHandler ["ajp-bio-8009"]2013-3-11 15:25:41 org.apache.catalina.startup.Catalina start信息: Server startup in 8064 ms 配置文件如下:Jar是从cxf2.7.0的lib中直接复制出来的,没有添加其他任何jar。 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"><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list><servlet><servlet-name>CXFServlet</servlet-name><servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class></servlet><servlet-mapping><servlet-name>CXFServlet</servlet-name><url-pattern>/*</url-pattern></servlet-mapping><!-- 加载spring配置文件,文件路径设置在contextConfigLocation参数中 --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:/spring/applicationContext.xml</param-value></context-param><!-- 字符过滤器 --><filter><filter-name>encoding</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>encoding</filter-name><url-pattern>*.action</url-pattern></filter-mapping><filter-mapping><filter-name>encoding</filter-name><url-pattern>*.json</url-pattern></filter-mapping><filter-mapping><filter-name>encoding</filter-name><url-pattern>*.jsp</url-pattern></filter-mapping></web-app> applicationContext.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd" default-autowire="byName"> <import resource="classpath:/spring/integrationContext.xml" ></import></beans> integrationContext.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"><description>Apache CXF的Web Service配置</description><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" /><jaxrs:server id="userRS"serviceClass="com.sky.oa.cxf.service.IUserRS"address="/userRSCXF"><jaxrs:serviceBeans><ref bean="userRsImpl"/></jaxrs:serviceBeans><jaxrs:extensionMappings><entry key="json" value="application/json"></entry><entry key="xml" value="application/xml" /></jaxrs:extensionMappings></jaxrs:server><bean id="userRsImpl" class="com.sky.oa.cxf.service.UserRS"></bean></beans> IUserRSpackage com.sky.oa.cxf.service;import javax.jws.WebMethod;import javax.jws.WebParam;import javax.jws.WebService;import javax.ws.rs.GET;import javax.ws.rs.Path;import javax.ws.rs.Produces;import javax.ws.rs.core.MediaType;@WebService@Path("/users/")@Produces(MediaType.APPLICATION_JSON)public interface IUserRS {@WebMethod@GET@Path("/user/{userId}")public String getUser(@WebParam(name = "userId")String userId);} UserRSpackage com.sky.oa.cxf.service;import javax.jws.WebService;@WebServicepublic class UserRS implements IUserRS {public String getUser(String userId){System.out.println("----------");System.out.println(" return xixihaha");return "xixihaha";}}

解决方案

serviceClass="com.sky.oa.cxf.service.IUserRS" 把这个去了试试。另外@WebService的注解应该不需要
解决方案二:
The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:Program FilesJavajdk1.6.0_12bin;初步看是你 jdk 1.6配置有问题吧。

时间: 2025-01-15 13:37:22

cxf2.7.0做RestFul时启动一直出问题的相关文章

selenium使用火狐浏览器做自动化时一直弹出导入数据,如何去掉这个

问题描述 selenium使用火狐浏览器做自动化时一直弹出导入数据,如何去掉这个 希望有大神能解答一下,在安装目录下没找到profile这个文件 解决方案 http://zhidao.baidu.com/link?url=UhCIYUzWoODR4ttM7wiLM2S_heLKv18FakAnrCbCU6Ckd6QTQsigkbmX-f7F5ZnAktcBpv-o-U8JTd9FQtXj_AGg3rLDlQuHnlaf7c39j1C

如何在使用MyEclipse 9.0编辑CSS时可以弹出代码提示?

问题描述 如何在使用MyEclipse9.0编辑CSS时可以弹出代码提示?比喻说编辑margin:写完这个属性时候后面就弹出一个框可以提供值的选择. 解决方案 解决方案二:Alt+/

MATLAB7.0安装后,启动弹出找不到指定的模块

安装MATLAB7.0途中用遇到了如下的问题: 先是找不到指定模块.确定后,找不到指定程序ddot.确定后,Default Charset: ibm-1386_P100-2002Register State:EAX = 00000000 EBX = 00000000ECX = 7c80996d EDX = 00720003ESI = 0130a780 EDI = 014d0190EBP = 00cda6d8 ESP = 00cda648EIP = 00000000 FLG = 00010206

ssh整合-spring整合hibernate做测试时没有报错,当三个整合时启动就报错啦,求大神指点!!

问题描述 spring整合hibernate做测试时没有报错,当三个整合时启动就报错啦,求大神指点!! 报的错误org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'ecsUnsigned' on target class [class $Proxy17] failed; nested exception is org.springframework.tran

[开发]Resin 4.0.15重启时常见问题

郑昀 201102 现象: 下面是偶然出现的Resin错误日志,郑昀的结论是不必过于担心下面这个错误,但最好能修改配置: 『 [2011/02/24 22:11:20.593] {} HmtpServlet[WebApp[production/webapp/admin.resin/ROOT]] requires an active com.caucho.security.Authenticator because HMTP messaging requires authenticated log

javaweb-在ssh 中 用ServletActionContext获取session时启动报错

问题描述 在ssh 中 用ServletActionContext获取session时启动报错 ServletActionContext.getRequest().getSession(); 怎么才能在启动的时候就有ServletActionContext,而不用在ActionSupport处理请求时在获取 解决方案 是报空指针吗? 没有请求时 ServletActionContext.getRequest() 为null 解决方案二: http://blog.csdn.net/suncaoyo

用Flex3.0 做一个简单Flv 播放器

今天早上, 以前高中同学要我教他用 Flex 写一个flv播放器. 网上应该也有不少的教程了, 但中午吃完饭后, 觉得自己写写也不错, 毕竟自己很少在自己博客上写教程, 于是就写写了..... 有错误请高手指出..以下为我今天写在博客上的一篇简单教程: 用 AS2.0 做的 flv 播放器不少了, Flex 3.0 早期又出了, 就尝试着做一个 flv 播放器. 用 Flex3.0 写出来的东西, 本人觉得, 其产物可以是 flex , 也可以是 AIR ( 早期的Apollo ).  好了,

做SEO时Nofollow的一个误区和巧妙用处

在正式进入主题前,先简单介绍下这个nofollow怎么使用,相信还有部分做SEO的朋友对这个标签的使用不太了解的: a target="blank" href="ABC" rel="nofollow" >XXX 具体用处是什么呢?在写本文之前,我的理解跟很多人一样,加入nofollow标签是为了控制权重,即不让所在页面的权重传递给目标页面,这样一来,就相对地增加了传递给其他页面的权重. 这种观念从我在温州网络公司做SEO时,就一直深埋在我脑

Win8安装UG9.0程序组件时安装出错怎么办

  在安装UG9.0程序软件时,安装出错,并提示:UGII_TMP_DIR 被设为一个有无效(非ASCII)字符的目录.怎么回事呢? 步骤如下: 一.原因分析: Win8帐户名肯定用的中文名,才会出现这此的问题,UG系统安装的时候有些目录会自动定义到你帐户名下的目录,而个目录中含有中文名,UG不识别,所以才会出错. 二.解决办法: 方法一:新建一个英文名用户再进行安装; 方法二: 1.在C盘新建一个TEMP名的文件夹; 2.然后打开环境变量(不知道哪里打开的话自己百度,这个是电脑基础知识),在用