Intellij idea IntelliJ won和x27的码头运行;t读取jetty-env.xml文件
我正在用IntelliJ进行调试,由于上下文和虚拟主机名问题,我似乎无法让JBoss运行,所以我使用的是Jetty 6.1.26。我能够在使用不涉及jndi的DB连接字符串时运行和调试 现在,我需要使用Jndi,但似乎无法让Jetty找到它。我在WEB-INF目录中创建了一个jetty-env.xml文件,如下所示:Intellij idea IntelliJ won和x27的码头运行;t读取jetty-env.xml文件,intellij-idea,jetty,jndi,Intellij Idea,Jetty,Jndi,我正在用IntelliJ进行调试,由于上下文和虚拟主机名问题,我似乎无法让JBoss运行,所以我使用的是Jetty 6.1.26。我能够在使用不涉及jndi的DB连接字符串时运行和调试 现在,我需要使用Jndi,但似乎无法让Jetty找到它。我在WEB-INF目录中创建了一个jetty-env.xml文件,如下所示: <?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Con
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="wac" class="org.mortbay.jetty.webapp.WebAppContext">
<New id="jdbc.datasource" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg><Ref id="wac"/></Arg>
<Arg>jdbc/datasourceArg>
<Arg>
<New class="oracle.jdbc.pool.OracleDataSource">
<Set name="URL">jdbc:oracle:thin:@localhost:1521:xe</Set>
<Set name="User">user</Set>
<Set name="Password">password</Set>
</New>
</Arg>
</New>
</Configure>
jdbc/datasourceArg>
jdbc:oracle:thin:@localhost:1521:xe
使用者
暗语
web.inf引用了以下内容:
<resource-ref>
<description>ConnectionPool DataSource Reference</description>
<res-ref-name>jdbc.datasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
ConnectionPool数据源引用
jdbc.datasource
javax.sql.DataSource
容器
因此
然后应用程序上下文用它创建一个bean:
<jee:jndi-lookup id="jndiDataSource" jndi-name="jdbc.datasource"/>
当我运行jetty时,它告诉我它找不到数据源,因此它无法创建bean,应用程序无法启动
我怀疑问题在于jetty实际上没有读取xml文件。我把垃圾放在那个里只是为了看看,并且确信启动时并没有任何错误
我在jetty xml中添加了plus
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
<Set name="parentLoaderPriority">false</Set>
<Set name="extract">true</Set>
<Set name="allowDuplicates">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="configurationClasses"><Ref id="plusConfig"/></Set>
</New>
</Arg>
</Call>
/网络应用
错误的
符合事实的
错误的
/etc/webdefault.xml
我引用了IntelliJ中jetty服务器设置中的plus xml
我束手无策。所有在线信息都告诉我jetty会自动扫描该目录以查找此文件,但我显然没有遇到这种情况。您的问题看起来不像是由Intellij IDEA造成的。 我建议你试着用你的工件和启动来运行Jetty 没有想法的配置并比较结果。 如果有什么不同,请 我不熟悉数据源配置,但能够指出一些 配置可能存在的问题:
/Configure/New/@class
下的文件jetty env.xml
中
be“org.mortbay.jetty.plus.naming.Resource”
而不是“org.eclipse.jetty.plus.jndi.Resource”,因为根包
Jetty的6.1.26是“org.mortbay.Jetty”
并且它被更改为“org.eclipse.jetty”
,使用了更高版本的
服务器
请注意,包的最后一部分也不同(“命名”
,而不是“jndi”
)jetty env.xml
中,xpath/Configure/New/@id
下的
“datasource”
而不是“jdbc.datasource”
(id不带前缀)jetty env.xml
- 您的问题看起来不像是由Intellij IDEA引起的。
我建议你试着用你的工件和启动来运行Jetty
没有想法的配置并比较结果。
如果有什么不同,请
我不熟悉数据源配置,但能够指出一些
配置可能存在的问题:
- 在xpath
下的文件/Configure/New/@class
中 bejetty env.xml
而不是“org.eclipse.jetty.plus.jndi.Resource”,因为根包 Jetty的6.1.26是“org.mortbay.jetty.plus.naming.Resource”
并且它被更改为“org.mortbay.Jetty”
,使用了更高版本的 服务器 请注意,包的最后一部分也不同(“org.eclipse.jetty”
,而不是“命名”
)“jndi”
- 在文件
中,xpathjetty env.xml
下的/Configure/New/@id
而不是“datasource”
(id不带前缀)“jdbc.datasource”
- 在文件
jetty env.xml
修复程序最终更新了运行配置的命令行,将
编译
生命周期阶段包含在完整的干净编译jetty:run war-f pom.xml中,时间是五年多以后,我也有同样的问题:一个jetty-run-war
run-config没有获取我在构建资源中定义的jetty-env.xml
修复程序最终更新了运行配置的命令行,将编译
生命周期阶段包含在完整的干净编译jetty:run war-f pom.xml
中,我尝试了更改您建议的内容。我还意识到我在混合存储库。现在我正在使用以下命令:“org.mortbay.jetty jetty plus 6.1.26RC0 org.mortbay.jetty jetty naming 6.1.26RC0”我尝试更改您建议的内容。我还意识到我在混合存储库。现在我使用以下命令:“org.mortbay.jetty jetty plus 6.1.26RC0 org.mortbay.jetty jetty naming 6.1.26RC0”