You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by recursion <ba...@yahoo.com> on 2009/06/17 21:28:15 UTC

Unknown Container Exception: java.lang.NullPointerException

Hi, guys,

Steps to reproduce:

1. Download the latest OpenEJB 3.1.1 and unzip the archive
2. Set the OPENEJB_HOME system environment variable to the folder where
OpenEJB is unzipped
3. Start the engine
4. Deploy the attached jar (it contains some GlassFish descriptors for
security mapping)
5. Execute the pasted below client code
6. Get the attached trace

http://www.nabble.com/file/p24080389/TestOpenEJB.jar TestOpenEJB.jar 
http://www.nabble.com/file/p24080389/exception%2Btrace.txt
exception+trace.txt 

Properties props = new Properties();
		props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
		props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
        
		props.put("java.naming.security.principal", "recursion");
		props.put("java.naming.security.credentials", "recursion");
		       
        InitialContext ctx = new InitialContext(props);		
        Object ref = ctx.lookup("OuterBeanRemote");      
        OuterBeanRemote reference =
(OuterBeanRemote)PortableRemoteObject.narrow(ref, OuterBeanRemote.class);
        System.out.println(reference.getGreeting());
-- 
View this message in context: http://www.nabble.com/Unknown-Container-Exception%3A-java.lang.NullPointerException-tp24080389p24080389.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Unknown Container Exception: java.lang.NullPointerException

Posted by recursion <ba...@yahoo.com>.
Yes,

I think exactly the same as you. I made some debugging over the OpenEJB
sources and at one particular moment, i looked at an instance variable
called 'securityContext' (somewhere inside the security service
implementation). It had the appropriate caller credentials but the
addInRole() method wasn't called at all. So the GlassFish roles weren't
applied. (the role array of my user was empty instead of [admins, guests])


Best Regards,

recursion.
-- 
View this message in context: http://www.nabble.com/Unknown-Container-Exception%3A-java.lang.NullPointerException-tp24080389p24134268.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Unknown Container Exception: java.lang.NullPointerException

Posted by David Blevins <da...@visi.com>.
On Jun 17, 2009, at 12:28 PM, recursion wrote:

>
> Hi, guys,
>
> Steps to reproduce:
>
> 1. Download the latest OpenEJB 3.1.1 and unzip the archive
> 2. Set the OPENEJB_HOME system environment variable to the folder  
> where
> OpenEJB is unzipped
> 3. Start the engine
> 4. Deploy the attached jar (it contains some GlassFish descriptors for
> security mapping)
> 5. Execute the pasted below client code
> 6. Get the attached trace
>
> http://www.nabble.com/file/p24080389/TestOpenEJB.jar TestOpenEJB.jar
> http://www.nabble.com/file/p24080389/exception%2Btrace.txt
> exception+trace.txt
>
> Properties props = new Properties();
> 		props.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.RemoteInitialContextFactory");
> 		props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
>
> 		props.put("java.naming.security.principal", "recursion");
> 		props.put("java.naming.security.credentials", "recursion");
> 		
>        InitialContext ctx = new InitialContext(props);		
>        Object ref = ctx.lookup("OuterBeanRemote");
>        OuterBeanRemote reference =
> (OuterBeanRemote)PortableRemoteObject.narrow(ref,  
> OuterBeanRemote.class);
>        System.out.println(reference.getGreeting());

Looks like the security roles in the sun-ejb-jar.xml aren't getting  
applied correctly.  Will take a bit but should be easy to fix.

-David


Re: Unknown Container Exception: java.lang.NullPointerException

Posted by recursion <ba...@yahoo.com>.
Just to add (sorry to forget it):

1. in 'users.properties' add the following line "recursion=recursion"
2. in 'groups.properties' define two groups - admins and guests, and add
recursion to both users.
3. restart the engine (is it actually required?)

Regards,

recursion.
-- 
View this message in context: http://www.nabble.com/Unknown-Container-Exception%3A-java.lang.NullPointerException-tp24080389p24080451.html
Sent from the OpenEJB User mailing list archive at Nabble.com.