EWS java.lang.NoSuchMethodError:org.joda.time.format.DateTimeFormatter.withZoneUTC

时间:2016-02-09 15:27:20

标签: java exchangewebservices

我的应用程序正在尝试使用API​​ EWS从java收件箱中收到电子邮件,但我有一个例外:

  

java.lang.NoSuchMethodError:org.joda.time.format.DateTimeFormatter.withZoneUTC()Lorg / joda / time / format / DateTimeFormatter;           at microsoft.exchange.webservices.data.util.DateTimeUtils.createDateTimeFormats(DateTimeUtils.java:99)

我在我的依赖项中添加了joda,但我仍然有错误。这是我的完整pom.xml。 我知道你需要joda-time 2.8 for EWS,我找不到导致我出问题的依赖。

<?xml version="1.0"?>
    <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>com.lbc.scheduler</groupId>
        <artifactId>LBCSchedulerParent</artifactId>
        <version>1.0.0</version>
        <relativePath>../LBCSchedulerParent</relativePath>
      </parent>
      <groupId>com.lbc.scheduler</groupId>
      <artifactId>LBCSchedulerEJB</artifactId>
      <version>1.0.0</version>
      <packaging>ejb</packaging>
      <name>LBCSchedulerEJB</name>
      <url>http://LBCSchedulerEJB</url>
      <distributionManagement>
        <repository>
          <id>deployment</id>
          <name>Internal Releases</name>
          <url>http://nd1981dav02.blc.banquelaurentienne.ca:8084/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
          <id>deployment</id>
          <name>Internal Releases</name>
          <url>http://nd1981dav02.blc.banquelaurentienne.ca:8084/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
      </distributionManagement>
      <properties>
        <quartz.version>2.1.6</quartz.version>
        <hibernate-entitymanager.version>4.1.7.Final</hibernate-entitymanager.version>
        <maven-ejb-plugin.version>2.3</maven-ejb-plugin.version>
        <commons-configuration.version>1.6</commons-configuration.version>
        <junit.version>4.8.2</junit.version>
        <commons-discovery.version>0.2</commons-discovery.version>
        <aspectj.version>1.6.9</aspectj.version>
        <jboss-7.1.1-home>C:\jboss-as-7.1.1.Final</jboss-7.1.1-home>
        <jaxrs.version>1.1.1</jaxrs.version>
        <sonar.plugin.version>2.8</sonar.plugin.version>
        <spring-security.version>3.0.5.RELEASE</spring-security.version>
        <commons.collections.version>3.2.1</commons.collections.version>
        <soapui-plugin.version>4.0.1</soapui-plugin.version>
        <persistence-api.version>1.0.2</persistence-api.version>
        <dozer.version>5.3.2</dozer.version>
        <war-plugin.version>2.2</war-plugin.version>
        <javax-jsp-api.version>2.1</javax-jsp-api.version>
        <bean-validation.version>1.0.0.GA</bean-validation.version>
        <wtp.version>2.0</wtp.version>
        <jboss-as-maven-plugin.version>7.1.1.Final</jboss-as-maven-plugin.version>
        <netty.version>3.5.9.Final</netty.version>
        <ear-plugin.version>2.8</ear-plugin.version>
        <ejb.version>3.0</ejb.version>
        <jboss-ejb-api_3.1_spec.version>1.0.1.Final</jboss-ejb-api_3.1_spec.version>
        <hibernate-jpa-2.0-api.version>1.0.1.Final</hibernate-jpa-2.0-api.version>
        <jboss-jaxws-api_2.2_spec.version>2.0.0.Final</jboss-jaxws-api_2.2_spec.version>
        <thirdPartyPlugin.version>1.0</thirdPartyPlugin.version>
        <opencsv.version>2.3</opencsv.version>
        <ehcache-core.version>2.6.0</ehcache-core.version>
        <ojdbc5.version>11.2.0.3</ojdbc5.version>
        <source-plugin.version>2.2</source-plugin.version>
        <javax-jstl.version>1.2</javax-jstl.version>
        <gilenya.build.id>1.0.0-${maven.build.timestamp}</gilenya.build.id>
        <jboss-ejb-api.version>3.0.0.GA_SP1</jboss-ejb-api.version>
        <compiler-plugin.version>2.3.2</compiler-plugin.version>
        <wls-maven-plugin.version>12.1.1.0</wls-maven-plugin.version>
        <commons-logging.version>1.1.1</commons-logging.version>
        <hibernate-validator.version>4.1.0.Final</hibernate-validator.version>
        <commons-beanutils.version>1.8.3</commons-beanutils.version>
        <jdom.version>2.0.2</jdom.version>
        <commons-lang3.version>3.1</commons-lang3.version>
        <javax.mail.version>1.4.2</javax.mail.version>
        <slf4j.version>1.6.6</slf4j.version>
        <java.version>1.6</java.version>
        <c3p0.version>0.9.1.1</c3p0.version>
        <commons-lang.version>2.6</commons-lang.version>
        <updateimpact.apikey>PbCCTaotiyWhRDEtrjQIrNALip0c1f3C</updateimpact.apikey>
        <spring.version>3.0.5.RELEASE</spring.version>
        <easymock.version>3.0</easymock.version>
        <log4j.version>1.2.16</log4j.version>
        <javax.ejb.version>3.1.0</javax.ejb.version>
        <javax-servlet-api.version>2.5</javax-servlet-api.version>
        <updateimpact.openbrowser>true</updateimpact.openbrowser>
        <dom4j.version>1.6.1</dom4j.version>
        <axis.version>1.4</axis.version>
        <nexus.url>http://nd1981dav02.blc.banquelaurentienne.ca:8084/nexus</nexus.url>
        <javax-jsr311-api.version>1.1.1</javax-jsr311-api.version>
      </properties>
      <dependencies>
        <dependency>
          <groupId>joda-time</groupId>
          <artifactId>joda-time</artifactId>
          <version>2.8</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>com.microsoft.ews-java-api</groupId>
          <artifactId>ews-java-api</artifactId>
          <version>2.0</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>com.lbc.gateway</groupId>
          <artifactId>LBCClient</artifactId>
          <version>1.0.0</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>com.lbc.gateway</groupId>
          <artifactId>LBCGatewayCommon</artifactId>
          <version>1.0.0</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.16</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
          <version>1.6.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
          <version>1.6.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>c3p0</groupId>
          <artifactId>c3p0</artifactId>
          <version>0.9.1.1</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.quartz-scheduler</groupId>
          <artifactId>quartz</artifactId>
          <version>2.1.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.quartz-scheduler</groupId>
          <artifactId>quartz-oracle</artifactId>
          <version>2.1.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.quartz-scheduler</groupId>
          <artifactId>quartz-weblogic</artifactId>
          <version>2.1.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.quartz-scheduler</groupId>
          <artifactId>quartz-jboss</artifactId>
          <version>2.1.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>com.oracle.javax.ejb</groupId>
          <artifactId>javax.ejb</artifactId>
          <version>3.1.0</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>javax.mail</groupId>
          <artifactId>mailapi</artifactId>
          <version>1.4.2</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
          <version>1.8</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient-cache</artifactId>
          <version>4.2.5</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpmime</artifactId>
          <version>4.2.5</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>xpp3</groupId>
          <artifactId>xpp3</artifactId>
          <version>1.1.4c</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>com.moonrug</groupId>
          <artifactId>moonrug</artifactId>
          <version>1.0</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpcore</artifactId>
          <version>4.4.1</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
          <version>4.4.1</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
          <version>1.2</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.8.2</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <repositories>
        <repository>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <id>central</id>
          <url>http://central</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <id>central</id>
          <url>http://central</url>
        </pluginRepository>
      </pluginRepositories>
      <build>
        <sourceDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\src\main\java</sourceDirectory>
        <scriptSourceDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\src\main\scripts</scriptSourceDirectory>
        <testSourceDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\src\test\java</testSourceDirectory>
        <outputDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target\classes</outputDirectory>
        <testOutputDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target\test-classes</testOutputDirectory>
        <resources>
          <resource>
            <filtering>false</filtering>
            <directory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\src\main\resources</directory>
          </resource>
          <resource>
            <filtering>true</filtering>
            <directory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\src\main\filtered-resources</directory>
          </resource>
        </resources>
        <testResources>
          <testResource>
            <directory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\src\test\resources</directory>
          </testResource>
        </testResources>
        <directory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target</directory>
        <finalName>LBCSchedulerEJB-1.0.0</finalName>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <version>1.3</version>
            </plugin>
            <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <version>2.2-beta-5</version>
            </plugin>
            <plugin>
              <artifactId>maven-dependency-plugin</artifactId>
              <version>2.1</version>
            </plugin>
            <plugin>
              <artifactId>maven-release-plugin</artifactId>
              <version>2.0</version>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <id>default-ejb</id>
                <phase>package</phase>
                <goals>
                  <goal>ejb</goal>
                </goals>
                <configuration>
                  <ejbVersion>3.0</ejbVersion>
                  <archive>
                    <manifest>
                      <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                      <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                      <addClasspath>true</addClasspath>
                    </manifest>
                    <manifestEntries>
                      <Application-Name>LBCSchedulerEJB-1.0.0</Application-Name>
                      <Application-Version>1.0.0</Application-Version>
                      <Iteration-Name>${iteration}</Iteration-Name>
                      <JenkinsBuildNumber>${BUILD_NUMBER}</JenkinsBuildNumber>
                      <JenkinsBuildId>${BUILD_ID}</JenkinsBuildId>
                      <JenkinsJobName>${JOB_NAME}</JenkinsJobName>
                      <JenkinsBuildTag>${BUILD_TAG}</JenkinsBuildTag>
                      <JenkinsExecutorNumber>${EXECUTOR_NUMBER}</JenkinsExecutorNumber>
                      <JenkinsWorkspace>${WORKSPACE}</JenkinsWorkspace>
                      <JenkinsSvnRevision>${SVN_REVISION}</JenkinsSvnRevision>
                    </manifestEntries>
                  </archive>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <ejbVersion>3.0</ejbVersion>
              <archive>
                <manifest>
                  <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                  <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                  <addClasspath>true</addClasspath>
                </manifest>
                <manifestEntries>
                  <Application-Name>LBCSchedulerEJB-1.0.0</Application-Name>
                  <Application-Version>1.0.0</Application-Version>
                  <Iteration-Name>${iteration}</Iteration-Name>
                  <JenkinsBuildNumber>${BUILD_NUMBER}</JenkinsBuildNumber>
                  <JenkinsBuildId>${BUILD_ID}</JenkinsBuildId>
                  <JenkinsJobName>${JOB_NAME}</JenkinsJobName>
                  <JenkinsBuildTag>${BUILD_TAG}</JenkinsBuildTag>
                  <JenkinsExecutorNumber>${EXECUTOR_NUMBER}</JenkinsExecutorNumber>
                  <JenkinsWorkspace>${WORKSPACE}</JenkinsWorkspace>
                  <JenkinsSvnRevision>${SVN_REVISION}</JenkinsSvnRevision>
                </manifestEntries>
              </archive>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <executions>
              <execution>
                <id>default-testCompile</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>testCompile</goal>
                </goals>
                <configuration>
                  <source>1.6</source>
                  <target>1.6</target>
                </configuration>
              </execution>
              <execution>
                <id>default-compile</id>
                <phase>compile</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <source>1.6</source>
                  <target>1.6</target>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <source>1.6</source>
              <target>1.6</target>
            </configuration>
          </plugin>
          <plugin>
            <groupId>com.oracle.weblogic</groupId>
            <artifactId>wls-maven-plugin</artifactId>
            <version>12.1.1.0</version>
            <configuration>
              <middlewareHome>C:\Oracle\Middleware</middlewareHome>
              <domainHome>C:\Oracle\Middleware\user_projects\domains\base_domain3</domainHome>
              <weblogicHome>C:\Oracle\Middleware\wlserver_12.1</weblogicHome>
              <user>weblogic</user>
              <password>adminadmin1</password>
              <source>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target\classes</source>
              <source>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target/LBCSchedulerEJB-1.0.0.jar</source>
              <name>LBCSchedulerEJB</name>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.4.1</version>
            <executions>
              <execution>
                <id>default-clean</id>
                <phase>clean</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
              <execution>
                <id>default-install</id>
                <phase>install</phase>
                <goals>
                  <goal>install</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.5</version>
            <executions>
              <execution>
                <id>default-resources</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>resources</goal>
                </goals>
              </execution>
              <execution>
                <id>default-testResources</id>
                <phase>process-test-resources</phase>
                <goals>
                  <goal>testResources</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.10</version>
            <executions>
              <execution>
                <id>default-test</id>
                <phase>test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.7</version>
            <executions>
              <execution>
                <id>default-deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.0</version>
            <executions>
              <execution>
                <id>default-site</id>
                <phase>site</phase>
                <goals>
                  <goal>site</goal>
                </goals>
                <configuration>
                  <outputDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target\site</outputDirectory>
                  <reportPlugins>
                    <reportPlugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-project-info-reports-plugin</artifactId>
                    </reportPlugin>
                  </reportPlugins>
                </configuration>
              </execution>
              <execution>
                <id>default-deploy</id>
                <phase>site-deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
                <configuration>
                  <outputDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target\site</outputDirectory>
                  <reportPlugins>
                    <reportPlugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-project-info-reports-plugin</artifactId>
                    </reportPlugin>
                  </reportPlugins>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <outputDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <reporting>
        <outputDirectory>C:\WorkingJava\DaVinci_Projet\LBCSchedulerEJB\target\site</outputDirectory>
      </reporting>
    </project>

1 个答案:

答案 0 :(得分:1)

我的问题在于weblgoic 12c使用它的joda软件包而不是我的应用程序中的软件包。 我需要创建一个weblogic-application.xml来指定weblogic来获取我的joda版本

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
  <container-descriptor>
    <prefer-web-inf-classes>false</prefer-web-inf-classes>
    <prefer-application-packages>
      <package-name>org.joda.*</package-name>
    </prefer-application-packages>
  </container-descriptor>
</weblogic-web-app>

以下是帮助我的链接:https://github.com/jruby/jruby-rack/wiki/Deploying-with-WebLogic