调用ejb+Resteasy的rest服务报错:Could not find MessageBodyWriter
来源:互联网 发布:水晶相册制作软件 编辑:程序博客网 时间:2024/05/16 06:21
Could not find MessageBodyWriter for response object of type: java.util.ArrayList
解决办法:war包要包含提供rest服务的ejb LOCAL接口类
我的打包参考:
1、build.ejblocal.xml片段
<target name="ejb-local.jar"><jar jarfile="${temp.dir}/ejb-local.jar"><fileset dir="./${classes.dir}"><include name="**/IHelloWorldLocal.class" /><include name="**/Book.class" /><!--include name="**/jboss-deployment-structure.xml" /--></fileset></jar></target>说明:IHelloWorldLocal是ejb LOCAL接口,包含rest声明,类中有一个方法,返回值为List<Book>;Book是vo类。打包生成ejb-local.jar
2、build.ejbimpl.xml片段
<target name="ejb-impl.jar"><jar jarfile="${temp.dir}/ejb-impl.jar"><fileset dir="./${classes.dir}"><include name="**/HelloWorldBean.class" /><include name="**/jboss-deployment-structure.xml" /></fileset></jar></target>说明:HelloWorldBean是IHelloWorldLocal的实现类。打包生成ejb-impl.jar。
jboss-deployment-structure.xml如下,声明了对ejb-local.jar的依赖
<?xml version="1.0" encoding="UTF-8"?><jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"> <deployment> <dependencies><module name="deployment.ejb-local.jar" /> </dependencies> </deployment></jboss-deployment-structure>
3、build.war.xml片段
<target name="deploy-war"><jar jarfile="${temp.dir}/rest.war"><fileset dir="./web/"><include name="**/IHelloWorldLocal.class" /><include name="**/web.xml" /><include name="WEB-INF/jboss-deployment-structure.xml" /></fileset></jar></target>说明:如果不包含<include name="**/IHelloWorldLocal.class" />,调用rest服务就会报上面的错误
web.xml中Resteasy的配置:
<context-param><param-name>resteasy.jndi.resources</param-name><param-value>java:global/ejb-impl/HelloWorldBean!com.ejb.hello.IHelloWorldLocal</param-value></context-param> <context-param><param-name>resteasy.servlet.mapping.prefix</param-name><param-value>/rest</param-value></context-param> <context-param><param-name>resteasy.scan</param-name><param-value>true</param-value></context-param><listener><listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class></listener><servlet><servlet-name>Resteasy</servlet-name><servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class></servlet><servlet-mapping><servlet-name>Resteasy</servlet-name><url-pattern>/rest/*</url-pattern></servlet-mapping>WEB-INF/jboss-deployment-structure.xml的配置:
<?xml version="1.0" encoding="UTF-8"?><jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"> <deployment> <dependencies><module name="deployment.ejb-local.jar" /><!-- <module name="org.jboss.resteasy.resteasy-jettison-provider"/><module name="org.jboss.resteasy.resteasy-jackson-provider"/> --><module name="org.jboss.resteasy.resteasy-jaxrs" /><module name="org.jboss.resteasy.resteasy-jaxb-provider" /> </dependencies> </deployment></jboss-deployment-structure>
- 调用ejb+Resteasy的rest服务报错:Could not find MessageBodyWriter
- resteasy返回错误Could not find MessageBodyWriter for response object of type
- RESTEASY报错Could not find resource for full path
- CVS报错:could not find desired version的解决办法
- Could not find MessageBodyWriter for response object of type: application/json
- 报错信息:Could not find artifact
- RESTEasy-Rest服务框架
- hibernate 报错:Could not find a getter for ~
- 报错:Could not find action or result
- 启动Tomcat报错:Could not find the main class
- pdo 连接数据库 报错 could not find driver 解决方法
- android studio编译报错Could not find property 'processResources'
- 报错:Could not find method android.view.ViewTreeObserver.removeOnGlobalLayoutListener
- Xcode 报错Could not find developer disk image,iOS10
- IAR报错could not find the following source file
- 依赖ConstraintLayout报错,Could not find *****,Failed to resolve:*****
- 依赖ConstraintLayout报错,Could not find *****,Failed to resolve:*****
- 调用resteasy服务报错:A GET request cannot have a body
- 关于浮动与清除浮动 (附清除浮动的八种方式)
- UVA 624 —— 01背包&路径输出
- 字条与字符串处理
- asp.net的<% %>总结
- 董的博客
- 调用ejb+Resteasy的rest服务报错:Could not find MessageBodyWriter
- 项目管理师——成本管理
- Python基础04 运算
- HDU 1399 (13.11.04)
- oracle 行转列 列转行
- 输出自定义格式的日期
- UML图
- recovery中event 事件实现
- c++数据成员