Probably this is a bug, although I'm surprised we haven't seen it before.

Can you please outline your scenario a bit more?

- is this work done from a secured part of your application, so there is a subject available? - do you want database access to be "secured" based on the default user/password supplied in the connector plan, or do you want the password credentials to be determined from the user in some way (such as using the user/pw of the actual user to access the database).

If you want the db credentials to be determined from the actual user, then this is only a configuration problem in your app. You need to include a login module in your login configuration that will construct the PasswordCredential for the connector framework to use. However, AFAIK this hasn't been tested much for a long time and may have broken. You include the CallerIdentityPasswordCredentialLoginModule and install it in the login config using the PasswordCredentialLoginModuleWrapperGBean instead of the regular LoginModuleGBean. You can also write a different LoginModule that can apply some mapping between the actual user and database user.

thanks
david jencks

On Apr 27, 2007, at 11:49 PM, Bert_nor wrote:


The Subject in org.tranql.connector.CredentialExtractor.matches (...) is not
null, but not contain private credential
javax.resource.spi.security.PasswordCredential for extract username and
password.

Stack trace:
<0.9.7-incubating-SNAPSHOT nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: java.sql.SQLException
        at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException (DBDictionary.java:3781)
        at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore (SQLExceptions.java:94)
        at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore (SQLExceptions.java:80)
        at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore (SQLExceptions.java:56)
        at
org.apache.openjpa.jdbc.sql.OracleDictionary.ensureDriverVendor (OracleDictionary.java:235)
        at
org.apache.openjpa.jdbc.sql.OracleDictionary.toSelect (OracleDictionary.java:344)
        at
org.apache.openjpa.jdbc.sql.DBDictionary.toSelect(DBDictionary.java: 1959) at org.apache.openjpa.jdbc.sql.SelectImpl.toSelect(SelectImpl.java: 200) at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java: 331) at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java: 314)
        at
org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute (LogicalUnion.java:404) at org.apache.openjpa.jdbc.sql.LogicalUnion.execute (LogicalUnion.java:215) at org.apache.openjpa.jdbc.sql.LogicalUnion.execute (LogicalUnion.java:205)
        at
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open (SelectResultObjectProvider.java:91) at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java: 1270)
        at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1207)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:982)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:791)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:761)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:757)
        at
org.apache.openjpa.kernel.DelegatingQuery.execute (DelegatingQuery.java:514) at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java: 225)
        at
org.apache.openjpa.persistence.QueryImpl.getSingleResult (QueryImpl.java:287)
        at ru.mev.j2report.ejb.session.UserBean.getUserInfo(UserBean.java:19)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext $Invocation.invoke(ReflectionInvocationContext.java:135)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.procee d(ReflectionInvocationContext.java:118)
        at
org.apache.openejb.core.interceptor.InterceptorStack.invoke (InterceptorStack.java:73)
        at
org.apache.openejb.core.stateful.StatefulContainer._invoke (StatefulContainer.java:408)
        at
org.apache.openejb.core.stateful.StatefulContainer.businessMethod (StatefulContainer.java:370)
        at
org.apache.openejb.core.stateful.StatefulContainer.invoke (StatefulContainer.java:249)
        at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod (EjbObjectProxyHandler.java:184)
        at
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke (EjbObjectProxyHandler.java:60)
        at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke (BaseEjbProxyHandler.java:215)
        at
org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke (Jdk13InvocationHandler.java:49)
        at $Proxy68.getUserInfo(Unknown Source)
        at
ru.mev.j2report.ws.services.UserWSImpl.getCurrentUser (UserWSImpl.java:20)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.cxf.service.invoker.AbstractInvoker.invoke (AbstractInvoker.java:68)
        at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke (JAXWSMethodInvoker.java:63)
        at
org.apache.cxf.service.invoker.AbstractInvoker.invoke (AbstractInvoker.java:55)
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run (ServiceInvokerInterceptor.java:57)
        at
org.apache.cxf.workqueue.SynchronousExecutor.execute (SynchronousExecutor.java:37)
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage (ServiceInvokerInterceptor.java:79)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept (PhaseInterceptorChain.java:168)
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage (ChainInitiationObserver.java:64)
        at
org.apache.geronimo.cxf.GeronimoDestination.invoke (GeronimoDestination.java:93)
        at
org.apache.geronimo.cxf.CXFWebServiceContainer.invoke (CXFWebServiceContainer.java:102)
        at
org.apache.geronimo.webservices.WebServiceContainerInvoker.service (WebServiceContainerInvoker.java:84)
        at
org.apache.geronimo.webservices.POJOWebServiceServlet.service (POJOWebServiceServlet.java:79) at org.mortbay.jetty.servlet.ServletHolder.handle (ServletHolder.java:467) at org.mortbay.jetty.servlet.ServletHandler.handle (ServletHandler.java:367)
        at
org.mortbay.jetty.security.SecurityHandler.handle (SecurityHandler.java:185)
        at
org.apache.geronimo.jetty6.handler.JettySecurityHandler.handle (JettySecurityHandler.java:133) at org.mortbay.jetty.servlet.SessionHandler.handle (SessionHandler.java:181)
        at
org.apache.geronimo.jetty6.handler.ThreadClassloaderHandler.handle (ThreadClassloaderHandler.java:46)
        at
org.apache.geronimo.jetty6.handler.InstanceContextHandler.handle (InstanceContextHandler.java:58) at org.mortbay.jetty.handler.ContextHandler.handle (ContextHandler.java:715) at org.mortbay.jetty.webapp.WebAppContext.handle (WebAppContext.java:402)
        at
org.apache.geronimo.jetty6.handler.ComponentContextHandler.handle (ComponentContextHandler.java:47)
        at
org.mortbay.jetty.handler.ContextHandlerCollection.handle (ContextHandlerCollection.java:211)
        at
org.mortbay.jetty.handler.HandlerCollection.handle (HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.java:139)
        at org.mortbay.jetty.Server.handle(Server.java:285)
at org.mortbay.jetty.HttpConnection.handleRequest (HttpConnection.java:469)
        at
org.mortbay.jetty.HttpConnection$RequestHandler.content (HttpConnection.java:805)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:710)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:203)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:358)
        at
org.mortbay.jetty.bio.SocketConnector$Connection.run (SocketConnector.java:226)
        at
org.mortbay.thread.BoundedThreadPool$PoolThread.run (BoundedThreadPool.java:442)
Caused by: java.sql.SQLException
at org.tranql.connector.jdbc.DataSource.getConnection (DataSource.java:61) at $javax.sql.DataSource$$FastClassByCGLIB$$6525cafd.invoke (<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
        at
org.apache.geronimo.connector.ConnectorMethodInterceptor.intercept (ConnectorMethodInterceptor.java:54)
        at
$javax.sql.DataSource$$EnhancerByCGLIB$$44e48b79.getConnection (<generated>)
        at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection (DelegatingDataSource.java:103)
        at
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection (DecoratingDataSource.java:84)
        at
org.apache.openjpa.jdbc.sql.OracleDictionary.ensureDriverVendor (OracleDictionary.java:232)
        ... 72 more
Caused by: javax.resource.spi.ResourceAdapterInternalException: No
credential found for this ManagedConnectionFactory:
LocalMCF[jdbc:oracle:thin:...]
        at
org.tranql.connector.CredentialExtractor.matches (CredentialExtractor.java:66)
        at
org.tranql.connector.jdbc.ManagedJDBCConnection.matches (ManagedJDBCConnection.java:67)
        at
org.tranql.connector.jdbc.AbstractLocalDataSourceMCF.matchManagedConne ctions(AbstractLocalDataSourceMCF.java:81)
        at
org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor .internalGetConnection(SinglePoolConnectionInterceptor.java:87)
        at
org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInt erceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java: 78)
        at
org.apache.geronimo.connector.outbound.SubjectInterceptor.getConnectio n(SubjectInterceptor.java:56)
        at
org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.get Connection(ConnectionHandleInterceptor.java:43)
        at
org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection (TCCLInterceptor.java:39)
        at
org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor.g etConnection(ConnectionTrackingInterceptor.java:66)
        at
org.apache.geronimo.connector.outbound.AbstractConnectionManager.alloc ateConnection(AbstractConnectionManager.java:61) at org.tranql.connector.jdbc.DataSource.getConnection (DataSource.java:56)
        ... 79 more

ps. When I use this connector for authentication(GERONIMO-3083) the subject
is null and  I successfully receive connection.

Geronimo 2.0-M4


--
View this message in context: http://www.nabble.com/Error-at- getting-datasource-from-connector%28container-managed-security%29- tf3661217s134.html#a10230369 Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Reply via email to