Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java apachejax-RS打破了spring集成邮件_Java_Maven_Cxf_Jax Rs_Spring Integration - Fatal编程技术网

Java apachejax-RS打破了spring集成邮件

Java apachejax-RS打破了spring集成邮件,java,maven,cxf,jax-rs,spring-integration,Java,Maven,Cxf,Jax Rs,Spring Integration,我正在尝试编写一些代码来读取电子邮件并提供restful web服务 我有一个简单的测试文件,可以从gmail(通过pop)读取消息。然而,当我将cxf rf前端JAXR添加到pom.xml中时,似乎会停止该测试文件的工作 有人能解开这个吗 谢谢,代码和内容如下 错误是: org.springframework.integration.core.MessagingException: failure occurred while receiving from folder at org.

我正在尝试编写一些代码来读取电子邮件并提供restful web服务

我有一个简单的测试文件,可以从gmail(通过pop)读取消息。然而,当我将cxf rf前端JAXR添加到pom.xml中时,似乎会停止该测试文件的工作

有人能解开这个吗

谢谢,代码和内容如下

错误是:

org.springframework.integration.core.MessagingException: failure occurred while receiving from folder
    at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:173)
    at mail.GmailManualTester.testPop(GmailManualTester.java:36)

Caused by: java.lang.NullPointerException
    at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1166)
    at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1135)
    at javax.mail.internet.MimeMessage.<init>(MimeMessage.java:182)
    at org.springframework.integration.mail.Pop3MailReceiver.deleteMessages(Pop3MailReceiver.java:78)
    at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:164)
而pom.xml是

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>net.sf</groupId>
  <artifactId>boom</artifactId>
  <packaging>war</packaging>
  <version>1.0</version>
  <name>Example</name>
  <url>http://maven.apache.org</url>

  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.6</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
      <version>2.3.0</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-mail</artifactId>
      <version>1.0.2SR1</version>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-email</artifactId>
      <version>1.1</version>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <debug>false</debug>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>

4.0.0
net.sf
繁荣
战争
1
例子
http://maven.apache.org
朱尼特
朱尼特
4.6
测试
org.apache.cxf
cxf rt前端jaxrs
2.3.0
org.springframework.integration
spring集成邮件
1.0.2SR1
org.apache.commons
公用电子邮件
1.1
org.apache.maven.plugins
maven编译器插件
1.6
1.6
假的
编辑:从~/.m2/../cxf-rt-frontend-jaxrs-2.3.0.pom文件中获取所有依赖项,并将它们作为排除项放在我自己的pom.xml中。打开和关闭它们,直到我发现只有一个原因:

如果我把它放在pom文件中,我可以检索消息。如果我把它注释掉,我会从上面得到错误。不过,现在还需要进一步深入研究。排除这可能会破坏我应用程序中的Web服务

<exclusion>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-core</artifactId>
    </exclusion>

org.apache.cxf
cxf rt核

cxf rt核心依赖于geronimo-javamail_1.4_规范,它与spring引入的javamail提供程序不同(我认为)。然而,cxf只是将其用作javamail提供程序,因此任何提供程序都应该可以正常工作。因此,如果您为此添加了一个排除项,并允许spring版本进入,那么您应该都已设置好。

如果没有消息,则不会出错-只有当有消息等待时才会出错。嗨,Daniel。我将cxf rt核心依赖项添加到我自己的项目的pom中,并如上所述添加了排除项,它现在似乎正在工作。我想依赖顺序很重要。我稍后/明天/星期一也会调查你的解决方案;谢谢。好吧,我自己的依赖项洗牌在家里(Linux)起作用了,但现在不起作用了。我回来工作了(Windows)。不过,您关于排除geronimo javamail的建议是可行的。非常感谢你!
<exclusion>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-core</artifactId>
    </exclusion>