14 Replies Latest reply on Oct 12, 2006 3:28 PM by Greg Ferguson

    Urgent- Socket error when adding object to DB using JDBC Cac

    Mitra Salmasi Newbie

      Hi,
      I am currently trying to test the following scenario:
      Add 10000/20000/50000 objects to cache1 in JVM1, persist the data to DB (MYSQL) and read the data in cache 2 (separate JVM)

      After about adding 1793 objects to DB, I get the following error:

      MESSAGE: java.net.BindException: Address already in use: connect

      STACKTRACE:

      java.net.SocketException: java.net.BindException: Address already in use: connect
      at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
      at com.mysql.jdbc.MysqlIO.(MysqlIO.java:284)
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2541)
      at com.mysql.jdbc.Connection.(Connection.java:1474)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at java.sql.DriverManager.getConnection(DriverManager.java:525)
      at java.sql.DriverManager.getConnection(DriverManager.java:171)
      at org.jboss.cache.loader.JDBCCacheLoader$NonManagedConnectionFactory.getConnection(JDBCCacheLoader.java:1410)
      at org.jboss.cache.loader.JDBCCacheLoader.loadNode(JDBCCacheLoader.java:1071)
      at org.jboss.cache.loader.JDBCCacheLoader.get(JDBCCacheLoader.java:263)
      at org.jboss.cache.loader.AsyncCacheLoader.get(AsyncCacheLoader.java:171)
      at org.jboss.cache.interceptors.CacheLoaderInterceptor.loadData(CacheLoaderInterceptor.java:415)
      at org.jboss.cache.interceptors.CacheLoaderInterceptor.loadNode(CacheLoaderInterceptor.java:326)
      at org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:165)
      at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
      at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
      at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
      at org.jboss.cache.interceptors.ReplicationInterceptor.invoke(ReplicationInterceptor.java:34)
      at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
      at org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:135)
      at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
      at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:345)
      at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:156)
      at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
      at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:138)
      at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5517)
      at org.jboss.cache.TreeCache.get(TreeCache.java:3468)
      at org.jboss.cache.TreeCache.get(TreeCache.java:3449)
      at org.jboss.cache.TreeCache.get(TreeCache.java:3245)
      at org.jboss.cache.aop.InternalDelegate.get(InternalDelegate.java:123)
      at org.jboss.cache.aop.InternalDelegate.getAopInstance(InternalDelegate.java:71)
      at org.jboss.cache.aop.InternalDelegate.getPojo(InternalDelegate.java:221)
      at org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:171)
      at org.jboss.cache.aop.PojoCache._putObject(PojoCache.java:731)
      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:462)
      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:423)
      at test.examples.StudentMaintTest.testObjectPutInCache(StudentMaintTest.java:142)
      at test.examples.StudentMaintTest.init(StudentMaintTest.java:123)
      at test.examples.StudentMaintTest.setUp(StudentMaintTest.java:58)
      at test.examples.StudentMaintTest.main(StudentMaintTest.java:252)

      I have configured JDBBC cacheloader in the xml file as follows:


      <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
      false

      /aop

      true

      <!-- we can now have multiple cache loaders, which get chained -->

      org.jboss.cache.loader.JDBCCacheLoader
      <!-- same as the old CacheLoaderConfig attribute -->

      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=longblob
      cache.jdbc.parent.column=parent
      cache.jdbc.driver=com.mysql.jdbc.Driver
      cache.jdbc.url=jdbc:mysql://localhost:3306/test
      cache.jdbc.user=root
      cache.jdbc.password=secretpassword

      <!-- whether the cache loader writes are asynchronous -->
      true
      <!-- only one cache loader in the chain may set fetchPersistentState to true.
      An exception is thrown if more than one cache loader sets this to true. -->
      false
      <!-- determines whether this cache loader ignores writes - defaults to false. -->
      false
      <!-- if set to true, purges the contents of this cache loader when the cache starts up.
      Defaults to false. -->
      false

      Could you please help me out and point me in the right direction?