users@glassfish.java.net

Glassfish - Create a JNDI Resource to be found by SOLR

From: Julian Fischer <fischer_at_railshoster.de>
Date: Fri, 23 Oct 2009 17:00:41 +0200

Hi There,

I am about to create a second SOLR instance on my glassfish server.
In order to prevent the 2nd SOLR instance to use the configuration files
of the first one I am trying
to change SOLR's home directory.

The SOLR documentation says:
Start the servlet container, passing the location of your solr home.
This may be done in a number of ways:
    * Set the java system property solr.solr.home to your solr home.
    * Configure the servlet container such that a JNDI lookup of
"java:comp/env/solr/home" by the solr webapp will point to the solr home.
    * The default solr home is "solr" under the JVM's current working
directory ($CWD/solr), so start the servlet container in the directory
containing ./solr

I cannot pass the home dir as a JVM parameter since this would affect
both instances.
So I assume that I should use the JNDI way.

My problem is that I am not really involved in JNDI and Glassfish so I
spent hours to create a valid JNDI Property
that responds to "java:comp/env/solr/home".

I tried various combinations to create a custom JNDI resource. The
resource should only be available to one of the instances.

Know my question is how to do this.
* Using the admin gui creating a JNDI resource?
* Changing the web.xml?
* Creating a second server?
*...

Infos about the glassfish server:
Sun's open source GlassFish(TM) v2 Update 1 Application Server
Sun Java System Application Server 9.1_01


Thank you in advance for any feedback.

Cheers
Julian

-- 
Dipl.-Inf.(FH)
Julian Fischer
Geschäftsführer
RailsHoster.de, ein Service der
Avarteq GmbH
Gebäude A1.2 - Universität des Saarlandes - 66123 Saarbrücken - Germany
Tel: +49-700-72 45 74 67
Fax: +49-700-72 45 74 67
Mobil: +49-177-338-35-39
WWW: http://www.railshoster.de
Geschäftsführer: Alexander Faißt, Dipl.-Inf.(FH) Julian Fischer
Handelsregister: AG Saarbrücken HRB 17413, Ust-IdNr.: DE262633168
Sitz: Saarbrücken
Diese E-Mail und jeder übermittelte Anhang enthält gesetzlich geschützte 
und vertrauliche Informationen. Wenn diese E-Mail nicht für Sie bestimmt 
ist, bitten wir Sie, sie an uns zurückzusenden und anschließend von 
Ihrem Computersystem zu löschen. Nicht für Sie bestimmte E-Mails und 
Anhänge dürfen Sie weder nutzen noch verarbeiten oder Dritten zugänglich 
machen, gleich in welcher Form.
This email including any attachments contains privileged and 
confidential information. If you are not an intended recipient, please 
return the email to us and then delete it from your computer system. You 
may neither use nor edit any such emails including attachments received 
due to an error in transmission, nor make them accessible to third 
parties in any manner whatsoever.