2016-03-21 36 views
0

JettyはOracleに接続できません。私の桟橋のconfでJetty 9 with Oracle 11g接続の問題

私は

<New id="demoRestLegacyDS" class="org.eclipse.jetty.plus.jndi.Resource"> 
<Arg></Arg> 
<Arg>jdbc/demoRestLegacyDB</Arg> 
<Arg> 
    <New class="oracle.jdbc.pool.OracleDataSource"> 
     <Set name="Url">jdbc:oracle:thin:@localhost:1521/MySchema</Set> 
     <Set name="User">TEST</Set> 
     <Set name="Password">TEST</Set> 
    </New> 
</Arg> 
</New> 

ていると私はMVNクリーンインストール桟橋で実行したとき、私は

<dependency> 
     <groupId>com.oracle</groupId> 
     <artifactId>ojdbc14</artifactId> 
     <version>10.2.0.4.0</version> 
     <scope>provided</scope> 
    </dependency> 

しかしMavenの依存関係にjarファイルを追加しました:実行-Djetty.port = 8888

エラーが発生しました

java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleConnectionPoolDataSource in file:/C:/workspace/rest-api/src/main/resources/config/jetty9.xml 

答えて

0

はpluggin Mavenの桟橋への依存関係を追加することで問題を解決しました

  <plugin> 
      <groupId>org.eclipse.jetty</groupId> 
      <artifactId>jetty-maven-plugin</artifactId> 
      <version>${jetty.maven.plugin.version}</version> 
      <configuration> 
       <jettyXml>${project.basedir}/src/main/resources/config/jetty9.xml</jettyXml> 
       <!-- ,${project.basedir}/src/main/resources/config/jetty-ssl.xml, ${project.basedir}/src/main/resources/config/jetty-https.xml --> 
       <stopKey>STOP</stopKey> 
       <stopPort>9999</stopPort> 
       <stopWait>5</stopWait> 
       <scanIntervalSeconds>5</scanIntervalSeconds> 
       <scanTargets> 
        <scanTarget>${project.basedir}/src/main</scanTarget> 
        <scanTarget>${project.basedir}/src/test</scanTarget> 
       </scanTargets> 
       <contextXml>${project.basedir}/src/test/resources/jetty-context.xml</contextXml> 
       <webAppConfig> 
        <contextPath>/${project.artifactId}</contextPath> 
       </webAppConfig> 
      </configuration> 
      <dependencies> 
       <dependency> 
        <groupId>mysql</groupId> 
        <artifactId>mysql-connector-java</artifactId> 
        <version>5.1.27</version> 
       </dependency> 
       <dependency> 
        <groupId>com.oracle</groupId> 
        <artifactId>ojdbc14</artifactId> 
        <version>10.2.0.4.0</version> 
       </dependency> 
      </dependencies> 
     </plugin> 
関連する問題