You also need to specify the security realm in which you want to
authenticate against. Try adding this to your props
props.setProperty("openejb.authentication.realmName",
"geronimo-admin");
Regards,
Viet
On Tue, Apr 8, 2008 at 11:38 AM, CG <[EMAIL PROTECTED]> wrote:
> hi, thanks for the feedback.
>
> I have tried to settle the new problem but no luck , it is out of my ability.
> I can confirm the user and password works.
>
> But the error msg seems like telling me that authentication failed ..
>
> Any hints will be appreciated .. thx.
>
> CG
>
> <my code>
> // initially has no this part , manually added to isolate the possible
> problem of properties file
> 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.setProperty(Context.SECURITY_PRINCIPAL, "system");
> props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
> // end
> context = new InitialContext(props); <--- problem
> at this line
>
> < end my code>
>
> Error message
> ==============
> javax.naming.AuthenticationException: This principle is not
> authorized. [Root exception is
> javax.security.auth.login.LoginException: Invalid null input: name]
> at
> org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>
> at
> org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> at javax.naming.InitialContext.init(InitialContext.java:223)
> at javax.naming.InitialContext.<init>(InitialContext.java:197)
> at
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
> Caused by: javax.security.auth.login.LoginException: Invalid null input: name
> at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
> at
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
> at
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
> at
> org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
> at
> org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
> at
> org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
> at
> org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
> at
> org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
> at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
> at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
> at
> org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:76)
> at
> org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55)
> at
> org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:118)
> at java.lang.Thread.run(Thread.java:619)
>
> Exception in thread "main" java.lang.RuntimeException:
> javax.naming.AuthenticationException: This principle is not
> authorized. [Root exception is
> javax.security.auth.login.LoginException: Invalid null input: name]
> at
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:57)
> Caused by: javax.naming.AuthenticationException: This principle is not
> authorized. [Root exception is
> javax.security.auth.login.LoginException: Invalid null input: name]
> at
> org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>
> at
> org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> at javax.naming.InitialContext.init(InitialContext.java:223)
> at javax.naming.InitialContext.<init>(InitialContext.java:197)
> at
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
> Caused by: javax.security.auth.login.LoginException: Invalid null input: name
> at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
> at
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
> at
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
> at
> org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
> at
> org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
> at
> org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
> at
> org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
> at
> org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
> at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
> at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
> at
> org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:76)
> at
> org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55)
> at
> org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:118)
> at java.lang.Thread.run(Thread.java:619)
>
>
> Geronimo log
> ===========
> 84387: 23:50:31,778 DEBUG [auth] AUTH REQUEST: null:system --
> RESPONSE: AUTH_DENIED:javax.security.auth.login.LoginException:
> Invalid null input: name
> 84388: 23:50:38,941 DEBUG [CoyoteAdapter] Requested cookie session id
> is 27D8EC25DC047479A6FB368DDB730876
> 84389: 23:50:38,941 DEBUG [AuthenticatorBase] Security checking
> request GET
> /console/portal//Server/Server%20Logs/__ac0x3console-base0x2LogViewer!1535651776|1
> 84390: 23:50:38,941 DEBUG [AuthenticatorBase] We have cached auth
> type FORM for principal
> [EMAIL PROTECTED]
> 84391: 23:50:38,941 DEBUG [AuthenticatorBase] Calling
> hasUserDataPermission()
> 84392: 23:50:38,941 DEBUG [AuthenticatorBase] Calling authenticate()
> 84393: 23:50:38,941 DEBUG [FormAuthenticator] Already authenticated 'system'
> 84394: 23:50:38,941 DEBUG [AuthenticatorBase] Calling accessControl()
> 84395: 23:50:38,941 DEBUG [AuthenticatorBase] Successfully passed all
> security constraints
> 84396: 23:50:38,941 TRACE [StandardWrapper] Returning non-STM instance
> 84397: 23:50:38,942 TRACE [StandardWrapper] Returning non-STM instance
> 84398: 23:50:38,945 DEBUG [CoyoteAdapter] Requested cookie session id
> is 27D8EC25DC047479A6FB368DDB730876
> 84399: 23:50:38,945 DEBUG [AuthenticatorBase] Security checking
> request GET
> /console/portal//Server/Server%20Logs/__rp0x3console-base0x2LogViewer!1535651776|1_logFile/0x3home0x3super0x3bin0x3geronimo-tomcat6-javaee5-20x210x3var0x3log0x3geronimo0x2log/__rp0x3console-base0x2LogViewer!1535651776|1_action/search/__rp0x3console-base0x2LogViewer!1535651776|1_logLevel/TRACE/__rp0x3console-base0x2LogViewer!1535651776|1_maxRows/50
> 84400: 23:50:38,945 DEBUG [AuthenticatorBase] We have cached auth
> type FORM for principal
> [EMAIL PROTECTED]
> 84401: 23:50:38,945 DEBUG [AuthenticatorBase] Calling
> hasUserDataPermission()
> 84402: 23:50:38,945 DEBUG [AuthenticatorBase] Calling authenticate()
> 84403: 23:50:38,945 DEBUG [FormAuthenticator] Already authenticated 'system'
> 84404: 23:50:38,946 DEBUG [AuthenticatorBase] Calling accessControl()
> 84405: 23:50:38,946 DEBUG [AuthenticatorBase] Successfully passed all
> security constraints
> 84406: 23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
> 84407: 23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
> 84408: 23:50:38,947 TRACE [StandardWrapper] Returning non-STM instance
> 84409: 23:50:39,129 TRACE [StandardWrapper] Returning non-STM instance
> 84410: 23:50:39,130 TRACE [StandardWrapper] Returning non-STM instance
> 84411: 23:50:39,131 TRACE [StandardWrapper] Returning non-STM instance
> 84412: 23:50:39,132 INFO [SupportedModesServiceImpl] Portlet mode
> 'edit' not found for portletId:
> '/console-base.LogManager!1535651776|0'
> 84413: 23:50:39,140 TRACE [StandardWrapper] Returning non-STM instance
> 84414: 23:50:39,146 TRACE [StandardWrapper] Returning non-STM instance
>
>
>
>
>
>
> On Tue, Apr 8, 2008 at 3:25 AM, David Blevins <[EMAIL PROTECTED]> wrote:
> >
> > On Apr 7, 2008, at 8:36 AM, CG wrote:
> >
> > > Hi all,
> > > After googling again, I have solved the problem by changing the
> > > jndi.properties , localhost:4201 to 127.0.0.1:4201.
> > >
> >
> > You can use "localhost" as a host, you just need to add
> > "ejbd://localhost:4201" due to the way URIs are parsed. In the openejb 3.0
> > final up for a vote now, we check your provider url string a bit more
> before
> > giving it to java.net.URI and make corrections.
> >
> >
> >
> > > After solving that , another problem coming up , I still need time to
> > > do more searching.
> > >
> >
> > Happy to help when you get the details.
> >
> > -David
> >
> >
> >
> >
> > >
> > >
> > > CG
> > >
> > > On Mon, Apr 7, 2008 at 9:29 PM, CG <[EMAIL PROTECTED]> wrote:
> > >
> > > > Forget to attach the error message in the previous mail, here it is.
> > > >
> > > > Error
> > > > ====
> > > > javax.naming.AuthenticationException: Cannot connect to server
> > > > 'localhost:4201"; nested exception is:
> > > > java.io.IOException: Cannot connect to server: 'localhost:4201'
> > due
> > > > to an unkown exception in the OpenEJB client:
> > > > java.lang.IllegalArgumentException : port out of range:-1
> > > > at
> > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
> > > > at
> >
> org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
> > > > at
> > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> > > >
> > > > at
> > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> > > > at javax.naming.InitialContext.init(InitialContext.java:223)
> > > > at javax.naming.InitialContext.<init>(InitialContext.java:175)
> > > > at
> >
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
> > > > Exception in thread "main" java.lang.RuntimeException:
> > > > javax.naming.AuthenticationException: Cannot connect to server
> > > > 'localhost:4201"; nested exception is:
> > > > java.io.IOException: Cannot connect to server: 'localhost:4201'
> > due
> > > > to an unkown exception in the OpenEJB client:
> > > > java.lang.IllegalArgumentException : port out of range:-1
> > > > at
> >
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
> > > > Caused by: javax.naming.AuthenticationException: Cannot connect to
> > > > server 'localhost:4201"; nested exception is:
> > > > java.io.IOException: Cannot connect to server: 'localhost:4201'
> > due
> > > > to an unkown exception in the OpenEJB client:
> > > > java.lang.IllegalArgumentException : port out of range:-1
> > > > at
> > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
> > > > at
> >
> org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
> > > > at
> > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> > > >
> > > > at
> > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> > > > at javax.naming.InitialContext.init(InitialContext.java:223)
> > > > at javax.naming.InitialContext.<init>(InitialContext.java:175)
> > > > at
> >
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Mon, Apr 7, 2008 at 9:19 PM, CG <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > Hi all,
> > > > > I have managed to add the appropriate library but encounter another
> > problem.
> > > > >
> > > > > It seems like port 4201 does not have the JNDI provider service
> > running.
> > > > >
> > > > > May I know whether geronimo built-in with JNDI provider service or
> > not?
> > > > > I noticed that there is LDAP service (which can be a JNDI provider
> > > > > service to my understanding)running at port 1389 , and I tried to
> > > > > change the jndi.properties to connect to port 1389 instead , however,
> > > > > no luck , error still persist.
> > > > >
> > > > > any idea ?
> > > > >
> > > > > Thanks in advanced.
> > > > >
> > > > > CG
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Mon, Apr 7, 2008 at 7:56 PM, CG <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > > thanks david.
> > > > > >
> > > > > > I just wonder how do I add those libraries in the classpath in
> > eclipse
> > > > > > ? Is it going to Build path > add external jar ?
> > > > > >
> > > > > > Isn't the GEP have added those thing automatically ?
> > > > > >
> > > > > > thanks for your patient to guide a newbie of Java & eclipse.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Sun, Apr 6, 2008 at 11:21 PM, David Jencks
> > <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > > The library you need in your client classpath is at
> > > > > > >
> > > > > > >
> > repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
> > > > > > >
> > > > > > > thanks
> > > > > > > david jencks
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Apr 6, 2008, at 7:53 AM, CG wrote:
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > Hi, I am facing problem in using JNDI to do lookup. I have
> tried
> > to
> > > > > > > > solve several problem using google before hitting this
> > > > > > > >
> > > > > > > > I have materialType.properties and jndi.properties file
> deployed
> > in
> > > > > > > >
> > > > > > > geronimo
> > > > > > >
> > > > > > > >
> > > > > > > > materialType.properties
> > > > > > > > ================
> > > > > > > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
> > > > > > > >
> > > > > > > > jndi.properties
> > > > > > > > ============
> > > > > > > >
> > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
> > > > > > > > java.naming.provider.url=localhost:4201
> > > > > > > > java.naming.security.principal=system
> > > > > > > > java.naming.security.credentials=manager
> > > > > > > >
> > > > > > > >
> > > > > > > > The problem I face seems like not able to find the class
> > > > > > > > org.openejb.client.RemoteInitialContextFactory .
> > > > > > > > I think the reason should be openejb library missing or invalid
> > but I
> > > > > > > > can't figure out where the openejb library in geronimo ..
> > > > > > > > Any help is appreciated , thanks.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Error msg
> > > > > > > > =========
> > > > > > > >
> > > > > > > > javax.naming.NoInitialContextException: Cannot instantiate
> > class:
> > > > > > > > org.openejb.client.RemoteInitialContextFactory [Root exception
> > is
> > > > > > > > java.lang.ClassNotFoundException:
> > > > > > > > org.openejb.client.RemoteInitialContextFactory]
> > > > > > > > at
> > > > > > > >
> > > > > > >
> > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
> > > > > > >
> > > > > > > > at
> > > > > > > >
> > > > > > >
> > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> > > > > > >
> > > > > > > > at
> > javax.naming.InitialContext.init(InitialContext.java:223)
> > > > > > > > at
> > javax.naming.InitialContext.<init>(InitialContext.java:175)
> > > > > > > > at
> > > > > > > >
> > > > > > >
> >
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
> > > > > > >
> > > > > > > > Caused by: java.lang.ClassNotFoundException:
> > > > > > > > org.openejb.client.RemoteInitialContextFactory
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > <more codes>
> > > > > > > > ::
> > > > > > > > InitialContext context;
> > > > > > > > MaterialTestBeanRemote beanRemote = null;
> > > > > > > > ResourceBundle bundle = null;
> > > > > > > >
> > > > > > > > bundle = ResourceBundle.getBundle("materialType",
> > > > > > > > Locale.getDefault(),
> > FirstEJB3TutorialClient.class.getClassLoader());
> > > > > > > > String jndiName =
> > bundle.getString("jndi.process.ejb");
> > > > > > > > try
> > > > > > > > {
> > > > > > > > context = new InitialContext();
> > > > > > > > beanRemote = (MaterialTestBeanRemote)
> > > > > > > > context.lookup(MaterialTestBean.RemoteJNDIName);
> > > > > > > > beanRemote.testMaterial();
> > > > > > > > beanRemote.testMaterialType();
> > > > > > > > }
> > > > > > > >
> > > > > > > > <more codes>
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>