Jetty JNDI error within Maven Jetty Plugin

落爺英雄遲暮 提交于 2019-12-05 20:00:31

In addition to Pascal Thivent's answer, your jetty.xml actually looks like jetty-env.xml, so you can configure maven-jetty-plugin to use it with <jettyEnvXml>:

<plugin> 
  <groupId>org.mortbay.jetty</groupId> 
  <artifactId>maven-jetty-plugin</artifactId> 
  <configuration> 
   <jettyEnvXml>config/jetty.xml</jettyEnvXml> 
  </configuration> 
</plugin>

According to the documentation, naming entries declared in the jetty.xml are supposed to be jvm or Server scoped:

As you can see, the most natural config files in which to declare naming entries of each scope are:

  • jetty.xml - jvm or Server scope
  • WEB-INF/jetty-env.xml or a context xml file - webapp scope

So your jetty.xml should contain something like this:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
 <!-- Atomikos XA aware (but not XA capable) JDBC data source -->
 <New id="sbeDataSource" class="org.mortbay.jetty.plus.naming.Resource">
  <Arg>jdbc/myDataSource</Arg>
  <Arg>
   <New class="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean">
    .......
   </New>
  </Arg>
 </New> 
</Configure>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!