0 Replies Latest reply on Dec 18, 2012 8:34 AM by jaydev

    jdbc string cache store config issue 5.1.3.FINAL

    jaydev Newbie

      Hi,

       

      I am trying to use the jdbc with my Tree API cache:

       

      <loaders>
                                    <loader
                                              class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore"
                                              fetchPersistentState="false" ignoreModifications="false"
                                              purgeOnStartup="false">
                                              <properties>
                                                        <property name="stringsTableNamePrefix" value="ISPN_" />
                                                        <property name="idColumnName" value="ID_COLUMN" />
                                                        <property name="dataColumnName" value="DATA_COLUMN" />
                                                        <property name="timestampColumnName" value="TIMESTAMP_COLUMN" />
                                                        <property name="timestampColumnType" value="BIGINT" />
                                                        <property name="connectionFactoryClass"
                                                                  value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory" />
                                                        <property name="connectionUrl" value="jdbc:mysql://localhost/localmysqlschema" />
                                                        <property name="userName" value="root" />
                                                        <property name="password" value="admin" />
                                                        <property name="driverClass" value="org.gjt.mm.mysql.Driver" />
                                                        <property name="idColumnType" value="VARCHAR(255)" />
                                                        <property name="dataColumnType" value="BINARY" />
                                                        <property name="dropTableOnExit" value="false" />
                                                        <property name="createTableOnStart" value="true" />
                                              </properties>
                                    </loader>
                          </loaders> 
      
      I instantiate the cache in code such as:
      
      @LocalBean
      @Singleton
      public class CacheManager {
      
      
                private EmbeddedCacheManager manager;
                private TreeCache<Object, Object> strategyFactorExposureCache;
                private TreeCache<Object, Object> entityRiskFactorWeightCache;
                private TreeCache<Object, Object> tradeStrategySecurityUniverseCache;
                private Cache<Date, StrategyGroupDaoImpl> strategyGroupCache;
                private Cache<HoldingExposure, HoldingExposure> strategizerCalcEngineDebuggerCache;
                private Cache<HoldingExposure, HoldingExposure> entityRiskFactorWeightEngineDebuggerCache;
        
                @PostConstruct
                public void init() {
                          try {
                                    manager = new DefaultCacheManager("infinispan-config.xml");
                          } catch (IOException e) {
                                    Logger.getLogger(getClass()).error("Error instantiating cache manager: ", e);
                          } 
                          manager.startCaches("strategyFactorExposureCache,strategyGroupCache," +
                                              "strategizerCalcEngineDebuggerCache,tradeStrategySecurityUniverseCache,entityRiskFactorWeightCache,entityRiskFactorWeightEngineDebuggerCache");
                          TreeCacheFactory factory = new TreeCacheFactory();
                          strategyFactorExposureCache = factory.createTreeCache(manager.getCache("strategyFactorExposureCache"));
      .....
      
                }
      
      

       

      Finally, here is the stack trace from the error...  I am not sure what I am doing wrong since I am using the config example directly from the jboss documentation found here https://docs.jboss.org/author/display/ISPN51/CacheLoaders#CacheLoaders-JDBCbasedcacheloaders.

       

      Caused by: java.lang.RuntimeException: Could not invoke PostConstruct on the newly created bean instance

                at org.jboss.ejb3.singleton.impl.container.SingletonEJBInstanceManagerImpl.create(SingletonEJBInstanceManagerImpl.java:137)

                at org.jboss.ejb3.singleton.impl.container.SingletonEJBInstanceManagerImpl.get(SingletonEJBInstanceManagerImpl.java:152)

                at org.jboss.ejb3.singleton.impl.container.SingletonContainer.invoke(SingletonContainer.java:201)

                at org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer.invoke(AOPBasedSingletonContainer.java:474)

                at org.jboss.ejb3.nointerface.impl.invocationhandler.NoInterfaceViewInvocationHandler.invokeEndpoint(NoInterfaceViewInvocationHandler.java:143)

                at org.jboss.ejb3.nointerface.impl.invocationhandler.NoInterfaceViewInvocationHandler.access$000(NoInterfaceViewInvocationHandler.java:54)

                at org.jboss.ejb3.nointerface.impl.invocationhandler.NoInterfaceViewInvocationHandler$1.invoke(NoInterfaceViewInvocationHandler.java:103)

                at org.jboss.ejb3.sis.reflect.InterceptorInvocationHandler$1.proceed(InterceptorInvocationHandler.java:84)

                at org.jboss.ejb3.sis.InterceptorAssembly$1.proceed(InterceptorAssembly.java:82)

                at org.jboss.ejb3.nointerface.impl.async.AsyncClientInterceptor.invoke(AsyncClientInterceptor.java:119)

                at org.jboss.ejb3.sis.InterceptorAssembly$1.proceed(InterceptorAssembly.java:74)

                at org.jboss.ejb3.nointerface.impl.invocationhandler.ObjectMethodsInterceptor.invoke(ObjectMethodsInterceptor.java:78)

                at org.jboss.ejb3.sis.InterceptorAssembly$1.proceed(InterceptorAssembly.java:74)

                at org.jboss.ejb3.sis.InterceptorAssembly.invoke(InterceptorAssembly.java:90)

                at org.jboss.ejb3.sis.reflect.InterceptorInvocationHandler.invoke(InterceptorInvocationHandler.java:110)

                at org.jboss.ejb3.nointerface.impl.invocationhandler.NoInterfaceViewInvocationHandler.invoke(NoInterfaceViewInvocationHandler.java:115)

                at org.jboss.ejb3.proxy.javassist.JavassistInvocationHandlerAdapter.invoke(JavassistInvocationHandlerAdapter.java:71)

                at com.ls.in2quantriskservice.ejb.cache.CacheManager_$$_javassist_28.getStrategyFactorExposureCache(CacheManager_$$_javassist_28.java)

                at com.ls.in2quantriskservice.ejb.cache.CacheHelper.deleteStrategyFactorExposures(CacheHelper.java:115)

                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.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)

                at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72)

                at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:127)

                at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:151)

                at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doAroundInvoke(Jsr299BindingsInterceptor.java:122)

                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.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:80)

                at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:71)

                at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62)

                at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:127)

                at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:46)

                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.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:80)

                at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:71)

                at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62)

                at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76)

                at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62)

                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.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:74)

                at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_597663925.invoke(InvocationContextInterceptor_z_fillMethod_597663925.java)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:90)

                at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_597663925.invoke(InvocationContextInterceptor_z_setup_597663925.java)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.async.impl.interceptor.AsynchronousServerInterceptor.invoke(AsynchronousServerInterceptor.java:128)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)

                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                at org.jboss.ejb3.core.context.SessionInvocationContextAdapter.proceed(SessionInvocationContextAdapter.java:95)

                at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:247)

                ... 256 more

      Caused by: java.lang.RuntimeException: java.lang.NullPointerException

                at org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer.invokeCallback(AOPBasedSingletonContainer.java:1063)

                at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1396)

                at org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer.postConstruct(AOPBasedSingletonContainer.java:760)

                at org.jboss.ejb3.singleton.impl.container.SingletonEJBInstanceManagerImpl.create(SingletonEJBInstanceManagerImpl.java:133)

                ... 328 more

      Caused by: java.lang.NullPointerException

                at org.jboss.ejb3.EJBContainer.getApplicationException(EJBContainer.java:509)

                at org.jboss.ejb3.singleton.aop.impl.ConstructionInvocationContextAdapter.getApplicationException(ConstructionInvocationContextAdapter.java:62)

                at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:163)

                at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:251)

                at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:383)

                at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:211)

                at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52)

                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)

                at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)

                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)

                at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)

                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)

       

      What I am doing wrong?  Any help would be greatly appreciated...

       

      Thanks,

      JayDev