Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Authentication (login) failure

Authentication (login) failure

2004-07-08       - By Tim Wood

 Back
This should be obvious, but it isn't.

I have a Web service endpoint deployed as a J2EE stateless session bean (SSB)
in J2EE SDK 1.4.  I have configured it to perform a Basic login dialogue with
connecting SOAP clients.  I have registered the users and groups in the admin
tool, created the necessary role and mapped it in the deployment descriptor.
My client code sets up the stub properties for login per the Tutorial examples.
 Nevertheless I get the following stack trace and errors in the log.  The SOAP
call goes through, but the server side sees the user as ANONYMOUS instead of
the login user.  The "CLIENT CERT" part is puzzling as I've set up login
/password.
TIA,
TW


[#|2004-07-06T00:06:31.236-0700|WARNING|j2ee-appserver1.4|javax.enterprise
.system.container.ejb|_ThreadID=11;|CLIENT CERT http header parsing error for
ProviderIF|#]

[#|2004-07-06T00:06:31.246-0700|WARNING|j2ee-appserver1.4|javax.enterprise
.system.container.ejb|_ThreadID=11;|authentication failed for ProviderIF
java.lang.NullPointerException Source code of java.lang.NullPointerException
       at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:240)
       at com.sun.enterprise.webservice.EjbWebServiceValve.doSecurity
(EjbWebServiceValve.java:230)
       at com.sun.enterprise.webservice.EjbWebServiceValve
.dispatchToEjbEndpoint(EjbWebServiceValve.java:164)
       at com.sun.enterprise.webservice.EjbWebServiceValve.invoke
(EjbWebServiceValve.java:127)
...
       at org.apache.coyote.http11.Http11Processor Source code of org.apache.coyote.http11.Http11Processor(Http11Processor
.java:648)
       at org.apache.coyote.http11.Http11Protocol Source code of org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler
.processConnection(Http11Protocol.java:498)
       at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint
.java:575)
       at org.apache.tomcat.util.threads.ThreadPool Source code of org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:649)
       at java.lang.Thread Source code of java.lang.Thread(Thread.java:534)

Deployment descriptor:
sun-ejb-jar.xml:

   <ejb>
     <ejb-name>ProviderEJB</ejb-name>
     <jndi-name>ProviderEJB</jndi-name>
     <resource-ref>
       <res-ref-name>jdbc/MyApp-ProviderFacet-pub</res-ref-name>
       <jndi-name>jdbc/MyApp-ProviderFacet-pub</jndi-name>
     </resource-ref>
     <resource-ref>
       <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
       <jndi-name>jms/QueueConnectionFactory</jndi-name>
     </resource-ref>
     <webservice-endpoint>
       <port-component-name>ProviderIF</port-component-name>
       <endpoint-address-uri>OrderServer/Provider</endpoint-address-uri>
       <login-config>
         <auth-method>Basic</auth-method>
       </login-config>
     </webservice-endpoint>
   </ejb>

ejb-jar.xml:
   <enterprise-beans>
       <session>
           <ejb-name>ProviderEJB</ejb-name>
       ...
           <security-role-ref>
               <role-name>Provider</role-name>
               <role-link>Provider</role-link>
           </security-role-ref>
           <security-identity>
               <use-caller-identity>
               </use-caller-identity>
           </security-identity>
       </session>
       ...

Client-side code:
// Get the object that talks to the facet.
// This can be used via reflection Method calls, or
// cast to the actual interface class type and called
// directly.
// Get a service reference object
Service service =
       serviceFactory.createService(new URL(URLString),
       new QName(nameSpaceURI(index), m_svcName));

m_IFProxy = service.getPort(
       new QName(nameSpaceURI(index), IFName + "Port"),
       m_IFClass);

// Login with a username to establish artistID
((Stub) m_IFProxy)._setProperty(
 javax.xml.rpc.Stub Source code of javax.xml.rpc.Stub,
       "aUser");
((Stub) m_IFProxy)._setProperty(
 javax.xml.rpc.Stub Source code of javax.xml.rpc.Stub,
       "changeit");
// This shows the expected URL
System.out.println("endpoint "
       + (String) ((Stub) m_IFProxy)._getProperty(
         javax.xml.rpc.Stub Source code of javax.xml.rpc.Stub));

Server-side code (SSB class):

sessionContext.getCallerPrincipal().getName(); // Always returns ANONYMOUS
sessionContext.isCallerInRole("Provider"); // Always FALSE

PS I had to send this message 3 times: first it was rejected because the
subject started with "login"; second it was rejected at a different level
because the text was the same as the 1st.  Here we go again. good night.

===========================================================================
To unsubscribe, send email to listserv@(protected) and include in the body
of the message "signoff J2EE-INTEREST".  For general help, send email to
listserv@(protected) and include in the body of the message "help".

©2008 junlu.com - Jax Systems, LLC, U.S.A.