Announcement Announcement Module
No announcement yet.
Spring Roo - Oracle Connectivity Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Roo - Oracle Connectivity


    I am very new to Java / Spring /Roo.

    I have been seriously considering Roo for one of my projects.

    I am developing a Web application for one of my clients, who requires Oracle as a back-end database. After successfully trying out a few tutorials and examples with HyperSonic Db (the embedded database that all the examples were using), I decided to develop a simple contactManager example to connect to Oracle Xpress Edition.

    I am facing persistent problems to connect to the Oracle Database.

    My setup is as follows:

    Windows XP
    Eclipse 3.5
    Spring Tool Suite 2.3.2
    Spring Roo 1.0.2
    Maven 2.2.1
    Oracle XE 10g (
    Ojdbc (successfully installed using mvn install command)

    After, building the Roo application, when I run the application the Web application comes up (I am creating a simple contactManager with Person and Address domains)

    When I click on any action that has to connect to the database I get an error message

    Data access failure
    Sorry, a problem occurred while accessing the database.

    I have attached the Stack Trace.

    Exception Message
    org.hibernate.exception.GenericJDBCException: Cannot open connection; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection

    I need urgent help. If the information provided is not sufficient, I can provide more details. But please look into the problem and kindly guide me, where I am getting it wrong.

  • #2
    Post the FULL stacktrace, the one in the attached txt file isn't complete.


    • #3
      Oracle Connectivity with Spring Roo

      Finally, I have solved the problem of Oracle connectivity from Spring Roo.

      Now, I am able to connect to Oracle using Spring Roo and I am able to perform round-trip actions, like create entities and fields in the database, add new fields, then regenerate the app and see the results.

      What did I do (differently)?

      I started from the beginning, creating a Spring Roo project using Eclipse 3.5, then following the steps to create just one entity.

      When I performed the tests, Roo reported that one of the dependency ojdbc14.jar was not configured. Roo indicated to download the ojdbc14.jar manually and install it.

      I used the following command, suggested by Roo
      mvn install:install-file -Dfile=ojdbc14.jar -DartifactId=ojdbc14 -Dversion= -Dpackaging=jar

      After this, the pom.xml had the dependency looking like this:


      I then traversed to the [under src/main/java/resources/META-INF/spring] and edited the values, so it looked like this:

      database.url=jdbc\:oracle\:thin\:@localhost\:1521\ :XE

      Finally, I created the controller and ran the application.

      I was able to connect to Oracle and when I entered data and saved, I verified it was saving it perfectly. More importantly, when I changed the entity and added new fields using Roo, recompiled and saw that the database was properly updated. This is really wonderful.

      I hope this helps newbies like me who wish to use Roo and Oracle in their very first project.

      Goo luck.