Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.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
Spring Maven Jetty运行JNDI配置_Spring_Maven_Jndi_Maven Jetty Plugin - Fatal编程技术网

Spring Maven Jetty运行JNDI配置

Spring Maven Jetty运行JNDI配置,spring,maven,jndi,maven-jetty-plugin,Spring,Maven,Jndi,Maven Jetty Plugin,我的项目结构如下所示: parent POM |-- app-core |-- app-model |-- app-services `-- app-web 在我的pom.xml应用程序web中: <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.

我的项目结构如下所示:

parent POM 
|-- app-core
|-- app-model
|-- app-services
`-- app-web
在我的
pom.xml
应用程序web中:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.10</version>
    <configuration>
    <webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml>
    </configuration>
 </plugin>
我的jetty.xml如下所示:

  <Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="icatDB" class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>jdbc/testDB</Arg>
    <Arg>
<New class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
    <Set name="serverName">localhost</Set>
    <Set name="databaseName">test</Set>
    <Set name="user">sa</Set>
    <Set name="password"></Set>
</New>
</Arg>
</New>
 </Configure>
  • 有关Jetty中JNDI的配置,请参见此
  • 有关如何将配置文件添加到构建过程的方法,请参见此
    • 好的,这对我来说很有用:

      我需要使用jettyEnvXml而不是jettyConfig

       <plugin>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>maven-jetty-plugin</artifactId>
          <version>6.1.10</version>
          <configuration>
          <webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
          <jettyEnvXml>src/main/resources/jetty.xml</jettyEnvXml> 
          </configuration>
        </plugin>
      
      
      org.mortbay.jetty
      maven jetty插件
      6.1.10
      src/main/resources/webdefault.xml
      src/main/resources/jetty.xml
      
      按照您的说明操作,出现错误请检查我的更新问题链接不再工作,因为Codehaus已不存在。可能值得更新它以指向Eclipse Jetty配置。
      Failure: Object is not of type class org.mortbay.jetty.webapp.WebAppContext
      
       <plugin>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>maven-jetty-plugin</artifactId>
          <version>6.1.10</version>
          <configuration>
          <webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
          <jettyEnvXml>src/main/resources/jetty.xml</jettyEnvXml> 
          </configuration>
        </plugin>