You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jason Novotny <no...@aei.mpg.de> on 2005/05/03 22:43:01 UTC

detecting tomcat 5.5

Hi,

    I'm trying to update my build script to do some conditional checking 
to see if I'm deploying my code to Tomcat 5.5 or using an older version. 
Is there something (like a particular file or directory) I can check 
reliably that would indicate that I'm using 5.5 versus an older version?

    Thanks, Jason

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


Re: detecting tomcat 5.5

Posted by Jason Novotny <no...@aei.mpg.de>.
    Yeah-- it was even lamer than that. I also had to add jmx.jar from 
bin/ to classpath since that was involved in the Valve dependency from 
catalina.jar....

    Thanks, Jason

Tim Funk wrote:

> It looks like the <available> task tries to load the class in a new 
> classloader. Of course - doing so loads all it's super classes too - 
> so you'd need to also add catalina.jar to your classpath for the 
> <available> task.
>
> -Tim
>
> Jason Novotny wrote:
>
>>
>> Thanks Tim,
>>
>>    That is exactly what I was looking for, but I still can't get it 
>> to work, and it seems that the <available> task is somewhat broken. 
>> Instead of just checking if the class is contained in the jar it also 
>> tries to resolve all of its dependencies, so this is what I get when 
>> using ant -d:
>>
>>  >>>>>
>> Finding class org.apache.catalina.valves.FastCommonAccessLogValve
>> Loaded from 
>> /Users/novotny/Jakarta/jakarta-tomcat-5.5.9/server/lib/catalina-optional.jar 
>> org/apache/catalina/valves/FastCommonAccessLogValve.class
>> Finding class org.apache.catalina.valves.ValveBase
>> [available] Could not load dependent class 
>> "org/apache/catalina/valves/ValveBase" for class 
>> "org.apache.catalina.valves.FastCommonAccessLogValve"
>> [available] Unable to load class 
>> org.apache.catalina.valves.FastCommonAccessLogValve
>>  >>>>>>
>>
>>    I can't see any flags that would tell it to not check for 
>> dependencies..
>>
>>    Jason
>>
>>
>>
>> Tim Funk wrote:
>>
>>> <available 
>>> classname="org.apache.catalina.valves.FastCommonAccessLogValve"
>>>            
>>> classpath="${appserver.home}/server/lib/catalina-optional.jar"
>>>            property="is55"/>
>>>
>>> -Tim
>>>
>>> Jason Novotny wrote:
>>>
>>>>
>>>>    Thanks-- unfortunately by default (at least on Unix) that file 
>>>> is not executable so it wouldn't even execute by default.
>>>>
>>>>    Has anyone actually created an ant task or can give me some ant 
>>>> logic for doing Tomcat version detection for 5.5? Here's a snippet 
>>>> that worked for Tomcat 4 and Tomcat 5.0.X that was fairly easy:
>>>>
>>>> <if>
>>>>            <available file="${appserver.home}/conf/Catalina" 
>>>> type="dir" prope
>>>> rty="tomcat5"/>
>>>>            <then>
>>>>                <echo message="Detected Tomcat 5"/>
>>>>            </then>
>>>>            <else>
>>>>                <echo message="Detected Tomcat 4"/>
>>>>            </else>
>>>>        </if>
>>>>
>>>>    Thanks, Jason
>>>>
>>>> Jason Bainbridge wrote:
>>>>
>>>>> On 5/3/05, Jason Novotny <no...@aei.mpg.de> wrote:
>>>>>  
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>    I'm trying to update my build script to do some conditional 
>>>>>> checking
>>>>>> to see if I'm deploying my code to Tomcat 5.5 or using an older 
>>>>>> version.
>>>>>> Is there something (like a particular file or directory) I can check
>>>>>> reliably that would indicate that I'm using 5.5 versus an older 
>>>>>> version?
>>>>>>   
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Look at %CATALINA_HOME%\bin\version.bat or version.sh depending on
>>>>> whether you are on Windows or *nix, if you're on Windows and don't
>>>>> have version.bat then you need to download the zipped distribution 
>>>>> and
>>>>> now thw windows installer.
>>>>>
>>>>> Regards,
>>>>>  
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


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


Re: detecting tomcat 5.5

Posted by Tim Funk <fu...@joedog.org>.
It looks like the <available> task tries to load the class in a new 
classloader. Of course - doing so loads all it's super classes too - so you'd 
need to also add catalina.jar to your classpath for the <available> task.

-Tim

Jason Novotny wrote:

> 
> Thanks Tim,
> 
>    That is exactly what I was looking for, but I still can't get it to 
> work, and it seems that the <available> task is somewhat broken. Instead 
> of just checking if the class is contained in the jar it also tries to 
> resolve all of its dependencies, so this is what I get when using ant -d:
> 
>  >>>>>
> Finding class org.apache.catalina.valves.FastCommonAccessLogValve
> Loaded from 
> /Users/novotny/Jakarta/jakarta-tomcat-5.5.9/server/lib/catalina-optional.jar 
> org/apache/catalina/valves/FastCommonAccessLogValve.class
> Finding class org.apache.catalina.valves.ValveBase
> [available] Could not load dependent class 
> "org/apache/catalina/valves/ValveBase" for class 
> "org.apache.catalina.valves.FastCommonAccessLogValve"
> [available] Unable to load class 
> org.apache.catalina.valves.FastCommonAccessLogValve
>  >>>>>>
> 
>    I can't see any flags that would tell it to not check for dependencies..
> 
>    Jason
> 
> 
> 
> Tim Funk wrote:
> 
>> <available 
>> classname="org.apache.catalina.valves.FastCommonAccessLogValve"
>>            classpath="${appserver.home}/server/lib/catalina-optional.jar"
>>            property="is55"/>
>>
>> -Tim
>>
>> Jason Novotny wrote:
>>
>>>
>>>    Thanks-- unfortunately by default (at least on Unix) that file is 
>>> not executable so it wouldn't even execute by default.
>>>
>>>    Has anyone actually created an ant task or can give me some ant 
>>> logic for doing Tomcat version detection for 5.5? Here's a snippet 
>>> that worked for Tomcat 4 and Tomcat 5.0.X that was fairly easy:
>>>
>>> <if>
>>>            <available file="${appserver.home}/conf/Catalina" 
>>> type="dir" prope
>>> rty="tomcat5"/>
>>>            <then>
>>>                <echo message="Detected Tomcat 5"/>
>>>            </then>
>>>            <else>
>>>                <echo message="Detected Tomcat 4"/>
>>>            </else>
>>>        </if>
>>>
>>>    Thanks, Jason
>>>
>>> Jason Bainbridge wrote:
>>>
>>>> On 5/3/05, Jason Novotny <no...@aei.mpg.de> wrote:
>>>>  
>>>>
>>>>> Hi,
>>>>>
>>>>>    I'm trying to update my build script to do some conditional 
>>>>> checking
>>>>> to see if I'm deploying my code to Tomcat 5.5 or using an older 
>>>>> version.
>>>>> Is there something (like a particular file or directory) I can check
>>>>> reliably that would indicate that I'm using 5.5 versus an older 
>>>>> version?
>>>>>   
>>>>
>>>>
>>>>
>>>>
>>>> Look at %CATALINA_HOME%\bin\version.bat or version.sh depending on
>>>> whether you are on Windows or *nix, if you're on Windows and don't
>>>> have version.bat then you need to download the zipped distribution and
>>>> now thw windows installer.
>>>>
>>>> Regards,
>>>>  
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

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


Re: detecting tomcat 5.5

Posted by Jason Novotny <no...@aei.mpg.de>.
Thanks Tim,

    That is exactly what I was looking for, but I still can't get it to 
work, and it seems that the <available> task is somewhat broken. Instead 
of just checking if the class is contained in the jar it also tries to 
resolve all of its dependencies, so this is what I get when using ant -d:

 >>>>>
Finding class org.apache.catalina.valves.FastCommonAccessLogValve
Loaded from 
/Users/novotny/Jakarta/jakarta-tomcat-5.5.9/server/lib/catalina-optional.jar 
org/apache/catalina/valves/FastCommonAccessLogValve.class
Finding class org.apache.catalina.valves.ValveBase
[available] Could not load dependent class 
"org/apache/catalina/valves/ValveBase" for class 
"org.apache.catalina.valves.FastCommonAccessLogValve"
[available] Unable to load class 
org.apache.catalina.valves.FastCommonAccessLogValve
 >>>>>>

    I can't see any flags that would tell it to not check for dependencies..

    Jason



Tim Funk wrote:

> <available 
> classname="org.apache.catalina.valves.FastCommonAccessLogValve"
>            classpath="${appserver.home}/server/lib/catalina-optional.jar"
>            property="is55"/>
>
> -Tim
>
> Jason Novotny wrote:
>
>>
>>    Thanks-- unfortunately by default (at least on Unix) that file is 
>> not executable so it wouldn't even execute by default.
>>
>>    Has anyone actually created an ant task or can give me some ant 
>> logic for doing Tomcat version detection for 5.5? Here's a snippet 
>> that worked for Tomcat 4 and Tomcat 5.0.X that was fairly easy:
>>
>> <if>
>>            <available file="${appserver.home}/conf/Catalina" 
>> type="dir" prope
>> rty="tomcat5"/>
>>            <then>
>>                <echo message="Detected Tomcat 5"/>
>>            </then>
>>            <else>
>>                <echo message="Detected Tomcat 4"/>
>>            </else>
>>        </if>
>>
>>    Thanks, Jason
>>
>> Jason Bainbridge wrote:
>>
>>> On 5/3/05, Jason Novotny <no...@aei.mpg.de> wrote:
>>>  
>>>
>>>> Hi,
>>>>
>>>>    I'm trying to update my build script to do some conditional 
>>>> checking
>>>> to see if I'm deploying my code to Tomcat 5.5 or using an older 
>>>> version.
>>>> Is there something (like a particular file or directory) I can check
>>>> reliably that would indicate that I'm using 5.5 versus an older 
>>>> version?
>>>>   
>>>
>>>
>>>
>>> Look at %CATALINA_HOME%\bin\version.bat or version.sh depending on
>>> whether you are on Windows or *nix, if you're on Windows and don't
>>> have version.bat then you need to download the zipped distribution and
>>> now thw windows installer.
>>>
>>> Regards,
>>>  
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


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


Re: detecting tomcat 5.5

Posted by Tim Funk <fu...@joedog.org>.
<available classname="org.apache.catalina.valves.FastCommonAccessLogValve"
            classpath="${appserver.home}/server/lib/catalina-optional.jar"
            property="is55"/>

-Tim

Jason Novotny wrote:

> 
>    Thanks-- unfortunately by default (at least on Unix) that file is not 
> executable so it wouldn't even execute by default.
> 
>    Has anyone actually created an ant task or can give me some ant logic 
> for doing Tomcat version detection for 5.5? Here's a snippet that worked 
> for Tomcat 4 and Tomcat 5.0.X that was fairly easy:
> 
> <if>
>            <available file="${appserver.home}/conf/Catalina" type="dir" 
> prope
> rty="tomcat5"/>
>            <then>
>                <echo message="Detected Tomcat 5"/>
>            </then>
>            <else>
>                <echo message="Detected Tomcat 4"/>
>            </else>
>        </if>
> 
>    Thanks, Jason
> 
> Jason Bainbridge wrote:
> 
>> On 5/3/05, Jason Novotny <no...@aei.mpg.de> wrote:
>>  
>>
>>> Hi,
>>>
>>>    I'm trying to update my build script to do some conditional checking
>>> to see if I'm deploying my code to Tomcat 5.5 or using an older version.
>>> Is there something (like a particular file or directory) I can check
>>> reliably that would indicate that I'm using 5.5 versus an older version?
>>>   
>>
>>
>> Look at %CATALINA_HOME%\bin\version.bat or version.sh depending on
>> whether you are on Windows or *nix, if you're on Windows and don't
>> have version.bat then you need to download the zipped distribution and
>> now thw windows installer.
>>
>> Regards,
>>  
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

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


Re: detecting tomcat 5.5

Posted by Will Hartung <wi...@msoft.com>.
> From: "Jason Novotny" <no...@aei.mpg.de>
> Sent: Tuesday, May 03, 2005 2:11 PM

>     Thanks-- unfortunately by default (at least on Unix) that file is
> not executable so it wouldn't even execute by default.

Did you bother to even LOOK at the script? All it does is call 'catalina.sh
version' (I'd like to think that script is executable for you). And all THAT
does is run the ServerInfo class.

Given all that, you should be able to figure something out.

Regards,

Will Hartung
(willh@msoft.com)


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


Re: detecting tomcat 5.5

Posted by Jason Novotny <no...@aei.mpg.de>.
    Thanks-- unfortunately by default (at least on Unix) that file is 
not executable so it wouldn't even execute by default.

    Has anyone actually created an ant task or can give me some ant 
logic for doing Tomcat version detection for 5.5? Here's a snippet that 
worked for Tomcat 4 and Tomcat 5.0.X that was fairly easy:

<if>
            <available file="${appserver.home}/conf/Catalina" type="dir" 
prope
rty="tomcat5"/>
            <then>
                <echo message="Detected Tomcat 5"/>
            </then>
            <else>
                <echo message="Detected Tomcat 4"/>
            </else>
        </if>

    Thanks, Jason

Jason Bainbridge wrote:

>On 5/3/05, Jason Novotny <no...@aei.mpg.de> wrote:
>  
>
>>Hi,
>>
>>    I'm trying to update my build script to do some conditional checking
>>to see if I'm deploying my code to Tomcat 5.5 or using an older version.
>>Is there something (like a particular file or directory) I can check
>>reliably that would indicate that I'm using 5.5 versus an older version?
>>    
>>
>
>Look at %CATALINA_HOME%\bin\version.bat or version.sh depending on
>whether you are on Windows or *nix, if you're on Windows and don't
>have version.bat then you need to download the zipped distribution and
>now thw windows installer.
>
>Regards,
>  
>


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


Re: detecting tomcat 5.5

Posted by Jason Bainbridge <jb...@gmail.com>.
On 5/3/05, Jason Novotny <no...@aei.mpg.de> wrote:
> 
> Hi,
> 
>     I'm trying to update my build script to do some conditional checking
> to see if I'm deploying my code to Tomcat 5.5 or using an older version.
> Is there something (like a particular file or directory) I can check
> reliably that would indicate that I'm using 5.5 versus an older version?

Look at %CATALINA_HOME%\bin\version.bat or version.sh depending on
whether you are on Windows or *nix, if you're on Windows and don't
have version.bat then you need to download the zipped distribution and
now thw windows installer.

Regards,
-- 
Jason Bainbridge
http://kde.org - webmaster@kde.org
Personal Site - http://jasonbainbridge.com

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