5 Replies Latest reply on Aug 16, 2010 9:22 PM by 715399

    Jena adapter and glassfish

    759822
      I have been trying to get the Jena adapter , joseki and glassfish to work with 11g.
      No success so far. Glassfish just throws an error because somewhere in the code there is a cast to (OracleConnection) that is incorrect.
      My glassfish connection pool is setup using oracle.jdbc.pool.OracleDataSource.

      Has anyone got any ideas ?

      trace:

      WARN [httpSSLWorkerThread-8080-1] (Configuration.java:115) - Failed to build dataset from description (service name: updat
      e/service): caught: open: the connection from the datasource is not of OracleConnection type
      com.hp.hpl.jena.assembler.exceptions.AssemblerException: caught: open: the connection from the datasource is not of OracleConnection type
      doing:
      root: file:///export/apps/phil/glassfish/domains/domain1/config/joseki-config.ttl#oracle with type: http://www.oracle.com/2009/05/orardf/jena-joseki-ns#Da
      taset assembler class: class oracle.spatial.rdf.client.jena.assembler.OracleDatasetAssembler

      at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:126)
      at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:105)
      at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:69)
      at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:37)
      at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:34)


      UPDATE: I believe this is because glassfish wraps its connections, so I'd need to create a new data source that gets the physical OracleConnection for me.
      As discussed here: http://forums.sun.com/thread.jspa?threadID=5100748

      Edited by: user2570981 on 12-Mar-2010 08:30
        • 1. Re: Jena adapter and glassfish
          759822
          see http://forums.sun.com/thread.jspa?threadID=5100748
          • 2. Re: Jena adapter and glassfish
            715399
            Hi,

            Just a brief note, the exception could also be because of a class loader conflict: loading two ojdbc5.jar files. We encountered this issue with Tomcat and the solution is to copy the ojdbc5.jar to the common lib directory ( $CATALINA_HOME/lib) and remove it from all of the application WEB-INF/lib directories.

            Cheers,
            Vladimir
            1 person found this helpful
            • 3. Re: Jena adapter and glassfish
              759822
              I am trying to get this to work with tomcat now. But without success. The JNDI lookup does not seem to work. I am not that familiar with tomcat's config, so perhaps it is something I am doing wrong. Can someone help me out with the config files /
              I have this in my META-INF/context.xml file:

              <Context path="/joseki" debug="5" crossContect="true">
              <Resource name="OracleSemDS" auth="Application"
              type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
              url="jdbc:oracle:thin:@XXX"
              username="XXX" password="XXX" maxActive="20" maxIdle="10"
              maxWait="-1"/>
              </Context>

              and this in the web.xml file:

              <resource-ref>
              <description>DB Connection</description>
              <res-ref-name>OracleSemDS</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Application</res-auth>
              </resource-ref>

              I get this error:

              javax.naming.NameNotFoundException: Name OracleSemDS is not bound in this Context

              So clearly the lookup isn't working. I am using tomcat 6.0.26
              • 4. Re: Jena adapter and glassfish
                784525
                Hi, I managed to get Joseki working on Tomcat 6 with just this META-INF/context.xml file (no <resource-ref> section in web.xml needed):

                <?xml version="1.0" encoding="UTF-8"?>
                <Context>
                <Resource name="OracleSemDS"
                     auth="Container"
                     type="oracle.jdbc.pool.OracleDataSource"
                     factory="oracle.jdbc.pool.OracleDataSourceFactory"
                     user="rdfuser"
                     password="rdfuser"
                     driverClassName="oracle.jdbc.driver.OracleDriver"
                     url="jdbc:oracle:thin:@ec2-184-72-150-221:1521:tseval"
                     validationQuery="select 1 from dual"
                     maxActive="10"
                     maxIdle="2"/>
                </Context>

                However, it took a patched version of the sdordfclient.jar to get it working, the problem being that, in accordance with the J2EE spec, Tomcat (and Glassfish as well, I believe) puts the datasource in the "java:comp/env" JNDI namespace. The sdordfclient.jar has code responsible for finding that datasource but looks for it under simply "OracleSemDS".

                your context.xml file looks good, I'll bet if you dig around, you'll find that "java:comp/env/OracleSemDS" is bound in Tomcat, you just need a sdordfclient.jar that is looking for it there.
                • 5. Re: Jena adapter and glassfish
                  715399
                  Hi,

                  Regarding my note, I meant that if the Joseki/Jena/Jena Adapter set up is not working properly and you see something like "caught: open: the connection from the datasource is not of OracleConnection type" in the log, it might be a jar conflict and we suggest copying the ojdbc*jar to Tomcat's common lib directory. That solved the problem in our instance.

                  As nyoung said, you will need a patched sdordfclient.jar to be able to use Tomcat or Glassfish with the Jena Adapter. If you have access to My Oracle Support, I can point you to its download location. Ping me at vladimir dot kolovski at oracle dot com.

                  Cheers,
                  Vladimir