2 Replies Latest reply on Nov 17, 2010 8:48 PM by 444251

    Network Connection Error 17002

    444251
      Hi All,

      I have a new EJB project which I created using this tutorial. http://st-curriculum.oracle.com/obe/jdev/obe1013jdev/10131/10131_ejb_30/ejb_30.htm

      I replaced the instructions for creating a database connection with placing information in the persistence.xml file:

      <?xml version="1.0" encoding="windows-1252" ?>
      <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
      version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
      <persistence-unit name="DataService">
      <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
      <!-- All persistence classes must be listed -->
      <class>mil.af.rs.bs.beans.entity.ApplicantStatusData</class>
      <properties>
      <!-- Provider-specific connection properties -->
      <property name="jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
      <property name="jdbc.connection.string" value="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=131.44.78.131)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=131.44.78.132)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=TPD1)(SERVER=DEDICATED)))"/>
      <!-- <property name="jdbc.connection.string" value="jdbc:oracle:thin:@131.44.78.131:1521:TPD1"/> -->
      <property name="jdbc.user" value="USER"/>
      <property name="jdbc.password" value="PASS"/>
      </properties>
      </persistence-unit>
      </persistence>

      I created a single EJB against a view on the database, and a single stateless session bean to invoke the EJB. I started the session bean within JDeveloper and am able to connect to the session bean and pull data from the EJB.

      I then created a deployment descripter using a three tiered deployment (EJBJar, War, Ear) method to deploy the project to an Oracle Enterprise Manager.

      The versions for both the OEM and JDeveloper are 10.1.3.4.0

      When I run my test application against the embedded oc4j in JDeveloper, I am able to pull data. When I switch to the OEM deployment, I get an error. To make sure I was really reaching the OEM, I also added a ping method to the session bean. Both the embedded oc4j and the OEM return a connection when invoking the ping method, yet I still recieve an error when attempting to pull data via the EJB.

      Below is the stacktrace from the OEM attempt. I have searched the internet looking for something that would lead me into the correct direction to resolve this problem. From the OEM server I am able to connect to the desired database using SQLPlus. I also have several other oc4j instances which connect the the desired database using a diffrent model (Dal/DAO) rather than the EJB persistence model.

      Thanks for any information which might lead to a resolution.

      Bill Hunsicker


      Nov 17, 2010 9:13:30 AM oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
      WARNING: Exception returned by remote server: {0}
      javax.ejb.EJBException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
      Error Code: 17002; nested exception is:
           Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
      Error Code: 17002; nested exception is: oracle.oc4j.rmi.OracleRemoteException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
      Error Code: 17002; nested exception is:
           Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
      Error Code: 17002
      oracle.oc4j.rmi.OracleRemoteException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
      Error Code: 17002
           at com.evermind.server.ejb.EJBUtils.getUserException(EJBUtils.java:346)
           at com.evermind.server.ejb.interceptor.system.AbstractTxInterceptor.convertAndHandleMethodException(AbstractTxInterceptor.java:75)
           at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:52)
           at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
           at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
           at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
           at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
           at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
           at DataService_RemoteProxy_2l9np7l.queryApplicantStatusDataFindByStatus(Unknown Source)
           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 com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
           at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
           at java.lang.Thread.run(Thread.java:595)

           Nested exception is:
      Local Exception Stack:
      Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
      Error Code: 17002
           at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:305)
           at oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:150)
           at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
           at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:582)
           at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
           at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
           at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
           at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
           at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:99)
           at com.evermind.server.ejb.persistence.PersistenceUnitImpl.createTempPersistenceContext(PersistenceUnitImpl.java:84)
           at com.evermind.server.ejb.persistence.EntityManagerProxy.createEntityManager(EntityManagerProxy.java:99)
           at com.evermind.server.ejb.persistence.EntityManagerProxy.allocateEntityManager(EntityManagerProxy.java:84)
           at com.evermind.server.ejb.persistence.AbstractEntityManagerProxy.createNamedQuery(AbstractEntityManagerProxy.java:110)
           at com.evermind.server.ejb.persistence.EntityManagerProxy.createNamedQuery(EntityManagerProxy.java:33)
           at mil.af.rs.bs.beans.session.DataServiceBean.queryApplicantStatusDataFindByStatus(DataServiceBean.java:38)
           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 com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
           at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
           at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:44)
           at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
           at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
           at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
           at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
           at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
           at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
           at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
           at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
           at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
           at DataService_RemoteProxy_2l9np7l.queryApplicantStatusDataFindByStatus(Unknown Source)
           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 com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
           at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
           at java.lang.Thread.run(Thread.java:595)
      Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
           at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
           at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:190)
           at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:363)
           at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
           at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:547)
           at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
           at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
           at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:854)
           at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:417)
           at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:292)
           at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:251)
           at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:128)
           at oracle.jdbc.pool.OracleImplicitConnectionCache.makeCacheConnection(OracleImplicitConnectionCache.java:2002)
           at oracle.jdbc.pool.OracleImplicitConnectionCache.makeOneConnection(OracleImplicitConnectionCache.java:664)
           at oracle.jdbc.pool.OracleImplicitConnectionCache.getCacheConnection(OracleImplicitConnectionCache.java:614)
           at oracle.jdbc.pool.OracleImplicitConnectionCache.getConnection(OracleImplicitConnectionCache.java:478)
           at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:573)
           at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:249)
           at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:213)
           at oracle.oc4j.sql.DataSourceConnectionPoolDataSource.getPooledConnection(DataSourceConnectionPoolDataSource.java:57)
           at oracle.oc4j.sql.xa.EmulatedXADataSource.getXAConnection(EmulatedXADataSource.java:92)
           at oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createXAConnection(ManagedConnectionFactoryImpl.java:211)
           at oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:170)
           at com.evermind.server.connector.ApplicationConnectionManager.createManagedConnection(ApplicationConnectionManager.java:1398)
           at oracle.j2ee.connector.ConnectionPoolImpl.createManagedConnectionFromFactory(ConnectionPoolImpl.java:327)
           at oracle.j2ee.connector.ConnectionPoolImpl.access$800(ConnectionPoolImpl.java:98)
           at oracle.j2ee.connector.ConnectionPoolImpl$NonePoolingScheme.getManagedConnection(ConnectionPoolImpl.java:1211)
           at oracle.j2ee.connector.ConnectionPoolImpl.getManagedConnection(ConnectionPoolImpl.java:785)
           at oracle.oc4j.sql.ConnectionPoolImpl.getManagedConnection(ConnectionPoolImpl.java:45)
           at com.evermind.server.connector.ApplicationConnectionManager.getConnectionFromPool(ApplicationConnectionManager.java:1596)
           at com.evermind.server.connector.ApplicationConnectionManager.acquireConnectionContext(ApplicationConnectionManager.java:1541)
           at com.evermind.server.connector.ApplicationConnectionManager.allocateConnection(ApplicationConnectionManager.java:1486)
           at oracle.j2ee.connector.OracleConnectionManager.unprivileged_allocateConnection(OracleConnectionManager.java:238)
           at oracle.j2ee.connector.OracleConnectionManager.allocateConnection(OracleConnectionManager.java:192)
           at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:272)
           at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:200)
           at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:142)
           at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:127)
           at oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:145)
           ... 37 more
        • 1. Re: Network Connection Error 17002
          Cdelahun-Oracle
          Hello,

          Have you tried using toplink.jdbc.* parameters instead of jdbc.*, as I am not sure when the switch to using jdbc.connection.string etc was made.
          For example:
          <property name="toplink.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
          <property name="toplink.jdbc.connection.string" value="jdbc:oracle:thin:@131.44.78.131:1521:TPD1"/>
          <property name="toplink.jdbc.user" value="USER"/>
          <property name="toplink.jdbc.password" value="PASS"/>

          You might also try setting the logging property:
          <property name="toplink.logging.level" value="FINEST"/>
          which will show TopLink's connection attempts, hopefully showing the difference in your attempt within OEM and JDeveloper.

          Best Regards,
          Chris
          • 2. Re: Network Connection Error 17002
            444251
            Chris,

            thanks for the tip. I made the changes you suggested and ran it in the embedded OC4J and everything ran fine. I then recreated the deployment file and deployed it to the OEM. There was no change in behavior. At that point I began to wonder if the persistence.xml file was being read by the OEM at all. I have moved it to many places with no change in behavior. The places I have tried are:

            Inside the EJBJAR file in the META-INF directory.
            Inside the EAR file in the META-INF directory.
            in the APPLIB directory for the OC4J instance.
            in a META-INF directory under the APPLIB directory for that OC4J instance.

            In all cases, I restarted the OC4J instance to ensure the file was loaded normally before running my test.

            When I ran the test in JDeveloper, I recieved all the FINE, FINEST etc messages. When I ran all four tests on the OEM, I recieved no message no matter where the persistence.xml file was located.

            So the $ question of the day is, where the heck is that file supposed to be so that the OEM recognizes it.

            Thanks for the help so far.