On 10/16/2012 9:17 PM, Neil Aggarwal wrote: > I am trying to execute a java program from postfix using > a pipe alias. > > When I send an email to the alias, I get this back from postfix: > > Command died with status 1: > "/root/webapps/cbsweb/WEB-INF/bin/mdcm/mailHandler". Command output: > Exception in thread "main" java.lang.NoClassDefFoundError: > mdcm/MailHandler > Caused by: java.lang.ClassNotFoundException: mdcm.MailHandler at > java.net.URLClassLoader$1.run(URLClassLoader.java:217) at > java.security.AccessController.doPrivileged(Native Method) at > java.net.URLClassLoader.findClass(URLClassLoader.java:205) at > java.lang.ClassLoader.loadClass(ClassLoader.java:321) at > sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at > java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the > main class: mdcm.MailHandler. Program will exit. > > Obviously, it is invoking the java vm, but for some reason it is not finding > my main > class.
Postfix doesn't run as root. > I can execute my script file from the command line and it works fine. > > Here is my alias in /etc/aliases: > # Forward mdcm messages to mail handler > mdcm: |"/root/webapps/cbsweb/WEB-INF/bin/mdcm/mailHandler" You're running the script as root. > Any ideas? Run the script in the context of the Postfix user, assigning necessary permissions to the script and all related files. -- Stan