12 Replies Latest reply on Aug 25, 2009 11:32 AM by rhauch

    JDBC Storage (JPA) Connector

      Does anyone have an example of setting up a JDBC Storage Connector? I am having trouble getting this to work, and the documentation is not that detailed.

        • 1. Re: JDBC Storage (JPA) Connector
          rhauch

          We have a lot of examples in the JUnit tests (see [1] and in particular [2]). For specific version information, look at the POM file for the connector (including the dependencies used for our tests). Of course we really are only testing with HSQLDB, but we're relying upon Hibernate (and really features that are down the fairway and not off into the weeds).

          What DBMS are you trying to use? Are you using DNA 0.5, or trunk?

          [1] https://svn.jboss.org/repos/dna/trunk/extensions/dna-connector-store-jpa/src/test/
          [2] https://svn.jboss.org/repos/dna/trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JpaConnectorReadingTest.java

          • 2. Re: JDBC Storage (JPA) Connector

            I am using version 0.5. I am trying to connect to Postgres. I have it partially working now. The Postgres data source is populated when I load xml, but I am having trouble reading it back out. I am working through some connection issues.

            • 3. Re: JDBC Storage (JPA) Connector
              rhauch

              We have made a number of very significant fixes and improvements to the connectors (including the JPA connector) and to the core functionality that calls the connector (especially the JCR implementation) since the 0.5 release. I suspect that you would be able to get a lot farther with the latest code, simply because of these fixes and improvements. We're actually running our JCR compatibility tests against several connectors, including the JCA connector, so I know things are working much better in the trunk.

              Would you be willing to try your application (or proof of concept) using the trunk? To do this, simply checkout from SVN all of the source code from trunk, do a build ("mvn clean install" in the trunk directory, and it will take several minutes), and then change your dependencies from "0.5" to "0.6-SNAPSHOT". I would love to hear the outcome of this. The process we use is documented in our Reference Guide [1], and that has not changed since 0.5. If you run into any problems, please pop onto our IRC channel [2].

              The plan is currently to release 0.6 after we made some additional headway on some new features (including query and search support), and so we're still some weeks away from that. However, if you find that using the 0.6-SNAPSHOT works for your application, it's possible to push 0.6 out the door pretty quickly in the current state, and to push those new features to 0.7. (Most of our work is being done on separate branches, so the trunk is pretty stable at the moment.) Then 1.0 is actually not far behind that.

              What do you think?

              Best regards,

              Randall

              [1] http://www.jboss.org/file-access/default/members/dna/freezone/docs/0.5/manuals/reference/html/development-tools.html
              [2] http://www.jboss.org/dna/irc.html

              • 4. Re: JDBC Storage (JPA) Connector

                I will try to pull down the latest code and rebuild. Here is some additional information on what I am trying to get working:

                I took your repository example and tailored it so that I have 1 in memory repository and 1 repository that is using Postgres as the back end data store. I have those two repositories federated. I am loading my own xml files that are different from the example files. The in memory repository is working fine just as it does in the example. The Postgres repository is loading properly, because I can go to Postgres and see all the data that was extracted from my XML file. I am getting an error thought when it hits this line:

                org.jboss.dna.graph.Node node = graph.getNodeAt(pathToNode);


                There has been an error processing your command
                java.io.EOFException: Unexpected end of ZLIB input stream
                org.jboss.dna.graph.connector.RepositorySourceException: java.io.EOFException: Unexpected end of ZLIB input stream
                at org.jboss.dna.graph.Graph.execute(Graph.java:250)
                at org.jboss.dna.graph.Graph$5.process(Graph.java:186)
                at org.jboss.dna.graph.request.RequestBuilder.readNode(RequestBuilder.java:139)
                at org.jboss.dna.graph.Graph.getNodeAt(Graph.java:1843)
                at org.jboss.dna.graph.Graph.getNodeAt(Graph.java:1853)
                at com.saic.dna.repository.RepositoryClient.getNodeInfo(RepositoryClient.java:435)
                at com.saic.dna.repository.ConsoleInput.displayNavigationMenu(ConsoleInput.java:204)
                at com.saic.dna.repository.ConsoleInput$1.run(ConsoleInput.java:104)
                at java.lang.Thread.run(Unknown Source)
                Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
                at java.util.zip.InflaterInputStream.fill(Unknown Source)
                at java.util.zip.InflaterInputStream.read(Unknown Source)
                at java.util.zip.GZIPInputStream.read(Unknown Source)
                at java.io.ObjectInputStream$PeekInputStream.read(Unknown Source)
                at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
                at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
                at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
                at java.io.ObjectInputStream.(Unknown Source)
                at org.jboss.dna.connector.store.jpa.model.basic.BasicRequestProcessor.process(BasicRequestProcessor.java:426)
                at org.jboss.dna.graph.request.processor.RequestProcessor.process(RequestProcessor.java:235)
                at org.jboss.dna.connector.store.jpa.JpaConnection.execute(JpaConnection.java:144)
                at org.jboss.dna.graph.connector.RepositoryConnectionPool$ConnectionWrapper.execute(RepositoryConnectionPool.java:991)
                at org.jboss.dna.graph.Graph.execute(Graph.java:243)

                • 5. Re: JDBC Storage (JPA) Connector

                  I am trying to build from the trunk but I am getting the following error:

                  [INFO] ------------------------------------------------------------------------
                  [ERROR] BUILD ERROR
                  [INFO] ------------------------------------------------------------------------
                  [INFO] Failed to resolve artifact.

                  Missing:
                  ----------
                  1) org.jboss.dna:dna-integration-tests:jar:0.6-SNAPSHOT

                  Try downloading the file manually from the project website.

                  Then, install it using the command:
                  mvn install:install-file -DgroupId=org.jboss.dna -DartifactId=dna-integrat
                  ion-tests -Dversion=0.6-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

                  Alternatively, if you host your own repository you can deploy the file there:

                  mvn deploy:deploy-file -DgroupId=org.jboss.dna -DartifactId=dna-integratio
                  n-tests -Dversion=0.6-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url]
                  -DrepositoryId=[id]

                  Path to dependency:
                  1) org.jboss.dna:dna-sequencer-java:jar:0.6-SNAPSHOT
                  2) org.jboss.dna:dna-integration-tests:jar:0.6-SNAPSHOT

                  ----------
                  1 required artifact is missing.

                  for artifact:
                  org.jboss.dna:dna-sequencer-java:jar:0.6-SNAPSHOT

                  from the specified remote repositories:
                  jboss-snapshot (http://snapshots.jboss.org/maven2),
                  central (http://repo1.maven.org/maven2),
                  jboss (http://repository.jboss.com/maven2),
                  apiviz.release (http://apiviz.googlecode.com/svn/site/repo/mvn/release)

                  • 6. Re: JDBC Storage (JPA) Connector
                    bcarothers

                    The exception that you noted previously definitely existed in 0.5 (at least when I tried to use it) and is definitely fixed in 0.6-SNAPSHOT (we specifically test this behavior in the integration tests). A workaround for 0.5 that might have worked would be to set the compressData property to "false", but I heartily encourage you to use 0.6-SNAPSHOT for the JPA connector. Among other things, there was a schema change after 0.5. We don't anticipate having any more of those.

                    I am a bit confused by the Maven error. Are you getting that when you run mvn clean install in the DNA project root directory? Building the DNA project should build the dna-integration-tests JAR and install it into your local repository so that you can use it later on your real project.

                    • 7. Re: JDBC Storage (JPA) Connector

                      Yes, I am running mvn clean install from the root directory. A folder is getting created in my local repository for dna-integration-tests/0.6-SNAPSHOT, but only the xml files are being generated. The jar file is not being generated in that folder.

                      • 8. Re: JDBC Storage (JPA) Connector

                        This is the directory I am checking out in subversion and running mvn clean install on:

                        http://anonsvn.jboss.org/repos/dna/trunk/

                        • 9. Re: JDBC Storage (JPA) Connector
                          rhauch

                           

                          "kuncld" wrote:
                          This is the directory I am checking out in subversion and running mvn clean install on:

                          http://anonsvn.jboss.org/repos/dna/trunk/


                          That is the correct directory.

                          "kuncld" wrote:
                          Yes, I am running mvn clean install from the root directory. A folder is getting created in my local repository for dna-integration-tests/0.6-SNAPSHOT, but only the xml files are being generated. The jar file is not being generated in that folder.


                          Are you getting your Maven error when running the build of your project, or when running DNA's build?

                          Running "mvn clean install" does not by default build or run the integration tests, because the integration tests take a bit long (especially when we run this repeatedly while we develop). But you can easily include these tests (and place the artifact into your local repository) by using. "mvn clean install -P integration".

                          I apologize for not mentioning this detail earlier, but I didn't expect that you'd need that artifact (that is, the JAR containing our integration test cases) in your project. There's no problem doing that, but really it's part of the test suite for JBoss DNA.

                          Please let us know if this works. If not, feel free to hop onto our IRC root (irc.freenode.net#jbossdna) for perhaps lower-latency help.

                          • 10. Re: JDBC Storage (JPA) Connector

                            I had to run the following to get it to build:

                            mvn clean install -P integration -Dmaven.test.skip

                            Now everything is working correctly. My example is working now with the changes that were made in the trunk.

                            When can I get an official release of 0.6?

                            • 11. Re: JDBC Storage (JPA) Connector
                              rhauch

                              As reported in another thread (http://www.jboss.org/index.html?module=bb&op=viewtopic&t=160321), there was indeed an issue with the Java sequencer project. This has been fixed in trunk, so you should be able to build again using "mvn clean install" (or "mvn clean install -P integration" if you want to run the integration tests)

                              • 12. Re: JDBC Storage (JPA) Connector
                                rhauch

                                We currently have a number of regressions for some of the TCK unit tests, and we'd like to get those fixed before we make a release. I'm currently looking into them, but don't yet have an estimate, other than it should be on the order of days, not weeks.