Announcement Announcement Module
Collapse
No announcement yet.
Oracle connection error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Oracle connection error

    I've been banging my head against the wall all day on this, so I'm hoping someone else might have some answers...

    I am running Oracle 11g on my local machine as well as Java 1.6. I went through the steps to create a new Spring Roo project from within the Springsource Tool Suite and I selected Oracle as my database. I downloaded the ojdbc6.jar file from Oracle's website and got it installed into my local maven repo. I then modified the database.properties file to look like this....

    Code:
    database.password=newpassword
    database.url=jdbc\:oracle\:thin\:@localhost\:1521\:projectdb
    database.username=newuser
    database.driverClassName=oracle.jdbc.OracleDriver
    I've tried all sorts of combinations of removing the slashes and colons from the database.url value as suggested by various threads, but to no avail.

    I am receiving the following error stack when trying to build with tests turned on (the same errors when trying to run, after building successfully with tests turned off...)

    Code:
    org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
    	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:382)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
    	at org.springframework.test.context.transaction.TransactionalTestExecutionListener$TransactionContext.startTransaction(TransactionalTestExecutionListener.java:507)
    	at org.springframework.test.context.transaction.TransactionalTestExecutionListener.startNewTransaction(TransactionalTestExecutionListener.java:269)
    	at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:162)
    	at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:358)
    	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73)
    	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
    	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
    	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:119)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:101)
    	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:597)
    	at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
    	at $Proxy0.invoke(Unknown Source)
    	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
    	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
    	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
    Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
    	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1215)
    	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1148)
    	at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1225)
    	at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:63)
    	at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:70)
    	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:332)
    	... 31 more
    Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
    	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
    	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
    	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    	at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:160)
    	at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:81)
    	at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473)
    	at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:60)
    	... 33 more
    Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Got minus one from a read call)
    	at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
    	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
    	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    	at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71)
    	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    	... 38 more
    Caused by: java.sql.SQLException: Got minus one from a read call
    	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
    	at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
    	at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
    	at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    	at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
    	at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
    	at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
    	at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
    	at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
    	... 42 more
    Caused by: oracle.net.ns.NetException: Got minus one from a read call
    	at oracle.net.ns.Packet.receive(Packet.java:285)
    	at oracle.net.ns.NSProtocol.connect(NSProtocol.java:286)
    	at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
    	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
    	... 50 more
    Any hints about what else I might need to look at would be greatly appreciated! Thanks in advance!

    -Joey

  • #2
    Sigh...issue solved.

    The database for some reason was not accepting connections on port 1521. After changing it to accept connections on that port and restarting the listener eveything works fine. It's finally working!

    Comment


    • #3
      How did you change to accept connections? I am facing same issue. please reply asap.

      Comment

      Working...
      X