10 Replies Latest reply on Aug 14, 2002 11:55 AM by davidjencks

    JBoss 3/postgres SECOND connection fails

    lfinis

      I'm trying to connect to postgres from latest JBOSS.
      First connection seems to be fine, but all connections after that fail with "Authentification failed for user ...".
      The only way to connect again is to redeploy the app.

      Thanks.

        • 1. Re: JBoss 3/postgres SECOND connection fails
          davidjencks

          I'm not having this problem. Post lots more details.

          • 2. Re: JBoss 3/postgres SECOND connection fails
            lfinis

            I could reproduce the problem few times before Solaris crashed (I use x86)

            Now i cannot create even first session. (login and pwd for postgres are correct)
            .
            I attached my postgres-service.xml and stack trace.
            (i don't user jaas)

            Thanks again

            • 3. Re: JBoss 3/postgres SECOND connection fails
              lfinis

              I'm not sure that attached files are ok so here their are:

              <?xml version="1.0" encoding="UTF-8"?>

              <!-- ======================================================================================== -->
              <!-- New ConnectionManager setup for default PostgreSQL dbs -->
              <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
              <!-- To avoid class not found headaches, copy your postgres driver to the jboss lib directory -->
              <!-- ======================================================================================== -->




              <depends optional-attribute-name="ManagedConnectionFactoryName">
              <!--embedded mbean-->

              <!-- ========== Set the JndiName ======================= -->
              PostgresDS


              <config-property name="ConnectionURL" type="java.lang.String">jdbc:postgresql://pentium4/leonid_db</config-property>
              <config-property name="DriverClass" type="java.lang.String">org.postgresql.Driver</config-property>
              <!--set these only if you want only default logins, not through JAAS -->
              <config-property name="UserName" type="java.lang.String">leonid</config-property>
              <config-property name="Password" type="java.lang.String">leonid_pwd</config-property>



              <!--Below here are advanced properties -->
              <!--hack-->
              <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper

              <!--real attributes-->



              <depends optional-attribute-name="ManagedConnectionPool">
              <!--embedded mbean-->


              0
              50
              5000
              15
              <!--criteria indicates if Subject (from security domain) or app supplied
              parameters (such as from getConnection(user, pw)) are used to distinguish
              connections in the pool. Choices are
              ByContainerAndApplication (use both),
              ByContainer (use Subject),
              ByApplication (use app supplied params only),
              ByNothing (all connections are equivalent, usually if adapter supports
              reauthentication)-->
              ByContainer



              <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

              <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager

              java:/TransactionManager
              <!--make the rar deploy! hack till better deployment-->
              jboss.jca:service=RARDeployer











              Stack stace:
              java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
              java.rmi.ServerException: Unable to connect to database. Could not create connection; - nested throwable: (Something unusual has occured to cause the driver to fail. Please report this exception: Exception: java.sql.SQLException: FATAL 1: Password authentication failed for user "leonid"

              Stack Trace:

              java.sql.SQLException: FATAL 1: Password authentication failed for user "leonid"

              at org.postgresql.Connection.openConnection(Connection.java:178)
              at org.postgresql.Driver.connect(Driver.java:149)
              at java.sql.DriverManager.getConnection(DriverManager.java:512)
              at java.sql.DriverManager.getConnection(DriverManager.java:140)
              at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:133)
              at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnection(InternalManagedConnectionPool.java:236)
              at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:101)
              at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:312)
              at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:467)
              at org.jboss.resource.connectionmanager.LocalTxConnectionManager.getManagedConnection(LocalTxConnectionManager.java:221)
              at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:532)
              at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:812)
              at org.jboss.resource.adapter.jdbc.local.LocalDataSource.getConnection(LocalDataSource.java:102)
              at EntityBeanTest.EntityBeanTestBean.connect(EntityBeanTestBean.java:155)
              at EntityBeanTest.EntityBeanTestBean.setEntityContext(EntityBeanTestBean.java:57)
              at org.jboss.ejb.EntityEnterpriseContext.(EntityEnterpriseContext.java:76)
              at org.jboss.ejb.plugins.EntityInstancePool.create(EntityInstancePool.java:86)
              at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:208)
              at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:122)
              at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
              at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
              at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
              at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
              at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
              at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:104)
              at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
              at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
              at org.jboss.ejb.Container.invoke(Container.java:726)
              at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
              at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
              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:324)
              at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
              at sun.rmi.transport.Transport$1.run(Transport.java:148)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
              at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
              at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
              at java.lang.Thread.run(Thread.java:536)
              End of Stack Trace

              • 4. Re: JBoss 3/postgres SECOND connection fails
                davidjencks

                Looks ok for 3.0.1, is that what you are running? I don't see what could be wrong, are you sure Postgres is working ok?

                • 5. Re: JBoss 3/postgres SECOND connection fails
                  davidjencks

                  Looks ok for 3.0.1, is that what you are running? I don't see what could be wrong, are you sure Postgres is working ok?

                  • 6. Re: JBoss 3/postgres SECOND connection fails
                    lfinis

                    Postgres works OK. I tried simple JDBC test and it's fine. (with exactly same user and pwd)
                    First connection was doing fine too(cannot reproduce now).
                    Since for the first connection the parameters were ok, i think the problem is not in usr/pwd or postgres.
                    I use JBOSS 3.0.0.
                    I'm not obligated to use JAAS, right?

                    • 7. Re: JBoss 3/postgres SECOND connection fails
                      davidjencks

                      I didn't think that config worked with 3.0.0
                      I recommend trying 3.0.1 anyway, at some point there were some classloader problems that produced bizarre errors: it is just possible this is one of them.

                      • 8. Re: JBoss 3/postgres SECOND connection fails
                        lfinis

                        Thanks for help.
                        I think i found the problem: it occures only when Postgres is congigured to md5 authentification method. all methods other than that (crypt, password) work fine. May be it's driver issue.

                        Where can i get JBOSS 3.0.1? CVS build?
                        The official build in download area is 3.0.0

                        Thanks again.

                        • 9. Re: JBoss 3/postgres SECOND connection fails
                          l.g.

                          Try this PostgreSQL JDBC 1/2/3 driver:
                          http://sourceforge.net/projects/jxdbcon/

                          • 10. Re: JBoss 3/postgres SECOND connection fails
                            davidjencks

                            I recommend always looking here for downloads:

                            http://sourceforge.net/project/showfiles.php?group_id=22866

                            Noone ever updates the jboss site download list. Maybe I will update it so it just points to the sourceforge site.