You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aristedes Maniatis <am...@apache.org> on 2011/08/24 12:12:32 UTC

path to application in parallel deployment

I have another parallel deployment question: I am deploying Solr within a custom war application and it requires a path to its config files. Before parallel deployment I had this entry in context.xml:

<Environment name="solr/home" value="${ROOTDIR}/app/A1/webapps/search-internal/WEB-INF/classes/solr" type="java.lang.String" override="false"/>

But now, I cannot predict the name of the application path (since it looks like this "search-internal##11081701"). I have also been unsucessful in putting this environment entry inside the application itself and using a relative path, since it appears to be relative to tomcat and not to the application.

Is there some magic like a ${APP_ROOT} variable I can use?


Cheers
Ari


-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: path to application in parallel deployment

Posted by Aristedes Maniatis <am...@apache.org>.
On 25/08/11 12:43 AM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Aristedes,
>
> On 8/24/2011 10:36 AM, Aristedes Maniatis wrote:
>> On 25/08/11 12:15 AM, Christopher Schultz wrote:
>>
>>> So, if you could do this with code it would be:
>>>
>>> getServletContext().getRealPath("/WEB-INF/classes/solr")
>>>
>>> Right?
>>
>> Yes.
>
> Okay... glad I understand the goal :)
>
>>> There isn't any system property for this kind of thing (since
>>> system properties are JVM-wide, and not specific to any
>>> particular webapp) so it would have to be, as you say, some kind
>>> of "magic" variable that you could use.
>>
>> Are all properties JVM-wide?
>
> All system properties (retrieved using System.getProperty()) are
> JVM-global.
>
>> If I define a property in:
>>
>> webapps/someapp##1234/META-INF/context.xml
>
> Those aren't system properties -- they /will/ be local to the webapp.

Right, then theoretically at least, there could be a ${APP_ROOT} which could be available in there so that paths within the application could be addressed. I guess this use case is rare since code within the application is usually able to find resources on the classpath within the application.


>>> I don't believe such a variable exists. Since Solr is servlet
>>> context-aware application (i.e. it *is* webapp), is it possible
>>> to give it a path relative to the webapp itself? You might want
>>> to ask the Solr folks about this.
>>
>> Sure. I can try there next, but any such solution is going to
>> involve changing Solr code.
>
> Maybe not. Most webapp configurations assume that paths are relative
> to the webapp itself.

Our testing so far seems to suggest that it is relative to the tomcat install. But I'll follow this up with the Solr people. Thanks for the pointer.

>
>>> Another option, which I think is a better option, would be to
>>> locate solr/home outside of your deployment directory.
>>
>> That is an option, but a very awkward one since then I have an
>> application separated from the configuration which is an integral
>> part of its functionality.
>
> What goes in solr/home, anyway? I figured that the indexes go in
> there, not just a configuration file or two.

It contains files such as the schema definition (which is similar to a database schema definition, only for Lucene), instructions on how to parse data sources, weightings for query facets, etc. The actual index can be in a different path.


>> This isn't some JDBC connection which differs in every deployment,
>> but the configuration of exactly how the application works. So
>> being able to keep it in our SCM with the code and deploy together
>> is essential.
>
> Fair enough. I think the Solr list is the place to go. Definitely let
> us know what the answer is.

Thanks again

Ari


-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: path to application in parallel deployment

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aristedes,

On 8/24/2011 10:36 AM, Aristedes Maniatis wrote:
> On 25/08/11 12:15 AM, Christopher Schultz wrote:
> 
>> So, if you could do this with code it would be:
>> 
>> getServletContext().getRealPath("/WEB-INF/classes/solr")
>> 
>> Right?
> 
> Yes.

Okay... glad I understand the goal :)

>> There isn't any system property for this kind of thing (since
>> system properties are JVM-wide, and not specific to any
>> particular webapp) so it would have to be, as you say, some kind
>> of "magic" variable that you could use.
> 
> Are all properties JVM-wide?

All system properties (retrieved using System.getProperty()) are
JVM-global.

> If I define a property in:
> 
> webapps/someapp##1234/META-INF/context.xml

Those aren't system properties -- they /will/ be local to the webapp.

>> I don't believe such a variable exists. Since Solr is servlet 
>> context-aware application (i.e. it *is* webapp), is it possible
>> to give it a path relative to the webapp itself? You might want
>> to ask the Solr folks about this.
> 
> Sure. I can try there next, but any such solution is going to
> involve changing Solr code.

Maybe not. Most webapp configurations assume that paths are relative
to the webapp itself.

>> Another option, which I think is a better option, would be to
>> locate solr/home outside of your deployment directory.
> 
> That is an option, but a very awkward one since then I have an 
> application separated from the configuration which is an integral
> part of its functionality.

What goes in solr/home, anyway? I figured that the indexes go in
there, not just a configuration file or two.

> This isn't some JDBC connection which differs in every deployment,
> but the configuration of exactly how the application works. So
> being able to keep it in our SCM with the code and deploy together
> is essential.

Fair enough. I think the Solr list is the place to go. Definitely let
us know what the answer is.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5VDh4ACgkQ9CaO5/Lv0PAskQCfRNrit7Aqjj4c5jn9fpjtb4sl
QZMAoJO53b00b9jKbPWOPUHN9T736dNn
=XFCc
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: path to application in parallel deployment

Posted by Aristedes Maniatis <am...@apache.org>.
On 25/08/11 12:15 AM, Christopher Schultz wrote:

> So, if you could do this with code it would be:
>
>    getServletContext().getRealPath("/WEB-INF/classes/solr")
>
> Right?

Yes.


> There isn't any system property for this kind of thing (since system
> properties are JVM-wide, and not specific to any particular webapp) so
> it would have to be, as you say, some kind of "magic" variable that
> you could use.

Are all properties JVM-wide? If I define a property in:

   webapps/someapp##1234/META-INF/context.xml

Then that property is available to all applications? I didn't know that. If that's the case, then this approach will never work.

  
> I don't believe such a variable exists. Since Solr is servlet
> context-aware application (i.e. it *is* webapp), is it possible to
> give it a path relative to the webapp itself? You might want to ask
> the Solr folks about this.

Sure. I can try there next, but any such solution is going to involve changing Solr code.

> Another option, which I think is a better option, would be to locate
> solr/home outside of your deployment directory.

That is an option, but a very awkward one since then I have an application separated from the configuration which is an integral part of its functionality. This isn't some JDBC connection which differs in every deployment, but the configuration of exactly how the application works. So being able to keep it in our SCM with the code and deploy together is essential.

Thanks

Ari


-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: path to application in parallel deployment

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aristedes,

On 8/24/2011 6:12 AM, Aristedes Maniatis wrote:
> I have another parallel deployment question: I am deploying Solr
> within a custom war application and it requires a path to its
> config files. Before parallel deployment I had this entry in
> context.xml:
> 
> <Environment name="solr/home" 
> value="${ROOTDIR}/app/A1/webapps/search-internal/WEB-INF/classes/solr"
>
> 
type="java.lang.String" override="false"/>
> 
> But now, I cannot predict the name of the application path (since
> it looks like this "search-internal##11081701"). I have also been 
> unsucessful in putting this environment entry inside the
> application itself and using a relative path, since it appears to
> be relative to tomcat and not to the application.
> 
> Is there some magic like a ${APP_ROOT} variable I can use?

So, if you could do this with code it would be:

  getServletContext().getRealPath("/WEB-INF/classes/solr")

Right?

There isn't any system property for this kind of thing (since system
properties are JVM-wide, and not specific to any particular webapp) so
it would have to be, as you say, some kind of "magic" variable that
you could use.

I don't believe such a variable exists. Since Solr is servlet
context-aware application (i.e. it *is* webapp), is it possible to
give it a path relative to the webapp itself? You might want to ask
the Solr folks about this.

Another option, which I think is a better option, would be to locate
solr/home outside of your deployment directory.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5VB4EACgkQ9CaO5/Lv0PAr9QCdEGNstlZyka9uWD+ZS65tvBpz
+7wAnRjJV49BQck00kNr9UyI2l13+ty1
=ilmU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org