Hi Raf,

You need to set your 'java.naming.factory.initial' property (from the
message below).  You can do this using
System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory") or you can place jndi.properties
(located in $JBOSS_HOME/server/<config>/conf on your classpath (since that
property is defined within that file).

Chad

----- Original Message ----- 
From: "Raf Haesen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 13, 2004 5:45 AM
Subject: [Andromda-user] NoInitialContextException in client class


> Hello all
>
> With my own cartridge I am able to generate a data-layer and a sort of
> event-layer on top of that. Now I
> would like to test some features in some third layer that simply calls a
few
> events from the event layer.
> So I wanted to implement a client class that has a main method as follows:
> (the model has one service
> class: LibraryMainEventHandler)
>
> package org.merode.testapp;
>     public static void main(String args[]) throws Exception {
>         System.out.println("Testing...");
>
>         LibraryMainEventHandlerHome lh =
> LibraryMainEventHandlerUtil.getHome();
>         LibraryMainEventHandler handler = lh.create();
>         // ...
>     }
>
> Now if I deploy the package in JBoss and run java org.merode.testapp.Test,
I
> get the following output:
>
> Testing...
> Exception in thread "main" javax.naming.NoInitialContextException: Need to
> specify class name in environment or system property, or as an applet
> parameter, or in an application resource file:
java.naming.factory.initial
>         at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
>         at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
>         at
>
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
>         at javax.naming.InitialContext.lookup(InitialContext.java:347)
>         at
>
org.merode.testapp.LibraryMainEventHandlerUtil.lookupHome(LibraryMainEventHa
ndlerUtil.java:21)
>         at
>
org.merode.testapp.LibraryMainEventHandlerUtil.getHome(LibraryMainEventHandl
erUtil.java:41)
>         at org.merode.testapp.Test.main(Test.java:12)
>
> Any idea to solve this problem? In my classpath variable i have
> $JBOSS/client/*.jar...
> Thanks!
> Raf
>
> _________________________________________________________________
> MSN Search: fast, clear, easy http://search.msn.be
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Andromda-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/andromda-user




-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Andromda-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to