2 Replies Latest reply on Jun 6, 2005 4:54 PM by John Doe

    Cannot open connection to database when starting server

    John Doe Newbie

      I am using:
      JBoss AS 4.0.2
      JBoss Portal 2.0 RC2.
      MySQL 4.1.0

      I am also using the all configuration instead of default because I want to use EJB 3.0.

      Here is the portal-mysql-ds.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>PortalDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:63306/jbossportal</connection-url>
       <driver-class>org.gjt.mm.mysql.Driver</driver-class>
       <user-name>admin</user-name>
       <password>admin</password>
       </local-tx-datasource>
      </datasources>
      
      


      This is the error I am getting:
      11:20:07,459 INFO [Environment] Hibernate 3.0.1
      11:20:07,469 INFO [Environment] hibernate.properties not found
      11:20:07,469 INFO [Environment] using CGLIB reflection optimizer
      11:20:07,469 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
      11:20:07,699 INFO [Configuration] configuring from url: file:/C:/Extracted/JBos
      s/jboss-4.0.2/server/all/deploy/jboss-portal.sar/conf/hibernate/hibernate.cfg.xm
      l
      11:20:07,719 INFO [Configuration] Mapping resource: org/jboss/portal/core/impl/
      role/RoleImpl.hbm.xml
      11:20:07,899 INFO [HbmBinder] Mapping class: org.jboss.portal.core.impl.role.Ro
      leImpl -> jbp_roles
      11:20:07,959 INFO [HbmBinder] Mapping collection: org.jboss.portal.core.impl.ro
      le.RoleImpl.users -> jbp_role_membership
      11:20:07,959 INFO [Configuration] Mapping resource: org/jboss/portal/core/impl/
      user/UserImpl.hbm.xml
      11:20:07,969 INFO [HbmBinder] Mapping class: org.jboss.portal.core.impl.user.Us
      erImpl -> jbp_users
      11:20:08,069 INFO [HbmBinder] Mapping collection: org.jboss.portal.core.impl.us
      er.UserImpl.dynamic -> jbp_user_prop
      11:20:08,069 INFO [HbmBinder] Mapping collection: org.jboss.portal.core.impl.us
      er.UserImpl.roles -> jbp_role_membership
      11:20:08,069 INFO [Configuration] Mapping resource: org/jboss/portal/core/impl/
      user/UserPref.hbm.xml
      11:20:08,079 INFO [HbmBinder] Mapping class: org.jboss.portal.core.impl.user.Us
      erPref -> jbp_user_pref
      11:20:08,079 INFO [HbmBinder] Mapping collection: org.jboss.portal.core.impl.us
      er.UserPref.strings -> jbp_user_pref_prop_value
      11:20:08,079 INFO [Configuration] Mapping resource: org/jboss/portal/core/impl/
      user/UserPrefSet.hbm.xml
      11:20:08,089 INFO [HbmBinder] Mapping class: org.jboss.portal.core.impl.user.Us
      erPrefSet -> jbp_user_pref_set
      11:20:08,089 INFO [Configuration] Configured SessionFactory: java:portal/Sessio
      nFactory
      11:20:08,089 INFO [Configuration] processing extends queue
      11:20:08,089 INFO [Configuration] processing collection mappings
      11:20:08,089 INFO [HbmBinder] Mapping collection: org.jboss.portal.core.impl.us
      er.UserPrefSet.children -> jbp_user_pref_set
      11:20:08,089 INFO [HbmBinder] Mapping collection: org.jboss.portal.core.impl.us
      er.UserPrefSet.content -> jbp_user_pref
      11:20:08,089 INFO [Configuration] processing association property references
      11:20:08,089 INFO [Configuration] processing foreign key constraints
      11:20:08,130 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
      11:20:08,150 INFO [SettingsFactory] Maximum outer join fetch depth: 2
      11:20:08,150 INFO [SettingsFactory] Default batch fetch size: 1
      11:20:08,150 INFO [SettingsFactory] Generate SQL with comments: disabled
      11:20:08,150 INFO [SettingsFactory] Order SQL updates by primary key: disabled
      11:20:08,150 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.AST
      QueryTranslatorFactory
      11:20:08,160 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
      11:20:08,160 INFO [SettingsFactory] Query language substitutions: {}
      11:20:08,170 INFO [NamingHelper] JNDI InitialContext properties:{}
      11:20:08,170 INFO [DatasourceConnectionProvider] Using datasource: java:PortalD
      S
      11:20:08,280 WARN [JBossManagedConnectionPool] Throwable while attempting to ge
      t a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested
       throwable: (java.sql.SQLException: Unable to connect to any hosts due to except
      ion: java.lang.NullPointerException)
      


      Here is some more of the errors:
      --- MBeans waiting for other MBeans ---
      ObjectName: portal:service=Hibernate
       State: FAILED
       Reason: org.hibernate.exception.GenericJDBCException: Cannot open connection
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=PortalDS
       Depends On Me:
       portal:service=Module,type=User
       portal:service=Module,type=Role
       portal:service=Module,type=Security
       portal:service=ServerManager
      
      ObjectName: portal.forums:service=Hibernate
       State: FAILED
       Reason: org.hibernate.exception.GenericJDBCException: Cannot open connection
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=PortalDS
      
      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: portal.forums:service=Hibernate
       State: FAILED
       Reason: org.hibernate.exception.GenericJDBCException: Cannot open connection
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=PortalDS
      
      ObjectName: portal:service=Hibernate
       State: FAILED
       Reason: org.hibernate.exception.GenericJDBCException: Cannot open connection
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=PortalDS
       Depends On Me:
       portal:service=Module,type=User
       portal:service=Module,type=Role
       portal:service=Module,type=Security
       portal:service=ServerManager
      


      Why is it not connecting? I have seen others who cannot connect and the server tells them why. Why is there a NullPointerException?