1 Reply Latest reply on Apr 14, 2004 2:26 PM by Scott Stark

    ConfiguredIdentityLoginModule with Oracle DS

    lshepherd Newbie

      Every time I call getConnection() on the oracle ds, i get "Authentication exception: principal=null.

      Can anyone tell me what I'm doing wrong?
      Here's the code that tries to obtain the connection:

      ctx = new InitialContext();
       DataSource ds = (DataSource) ctx.lookup("java:/OracleDS");
       Connection conn = ds.getConnection();
      


      And this is the mbean element in jboss-service.xml that I've written:

      <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager"
       name="jboss.jca:service=LocalTxCM,name=OracleDS">
       <depends optional-attribute-name="ManagedConnectionPool">
       <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool"
       name="jboss.jca:service=LocalTxPool,name=OracleDS">
       <depends optional-attribute-name="ManagedConnectionFactoryName">
       <mbean code="org.jboss.resource.connectionmanager.RARDeployment"
       name="jboss.jca:service=LocalTxDS,name=OracleDS">
       <attribute name="ManagedConnectionFactoryProperties">
       <properties>
       <config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:thin:@tstdbs01:1521:devweb1</config-property>
       <config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
       <config-property name="UserName" type="java.lang.String">lxs</config-property>
       <config-property name="Password" type="java.lang.String">lxs</config-property>
       </properties>
       </attribute>
       <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper</depends>
       </mbean>
       </depends>
       <attribute name="MinSize">1</attribute>
       <attribute name="MaxSize">50</attribute>
       <attribute name="BlockingTimeoutMillis">5000</attribute>
       <attribute name="IdleTimeoutMinutes">15</attribute>
       <attribute name="Criteria">ByContainer</attribute>
       </mbean>
       </depends>
       <depends optional-attribute-name="CachedConnectionManager">
       jboss.jca:service=CachedConnectionManager
       </depends>
       <depends optional-attribute-name="JaasSecurityManagerService">
       jboss.security:service=JaasSecurityManager
       </depends>
       <attribute name="JndiName">OracleDS</attribute>
       <attribute name="TransactionManager">
       java:/TransactionManager
       </attribute>
       <depends>jboss.jca:service=RARDeployer</depends>
       <application-policy name="DbRealm">
       <authentication>
       <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
       <module-option name="principal">lxs</module-option>
       <module-option name="userName">lxs</module-option>
       <module-option name="password">lxs</module-option>
       <module-option name="managedConnectionFactoryName">
       jboss.jca:service=LocalTxCM,name=OracleDS
       </module-option>
       </login-module>
       </authentication>
       </application-policy>
       <attribute name="SecurityDomainJndiName">DbRealm</attribute>
       </mbean>
      


      And finally the stack trace:
      java.lang.SecurityException: Invalid authentication attempt, principal=null
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.getSubject(BaseConnectionManager2.java:647)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:476)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
       at com.hal.layne.struts.actions.ShorexFacadeTestAction.execute(ShorexFacadeTestAction.java:98)
       at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
       at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
       at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
       at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
       at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
       at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
       at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
       at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
       at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
       at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
       at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
       at java.lang.Thread.run(Thread.java:568)