我是码头的新手。我曾经使用 tomcat 部署 solr。但是我们搬到了 solr6,我很难在 solr 6 附带的 jetty 中配置资源。
如何在 Solr 6 中配置 JNDI 资源?
这是我到目前为止没有运气的尝试。
在下面的配置中添加solr-6.4.0/server/etc/jetty.xml
<New id="test" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/DSTest</Arg>
<Arg>
<New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<Set name="Url">jdbc:mysql://localhost:3306/db</Set>
<Set name="User">root</Set>
<Set name="Password"></Set>
</New>
</Arg>
</New>
而在solr-6.4.0/server/solr-webapp/webapp/WEB-INF/web.xml
<resource-ref>
<description>My DataSource Reference</description>
<res-ref-name>jdbc/DSTest</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
我加了两个罐子,jetty-plus-9.3.14.v20161028.jar
然后mysql-connector-java-5.1.41-bin.jar
solr-6.4.0/server/lib/ext/
java -jar start.jar --list-modules
说
Jetty All Available Modules:
----------------------------
[ ] Module: http
Depend: server
XML: etc/jetty-http.xml
Enabled: <not enabled in this configuration>
[ ] Module: https
Depend: ssl
XML: etc/jetty-https.xml
Enabled: <not enabled in this configuration>
[ ] Module: server
LIB: lib/*.jar
LIB: lib/ext/*.jar
LIB: resources/
XML: etc/jetty.xml
Enabled: <not enabled in this configuration>
[ ] Module: ssl
Depend: server
XML: etc/jetty-ssl.xml
Enabled: <not enabled in this configuration>
Jetty Selected Module Ordering:
------------------------------
Solr 6 文档没有讨论如何处理 JNDI。任何指针都会有所帮助。谢谢。