1 Reply Latest reply on Mar 17, 2010 4:53 AM by sv kap

    jboss cache + derby + cannot find EmbeddedDriver

    sv kap Newbie

      Hi all.

       

      I am trying to use derby instead of HSQL. Here is my configuration:

       

      --------- Derby Information --------
      JRE - JDBC: Java SE 6 - JDBC 4.0
      [C:\aaDev\pluto-fresh-tomcat6\wtpwebapps\TenzingV2GoProCase\WEB-INF\lib\derby.jar] 10.2.2.0 - (485682)

       

      Apparently the embedded driver is in the classpath and can be loaded from my application. However, the cache is throwing ClassNotFoundException.

      org.apache.derby.tools.sysinfo.main(null);
      String driver = "org.apache.derby.jdbc.EmbeddedDriver";
      Class.forName(driver).newInstance();    
                 
      pojoCache = PojoCacheFactory.createCache(configFile);

       

      <loaders passivation="false" shared="false">
          <preload>
              <node fqn="/DEFAULT_NODE" />
          </preload>

          <!--
              we can have multiple cache loaders, which get chained
          -->
          <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true"
              fetchPersistentState="true" ignoreModifications="false"
              purgeOnStartup="false">
              <properties>
                  cache.jdbc.table.name=jbosscache
                  cache.jdbc.table.create=true
                  cache.jdbc.table.drop=false
                  cache.jdbc.table.primarykey=jbosscache_pk
                  cache.jdbc.fqn.column=fqn
                  cache.jdbc.fqn.type=VARCHAR(255)
                  cache.jdbc.node.column=node
                  cache.jdbc.node.type=BINARY
                  cache.jdbc.parent.column=parent
                  cache.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver           
                  cache.jdbc.url=jdbc:derby:c:/cache/derbyDB;create=true
                  cache.jdbc.user=dbuser
                  cache.jdbc.password=pass
              </properties>
          </loader>

          <!--
              <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true"
              fetchPersistentState="true" ignoreModifications="true"
              purgeOnStartup="true"> <properties> cache.jdbc.table.name=jbosscache
              cache.jdbc.table.create=true cache.jdbc.table.drop=true </properties>

              <singletonStore enabled="true"
              class="org.jboss.cache.loader.SingletonStoreCacheLoader">
              <properties> pushStateWhenCoordinator=true
              pushStateWhenCoordinatorTimeout=20000 </properties> </singletonStore>
              </loader>
          -->
      </loaders>

       

      Here is the exceptioon:

       

      [ERROR] org.jboss.cache.loader.NonManagedConnectionFactory: Failed to load driver org.apache.derby.jdbc.EmbeddedDriver           
      java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver           
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
          at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:169)
          at org.jboss.cache.loader.NonManagedConnectionFactory.loadDriver(NonManagedConnectionFactory.java:218)
          at org.jboss.cache.loader.NonManagedConnectionFactory.start(NonManagedConnectionFactory.java:59)
          at org.jboss.cache.loader.AdjListJDBCCacheLoader.start(AdjListJDBCCacheLoader.java:284)
          at org.jboss.cache.loader.JDBCCacheLoader.start(JDBCCacheLoader.java:396)
          at org.jboss.cache.loader.AbstractDelegatingCacheLoader.start(AbstractDelegatingCacheLoader.java:185)
          at org.jboss.cache.loader.AsyncCacheLoader.start(AsyncCacheLoader.java:305)
          at org.jboss.cache.loader.CacheLoaderManager.startCacheLoader(CacheLoaderManager.java:461)
          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.jboss.cache.util.reflect.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:144)
          at org.jboss.cache.factories.ComponentRegistry$PrioritizedMethod.invoke(ComponentRegistry.java:1012)
          at org.jboss.cache.factories.ComponentRegistry.internalStart(ComponentRegistry.java:778)
          at org.jboss.cache.factories.ComponentRegistry.start(ComponentRegistry.java:632)
          at org.jboss.cache.invocation.CacheInvocationDelegate.start(CacheInvocationDelegate.java:345)
          at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:120)
          at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:92)
          at org.jboss.cache.pojo.impl.PojoCacheImpl.<init>(PojoCacheImpl.java:58)
          at org.jboss.cache.pojo.PojoCacheFactory.createCache(PojoCacheFactory.java:29)

        • 1. Re: jboss cache + derby + cannot find EmbeddedDriver
          sv kap Newbie

          Hi again.

           

          I found the problem. Some of the jdbc properties (including the driver) had spaces at the end.. Unfortunatelly the loader does not truncate them and at the end it cannot find 'org.apache.derby.jdbc.EmbeddedDriver ' (it does not add quotes in the logs and it is quite difficult to understand what is actually wrong). Now I have another problem but I think that it will be better to start a new thread.