This is even more strange.

I removed all funny stuff from my script.  It is just this now:
/usr/bin/java -Xmx784m -cp
/usr/local/apache-tomcat-7.0.30/webapps/cbsweb/WEB-INF/classes
mdcm.MailHandler

I still get this error:
  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.

I don't get it.

Any ideas?

Thanks,
  Neil

--
Neil Aggarwal, (972) 834-1565
We lend money to investors to buy or refinance single family rent houses.
No origination fees, quick approval, no credit check.


-----Original Message-----
From: owner-postfix-us...@postfix.org
[mailto:owner-postfix-us...@postfix.org] On Behalf Of Neil Aggarwal
Sent: Tuesday, October 16, 2012 9:17 PM
To: postfix-us...@cloud9.net
Subject: Unable to execute a java program from postfix

Hello:

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.

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"

Here is the mailHandler script:
#!/bin/bash
. /root/webapps/cbsweb/WEB-INF/bin/parameters
$JAVA mdcm.MailHandler "$@"

Obviuosly, it is executing my parameters file since that sets up the
environment
variable for the $JAVA command.  It does not look like a classpath problem
since
it is set by the parameters file and the script works fine off the command
line.

I am stumped.

Any ideas?

Thanks,
  Neil

--
Neil Aggarwal, (972) 834-1565
We lend money to investors to buy or refinance single family rent houses.
No origination fees, quick approval, no credit check.


Reply via email to