Actually I already found what was "wrong". (Previously I checked on internet
to see if other people had already the same problem and, actually, some
people had the same.)

 

*         The problem is:

If you call the method main in "org.apache.avalon.phoenix.launcher.Main"
WITH an argument, you will have the error:

 

java.lang.NullPointerException at
org.apache.avalon.phoenix.frontends.CLISetup.parseCommandLineOptions(CLISetu
p.java:202)

 

 

(If you want to try this in the script run.bat, change the last line

 

"%PHOENIX_JAVACMD%" %DEBUG%
"-Djava.ext.dirs=%PHOENIX_HOME%\lib;%PHOENIX_HOME%\tools\lib"
"-Dphoenix.home=%PHOENIX_HOME%"
"-Djava.security.policy=jar:file:%PHOENIX_HOME%/bin/phoenix-loader.jar!/META
-INF/java.policy" %PHOENIX_JVM_OPTS% %PHOENIX_SM% -jar
"%PHOENIX_HOME%\bin\phoenix-loader.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9

 

By

 

"%PHOENIX_JAVACMD%" %DEBUG%
"-Djava.ext.dirs=%PHOENIX_HOME%\lib;%PHOENIX_HOME%\tools\lib"
"-Dphoenix.home=%PHOENIX_HOME%"
"-Djava.security.policy=jar:file:%PHOENIX_HOME%/bin/phoenix-loader.jar!/META
-INF/java.policy" %PHOENIX_JVM_OPTS% %PHOENIX_SM% -jar
"%PHOENIX_HOME%\bin\phoenix-loader.jar" toto)   --> toto or titi or tutu or
....

 

 

*         Occurs in:

JAMES-2.3.0. Otherwise this problem does NOT occur in 2.2.0 (I did not
checked other versions)

 

 

*         How did I fix this problem in my Java code:

If you want to launch JAMES in Java, use the following code:

 

                             try {

                                   Class clazz =
Class.forName(cmdLine_p[0]);

                                   Class[] argsTypes = { String[].class };

                                   // JAMES ne supporte pas qu'il y ait des
arguments.

                                   Object[] args = { new String[0] }; // If
it's not JAMES and you want to pass args, do Object[] args = { cmdLine_p };

                                   Method method = clazz.getMethod("main",
argsTypes);

                                   method.invoke(clazz, args);

                             } catch (Exception e) {

                                   _log.error("coudn't run the " +
cmdLine_p[0], e);

                             }

 

With: String[] cmdLine_p :   cmdLine_p[0] =
"org.apache.avalon.phoenix.launcher.Main"

                             cmdLine_p[1] = argument 0 (here we do not have
any args) 

                             cmdLine_p[2] = argument 1 (here we do not have
any args), etc...

 

 

 

Nota: maybe it will help other users to add this mail in JAMES-794.

 

Thank you!

 

Max

 

 

-----Message d'origine-----
De : Robert Burrell Donkin (JIRA) [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 11 juin 2007 22:29
À : [EMAIL PROTECTED]
Objet : [jira] Commented: (JAMES-794) launching JAMES without the run.sh or
run.bat script

 

 

    [
https://issues.apache.org/jira/browse/JAMES-794?page=com.atlassian.jira.plug
in.system.issuetabpanels:comment-tabpanel#action_12503606 ] 

 

Robert Burrell Donkin commented on JAMES-794:

---------------------------------------------

 

You need to launch pheonix in embedded mode. Google for details, take a look
at pheonix or ask on excalibur lists.

 

> launching JAMES without the run.sh or run.bat script

> ----------------------------------------------------

> 

>                 Key: JAMES-794

>                 URL: https://issues.apache.org/jira/browse/JAMES-794

>             Project: James

>          Issue Type: Bug

>    Affects Versions: 2.3.0

>         Environment: Windows XP

>            Reporter: maximeloridan

>            Assignee: Stefano Bagnara

>            Priority: Minor

> 

> To save memory on my computer, I'd like to launch all my JAVA programs in
the same JVM, including JAMES.

> So I looked in run.bat which class to launch, and it appears to be
org.apache.avalon.phoenix.launcher.Main.

> So I tried to launch it directly in my java program (and not still using
run.sh or run.bat), and I got the following error:

> There was an uncaught exception:

> ---------------------------------------------------------

> --- Message ---

> null

> --- Stack Trace ---

> java.lang.NullPointerException

>     at

>
org.apache.avalon.phoenix.frontends.CLISetup.parseCommandLineOptions(CLISetu
p.java:202)

>     at org.apache.avalon.phoenix.frontends.CLIMain.main(CLIMain.java:122)

>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

>     at

>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)

>     at

>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)

>     at java.lang.reflect.Method.invoke(Method.java:585)

>     at org.apache.avalon.phoenix.launcher.Main.startup(Main.java:128)

>     at org.apache.avalon.phoenix.launcher.Main.main(Main.java:83)

>     at com.cosmos.server.james.StartJames.main(StartJames.java:28)

> So is it possible to launch JAMES without using the scripts? If yes, how?

> Thank you very much!

 

-- 

This message is automatically generated by JIRA.

-

You can reply to this email to add a comment to the issue online.

Reply via email to