[
https://issues.apache.org/jira/browse/SOLR-336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12670268#action_12670268
]
withinsea edited comment on SOLR-336 at 2/4/09 12:14 AM:
-------------------------------------------------------
h4. convert JNDI name into properties by using <property> element in
solrconfig.xml
I got the same problem yesterday... and this is a solution following the
concept of converting JNDI into properties.
The plan is to implement +solr.xml+'s <property> element in +solrconfig.xml+,
and append JNDI supporting to it.
3 changes for the implementation:
- Move private method +readProperties(Config cfg, Node node)+ from
+CoreContainer+ to +Config+,
use it to read +<property>+ elements in +solrconfig.xml+ during the
contruction of +Config+,
and overwrite +coreProperties+ before the process
+DOMUtil.substituteProperties+.
{quote}
??this ensure the mapped JNDI values only take effect in solrconfig.xml,
but not the system scope??
??the moved method got a Config for the first argument already... so I
think that will be ok??
{quote}
- Check property values and replace all 'java:comp/env/xxx' format value into
real JNDI value.
{quote}
??I write +$\{:java:comp/env/xxx\}+ for the JNDI ref string... not very
good. better solution???
{quote}
- Append some default jndi mapping. In fact only one. The "solr/home" and
"solr.solr.home"...
{quote}
??the priority: <property> in solrconfig -> default jndi mapping -> core
properties??
{quote}
Now you can got JNDI values in solrconfig.xml like this:
{code:xml}
<property name="solr.solr.home" value="java:comp/env/solr/home" />
<dataDir>${solr.solr.home:./solr}/data</dataDir>
{code}
(Or just the second line, this mapping has been setted as default)
\\
h4. patch base on release-3.0
[https://issues.apache.org/jira/secure/attachment/12399431/solr-336-jndi-props.patch]
was (Author: withinsea):
I got the same problem yesterday... and this is a solution following the
concept of converting JNDI into properties.
The plan is to implement +solr.xml+'s <property> element in +solrconfig.xml+,
and append JNDI supporting to it.
3 changes for the implementation:
- Move private method +readProperties(Config cfg, Node node)+ from
+CoreContainer+ to +Config+,
use it to read +<property>+ elements in +solrconfig.xml+ during the
contruction of +Config+,
and overwrite +coreProperties+ before the process
+DOMUtil.substituteProperties+.
{quote}
??this ensure the mapped JNDI values only take effect in solrconfig.xml,
but not the system scope??
??the moved method got a Config for the first argument already... so I
think that will be ok??
{quote}
- Check property values and replace all 'java:comp/env/xxx' format value into
real JNDI value.
{quote}
??I write +$\{:java:comp/env/xxx\}+ for the JNDI ref string... not very
good. better solution???
{quote}
- Append some default jndi mapping. In fact only one. The "solr/home" and
"solr.solr.home"...
{quote}
??the priority: <property> in solrconfig -> default jndi mapping -> core
properties??
{quote}
Now you can got JNDI values in solrconfig.xml like this:
{code:xml}
<property name="solr.solr.home" value="java:comp/env/solr/home" />
<dataDir>${solr.solr.home:./solr}/data</dataDir>
{code}
(Or just the second line, this mapping has been setted as default)
> Allow setting solr.data.dir with JNDI
> -------------------------------------
>
> Key: SOLR-336
> URL: https://issues.apache.org/jira/browse/SOLR-336
> Project: Solr
> Issue Type: Improvement
> Components: update
> Reporter: Stu Hood
> Priority: Minor
> Attachments: jndi-data-dir.patch, solr-336-jndi-props.patch
>
>
> I would like to be able set the solr.data.dir with JNDI, as I can for the
> solr.home property. Currently the data directory is only looked up in the
> ${solr.home}/conf/solrconfig.xml file, or as a parameter passed into the
> SolrCore(String, IndexSchema) constructor.
> This allows more options for setting the data directory, such as from within
> a Servlet container's Context fragment.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.