Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

su problem/question

Status
Not open for further replies.

bcme10

MIS
Jun 21, 2002
44
US
Trying to create a script that will be run via Tivoli that will reset the connection pools. Tivoli runs the script as root so I need to su to the weblogic user.

The script is basically one line that su's to the correct user and runs the java command:
su - devsunwl -c "java weblogic.Admin -url t3//10.20.22.97:7001 -username devsunwl -password devsunwl RESET_POOL ORT6_CP"

But I get the following error whe I try to run the script as root:
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Admin

It looks like my environment isn't being setup even though I su - to the correct user.
I've tried it logged in as the correct user and the java command is correct.

Any ideas?
THX
 
Are you running this script via cron? If so, bear in mind that cron has only a minimal environment - so you need to explicitly set your variables within the script, and possibly use absolute pathnames to reference any sctipts. HTH.
 
Is it the same if you su - devsunwl interactively and then run the command?

Annihilannic.
 
Thanks guys. I set the classpath on the java command and it worked.
 
I'm having the same problem, and don't know what to do. I have a java program that go to a database server and pull data into a text files. The compiled executable runs fine on the command line, but fail in cron, same error as mentioned here. What did you do to make it work? Thanks
 
Faroon, you have to set up the user's environment in the script you are running. In cron jobs, I always set up in the script that is run just about the entire environment that is in the user's .profile: PATH, CLASSPATH, LIBRARY (or is LPATH in Sun?), etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top