2 Replies Latest reply on May 16, 2007 1:12 PM by neisan

    Error connecting Oracle database during JBoss startup

    neisan

      Hi there,

      I?m trying to execute an Entity EJB 3.0 created with JBOSS IDE 2.0 for eclipse and JBOSS 4.0.4. It happens I?m getting an exception when I start the Jboss server inside eclipse regarding the database. I looked at the JNDI view and there is the entry ?OracleDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)?. I?m getting the following exception in the Jboss startup:

      19:13:29,480 INFO [Ejb3Configuration] found EJB3 Entity bean: test.ejbs.Person
      19:13:29,480 WARN [Ejb3Configuration] Persistence provider caller does not implements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
      19:13:29,605 INFO [Configuration] Reading mappings from resource: META-INF/orm.xml
      19:13:29,605 INFO [Ejb3Configuration] [PersistenceUnit: shoestringPU] no META-INF/orm.xml found
      19:13:29,715 INFO [AnnotationBinder] Binding entity from annotated class: test.ejbs.Person
      19:13:29,793 INFO [EntityBinder] Bind entity test.ejbs.Person on table Person
      19:13:30,090 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
      19:13:30,105 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
      19:13:37,090 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: ORA-01017: invalid username/password; logon denied
      )

      I have the following content in the xml files:

      The oracle-ds.xml:

       <?xml version="1.0" encoding="UTF-8" ?>
      - <!-- =====================================================================
       -->
      - <!--
       -->
      - <!-- JBoss Server Configuration
       -->
      - <!--
       -->
      - <!-- =====================================================================
       -->
      - <!-- $Id: oracle-ds.xml,v 1.6 2004/09/15 14:37:40 loubyansky Exp $
       -->
      - <!-- ====================================================================
       -->
      - <!-- Datasource config for Oracle originally from Steven Coy
       -->
      - <!-- ====================================================================
       -->
      - <datasources>
      - <local-tx-datasource>
       <jndi-name>OracleDS</jndi-name>
       <connection-url>jdbc:oracle:thin:@mydbserver:1521:dese</connection-url>
      - <!--
      
       Here are a couple of the possible OCI configurations.
       For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm
      
       <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
       or
       <connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>
      
       Clearly, its better to have TNS set up properly.
      
      
       -->
       <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
       <user-name>x</user-name>
       <password>y</password>
      - <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool
       -->
      - <!-- valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name
       -->
      - <!-- Checks the Oracle error codes and messages for fatal errors
       -->
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      - <!--
       sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
      
      
       -->
      - <!--
       sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      
      
       -->
      - <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional)
       -->
      - <metadata>
       <type-mapping>Oracle9i</type-mapping>
       </metadata>
       </local-tx-datasource>
       </datasources>
      


      The standardjaws.xml:

       <?xml version="1.0" encoding="UTF-8" ?>
       <!DOCTYPE jbosscmp-jdbc (View Source for full doctype...)>
      - <!-- =====================================================================
       -->
      - <!--
       -->
      - <!-- Standard Jaws Configuration
       -->
      - <!--
       -->
      - <!-- =====================================================================
       -->
      - <!-- $Id: standardjaws.xml,v 1.30 2002/06/27 19:26:28 dsundstrom Exp $
       -->
      - <jaws>
       <datasource>java:/OracleDS</datasource>
       <type-mapping>Oracle8</type-mapping>
       </jaws>
      


      The standardjbosscmp-jdbc.xml:

       <?xml version="1.0" encoding="UTF-8" ?>
       <!DOCTYPE jbosscmp-jdbc (View Source for full doctype...)>
      - <!-- =====================================================================
       -->
      - <!--
       -->
      - <!-- Standard JBossCMP-JDBC Configuration
       -->
      - <!--
       -->
      - <!-- =====================================================================
       -->
      - <!-- $Id: standardjbosscmp-jdbc.xml,v 1.84.2.8 2006/03/06 14:38:05 aloubyansky Exp $
       -->
      - <jbosscmp-jdbc>
      - <defaults>
       <datasource>java:/OracleDS</datasource>
       <datasource-mapping>Oracle8</datasource-mapping>
       </defaults>
       </jbosscmp-jdbc>
      


      The login-config.xml:

       <?xml version="1.0" ?>
       <!DOCTYPE policy (View Source for full doctype...)>
      - <!--
       The XML based JAAS login configuration read by the
      org.jboss.security.auth.login.XMLLoginConfig mbean. Add
      an application-policy element for each security domain.
      
      The outline of the application-policy is:
      <application-policy name="security-domain-name">
       <authentication>
       <login-module code="login.module1.class.name" flag="control_flag">
       <module-option name = "option1-name">option1-value</module-option>
       <module-option name = "option2-name">option2-value</module-option>
       ...
       </login-module>
      
       <login-module code="login.module2.class.name" flag="control_flag">
       ...
       </login-module>
       ...
       </authentication>
      </application-policy>
      
      
      
       -->
      - <policy>
      - <!--
       Used by clients within the application server VM such as
       mbeans and servlets that access EJBs.
      
      
       -->
      - <application-policy name="client-login">
      - <authentication>
      - <login-module code="org.jboss.security.ClientLoginModule" flag="required">
      - <!-- Any existing security context will be restored on logout
       -->
       <module-option name="restore-login-identity">true</module-option>
       </login-module>
       </authentication>
       </application-policy>
      - <!-- Security domain for JBossMQ
       -->
      - <application-policy name="jbossmq">
      - <authentication>
      - <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
       <module-option name="unauthenticatedIdentity">guest</module-option>
       <module-option name="dsJndiName">java:/DefaultDS</module-option>
       <module-option name="principalsQuery">SELECT PASSWD FROM JMS_USERS WHERE USERID=?</module-option>
       <module-option name="rolesQuery">SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?</module-option>
       </login-module>
       </authentication>
       </application-policy>
      - <!--
       Security domain for JBossMQ when using file-state-service.xml
       <application-policy name = "jbossmq">
       <authentication>
       <login-module code = "org.jboss.mq.sm.file.DynamicLoginModule"
       flag = "required">
       <module-option name = "unauthenticatedIdentity">guest</module-option>
       <module-option name = "sm.objectname">jboss.mq:service=StateManager</module-option>
       </login-module>
       </authentication>
       </application-policy>
      
      
       -->
      - <!-- Security domains for testing new jca framework
       -->
      - <application-policy name="HsqlDbRealm">
      - <authentication>
      - <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
       <module-option name="principal">sa</module-option>
       <module-option name="userName">sa</module-option>
       <module-option name="password" />
       <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
       </login-module>
       </authentication>
       </application-policy>
      - <application-policy name="JmsXARealm">
      - <authentication>
      - <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
       <module-option name="principal">guest</module-option>
       <module-option name="userName">guest</module-option>
       <module-option name="password">guest</module-option>
       <module-option name="managedConnectionFactoryName">jboss.jca:service=TxCM,name=JmsXA</module-option>
       </login-module>
       </authentication>
       </application-policy>
      - <!--
       A template configuration for the jmx-console web application. This
       defaults to the UsersRolesLoginModule the same as other and should be
       changed to a stronger authentication mechanism as required.
      
      
       -->
      - <application-policy name="jmx-console">
      - <authentication>
      - <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
       <module-option name="usersProperties">props/jmx-console-users.properties</module-option>
       <module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>
       </login-module>
       </authentication>
       </application-policy>
      - <!--
       A template configuration for the web-console web application. This
       defaults to the UsersRolesLoginModule the same as other and should be
       changed to a stronger authentication mechanism as required.
      
      
       -->
      - <application-policy name="$webConsoleDomain">
      - <authentication>
      - <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
       <module-option name="usersProperties">web-console-users.properties</module-option>
       <module-option name="rolesProperties">web-console-roles.properties</module-option>
       </login-module>
       </authentication>
       </application-policy>
      - <!--
       A template configuration for the JBossWS web application (and transport layer!).
       This defaults to the UsersRolesLoginModule the same as other and should be
       changed to a stronger authentication mechanism as required.
      
      
       -->
      - <application-policy name="JBossWS">
      - <authentication>
      - <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
       <module-option name="usersProperties">props/jbossws-users.properties</module-option>
       <module-option name="rolesProperties">props/jbossws-roles.properties</module-option>
       <module-option name="unauthenticatedIdentity">anonymous</module-option>
       </login-module>
       </authentication>
       </application-policy>
      - <!--
       The default login configuration used by any security domain that
       does not have a application-policy entry with a matching name
      
      
       -->
      - <application-policy name="other">
      - <!--
       A simple server login module, which can be used when the number
       of users is relatively small. It uses two properties files:
       users.properties, which holds users (key) and their password (value).
       roles.properties, which holds users (key) and a comma-separated list of
       their roles (value).
       The unauthenticatedIdentity property defines the name of the principal
       that will be used when a null username and password are presented as is
       the case for an unuathenticated web client or MDB. If you want to
       allow such users to be authenticated add the property, e.g.,
       unauthenticatedIdentity="nobody"
      
      
       -->
      - <authentication>
       <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required" />
       </authentication>
       </application-policy>
      - <application-policy name="OracleDbRealm">
      - <authentication>
      - <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
       <module-option name="principal">sa</module-option>
       <module-option name="myuser">sa</module-option>
       <module-option name="mypassword" />
       <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option>
       </login-module>
       </authentication>
       </application-policy>
       </policy>
      


      The persistence.xml file:

       <?xml version="1.0" encoding="UTF-8" ?>
      - <persistence>
      - <persistence-unit name="shoestringPU">
       <jta-data-source>java:/OracleDS</jta-data-source>
      - <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
       <property name="hibernate.hbm2ddl.auto" value="none" />
       </properties>
       </persistence-unit>
       </persistence>
      


      I'm not using hibernate to create the tables. But, as I said, this happens during JBoss startup. I would appreciate any help.

      Thank you.

      Nei