com.sun.jersey< /&的groupId GT;球衣束< / artifactId的> 1.19.3< /版本> < /依赖性> - > com.sun.jersey< /&的groupId GT; Jersey的JSON< / artifactId的> 1.17.1< /版本> < /依赖性> - > com.sun.jersey< /&的groupId GT;球衣核< / artifactId的> 1.19.3< /版本> < /依赖性> - > org.glassfish.jersey.core 球衣常见 2.26-B03 com.sun.jersey< /&的groupId GT;球衣-的servlet< / artifactId的> 1.19.3< /版本> < /依赖性> - > org.jvnet.mimepull mimepull 1.9.7 org.codehaus.jackson< /&的groupId GT;杰克逊映射器-ASL< / artifactId的> 1.9.13< /版本> < /依赖性> - > com.sun.jersey< /&的groupId GT; Jersey的服务器16; / artifactId的> 1.19< /版本> < /依赖性> - > org.glassfish.jersey.core 球衣服务器 2.26-B03 org.glassfish.jersey.media 新泽西媒体JAXB 2.26-B03
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.12</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId>
<version>1.19.3</version> </dependency> -->
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-multipart -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.26-b03</version>
</dependency>
</dependencies>
我有这些依赖项(TomEE + Eclipse),当我启动服务器时,我收到了以下警告:警告:没有找到资源类org.glassfish.jersey.media.multipart.MultiPartFeature的资源方法。 当我尝试上传文件时,我得到了例外:
严重:没有为类org.glassfish.jersey.media.multipart.FormDataContentDisposition,ContentType:multipart / form-data找到邮件正文阅读器; boundary = Boundary_1_231756373_1495450602910 2017年5月22日下午1:56:43 org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse 警告:javax.ws.rs.WebApplicationException:HTTP 415不支持的媒体类型 at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1315) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:826) 在org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:789) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:77) 在org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254) at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:245) 在org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) 在org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) 在org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44) 在org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44) 在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522) 在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) 在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) 在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) 在org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1102) 在org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:788) 在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.run(NioEndpoint.java:1485) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61) 在java.lang.Thread.run(未知来源)
答案 0 :(得分:0)
为什么在tomee时添加glassfish已经为你提供了这些依赖?我只是将它们从pom中丢弃,你不会在cxf和jersey之间发生冲突。