• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Running WebLogic sh script that sets environment variables from ANT

 
Greenhorn
Posts: 5
VSCode Python Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My problem is the following:
I have a build.xml file that should automatically work with WebLogic... start/stop/undeploy/deploy.... this kind of stuff.
I am running "setWLSEnv.sh" script from ANT using the "exec" task. The script gets executed successfully.
Then, I want to start WebLogic using "wlserver" task. But the server doesn't want to start....

I found that the problem is that ANT runs the "setWLSEnv.sh" in a separate process and the PATH and CLASSPATH variables are not set correctly for the ANT session. Is there any way to force ANT to run a sh in the same process? Or setting the weblogic variables somehow that they will be accessible for the ANT script?

Thanks!
 
author & internet detective
Posts: 42073
932
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Radu,
The default is supposed to be to not use a new environment/process. Can you show your <exec> call in case something is inadvertently being set? Also, you aren't calling the .sh file itself in a new environment, right?
 
Radu Codrin Leterna
Greenhorn
Posts: 5
VSCode Python Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently I am using a .sh script that is called from my main ANT script to execute "setWLSEnv.sh". So the configuration looks like this:

[ANT build.xml]

<project name="Automation" default="start" basedir=".">
<target name="start">
<exec executable="run_setWLSEnv.sh" resolveexecutable="true">
<arg value="/usr/local/bea/wlserver_10.3/server/bin" />
<arg value="setWLSEnv.sh" />
</exec>
</target>
</target>


[SH script]

echo "Now setting up the CLASSPATH and PATH for WebLogic..."
cd ${1}
. ./${2}
echo "All set."


I know I can run the "setWLSEnv.sh" script directly from ANT (and I've done it), but doing this does not set my PATH and CLASSPATH env variables for my ANT session and when I try to start WebLogic it just fails. The solution with ". ./" was suggested by someone, and it's working if I am running manually (so, before the ANT script just run from the command line the command: ". ./setWLSEnv.sh"). But, when I am running this command from my sh file, the CLASSPATH and PATH variables are not set in my ANT session.... so, same as before, WebLogic doesn't start.

The workaround I found is to set the CLASSPAT in a build.properties file and just use the property in my ANT script, in the "wlserver" task as the value for "classpath" argument. But this is just a temporary solution... an not very platform independent because I have hardcoded paths (currently working on Solaris, and if I move to Linux, the WL CLASSPATH is's proppably changed...).

So again... is there any way to have a build.xml file that STARTS WebLogic using "wlserver" task without the user having to run manually other external scripts and without hardcoding the CLASSPATH in the property file? I just want the script to be easy to use, generic, portable... just copy it to a machine that has the WebLogic installed, set the correct WL_HOME... and run it without any problems .
 
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic