[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Messages posted by: siddhart  XML
Profile for siddhart -> Messages posted by siddhart [6]
Author Message
Hello, I am surprised not any message from components for missed out things or any wrong configuration, Simply throwing NullPointerException
So, How will this thing will be solved, Need to hack source now ? for basic clustering

Help appreciated.

Thanks,
Siddharth
Any configuration missed over here that so not able to get property and not able to initialize Terracotta Cluster ?
Deploying EHCache in cluster mode and getting this exception while initiating SessionFactory of hibernate, Referred guide http://www.terracotta.org/documentation/ga/distributed-hibernate-install.html#50655276_16440

18:38:43,097 INFO [net.sf.ehcache.hibernate.AbstractEhcacheRegionFactory] Enabling single phase commit using a JTA Transaction Synchronization
18:38:43,098 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
18:38:43,230 ERROR [STDERR] org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Unable to load class net.sf.ehcache.terracotta.StandaloneTerracottaClusteredInstanceFactory. Initial cause was java.lang.NullPointerException
18:38:43,231 ERROR [STDERR] at net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory.start(SingletonEhCacheRegionFactory.java:86)
18:38:43,232 ERROR [STDERR] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:221)
18:38:43,232 ERROR [STDERR] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
18:38:43,232 ERROR [STDERR] at manager.Second.init(Second.java:37)
18:38:43,233 ERROR [STDERR] at javax.servlet.GenericServlet.init(GenericServlet.java:242)
18:38:43,233 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1208)
18:38:43,233 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:955)
18:38:43,234 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188)
18:38:43,234 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
18:38:43,234 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)
18:38:43,235 ERROR [STDERR] at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)
18:38:43,235 ERROR [STDERR] at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)
18:38:43,235 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
18:38:43,235 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:93)
18:38:43,236 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
18:38:43,236 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
18:38:43,236 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
18:38:43,237 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
18:38:43,237 ERROR [STDERR] at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
18:38:43,237 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
18:38:43,238 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
18:38:43,238 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
18:38:43,238 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
18:38:43,239 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
18:38:43,247 ERROR [STDERR] Caused by: net.sf.ehcache.CacheException: Unable to load class net.sf.ehcache.terracotta.StandaloneTerracottaClusteredInstanceFactory. Initial cause was java.lang.NullPointerException
18:38:43,247 ERROR [STDERR] at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:109)
18:38:43,247 ERROR [STDERR] at net.sf.ehcache.TerracottaClusteredInstanceHelper.newClusteredInstanceFactory(TerracottaClusteredInstanceHelper.java:150)
18:38:43,248 ERROR [STDERR] at net.sf.ehcache.CacheManager.init(CacheManager.java:306)
18:38:43,248 ERROR [STDERR] at net.sf.ehcache.CacheManager.<init>(CacheManager.java:280)
18:38:43,248 ERROR [STDERR] at net.sf.ehcache.CacheManager.create(CacheManager.java:642)
18:38:43,249 ERROR [STDERR] at net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory.start(SingletonEhCacheRegionFactory.java:65)
18:38:43,249 ERROR [STDERR] ... 23 more




EHCache.xml
<?xml version="1.0" encoding="UTF-8"?>
<ehcache name="ccc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<defaultCache
maxElementsInMemory="0"
eternal="false"
timeToIdleSeconds="1200"
timeToLiveSeconds="1200">
<terracotta />
</defaultCache>
<terracottaConfig url="192.168.1.136:9510,192.168.1.59:9510" />
</ehcache>


tc Config

<?xml version="1.0" encoding="UTF-8"?>
<!-- All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. -->
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-4.xsd" xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<!-- Sets where the Terracotta server can be found. Replace the value of
host with the server's IP address. -->
<server host="192.168.1.136" name="Server1">
<data>%(user.home)/terracotta/server-data</data>
<logs>%(user.home)/terracotta/server-logs</logs>
</server>

<!-- If using a standby Terracotta server, also referred to as an ACTIVE-
PASSIVE configuration, add the second server here. -->
<server host="192.168.1.59" name="Server2">
<data>%(user.home)/terracotta/server-data</data>
<logs>%(user.home)/terracotta/server-logs</logs>
</server>
<ha>
<mode>networked-active-passive</mode>
<networked-active-passive>
<election-time>5</election-time>
</networked-active-passive>
</ha>
</servers>
<!-- Sets where the generated client logs are saved on clients. -->
<clients>
<logs>%(user.home)/terracotta/client-logs</logs>
</clients>
</tc:tc-config>

Using EHCache as 2LC in Hibernate.
Server : Jboss 6 M4 at both end and Terracotta application is deployed

Let me know any configuration info and logs needed

Thanks,
Siddharth
Hi Alex

Thanks for reply
Yes, I need transactional cache and further needs to deploy in cluster based environment (Active - Active mode)

Have started with standalone deployment

echcahe.xml

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="true" monitoring="autodetect" dynamicConfig="true">

<diskStore path="java.io.tmpdir"/>

<transactionManagerLookup class="net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup"
properties="jndiName=java:/PostgresDS" propertySeparator=";" />

<cacheManagerEventListenerFactory class="" properties=""/>

<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
diskSpoolBufferSizeMB="5"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
statistics="false"
transactionalMode="xa"
/>
<terracotta clustered="flase"/>
</ehcache>

Have created datasource PostgresDS as well need to supply database connectivity properties in hibernate

So will single JNDI based lookup (XA Transaction) will be serve hibernate & EHCache then how to do it ?

and need to test concurrency in standalone mode first so what's misconfiguration is here

any guide reference for configuring in distributed mode

Thanks,
Siddharth


No, I am not using two different isolation levels

Let me share configuration

Code

session = sessionFactory.openSession();
Transaction t = session.beginTransaction();
Contact con = (Contact)session.load(Contact.class, new Long(4));
System.out.println("Session last name : "+con.getLastName());
con.setLastName(request.getParameter("a"));

session1 = sessionFactory.openSession();
Transaction t1 = session1.beginTransaction();
Contact con1 = (Contact)session1.load(Contact.class, new Long(4));
System.out.println("Session1 last name : "+con1.getLastName());
con1.setLastName(request.getParameter("b"));

if(con == con1){
System.out.println("objects are same");
}else{
System.out.println("objects are different");
}

session.save(con);
t.commit();

try{
Thread.sleep(1000);
}catch (InterruptedException e) {
}
session1.save(con1);
t1.commit();



Hibernate Conf

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://host:port/corporate</property>
<property name="hibernate.connection.username">user</property>
<property name="hibernate.connection.password">passwd</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>

<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.max_statements">100</property>

<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</property>

<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.show_sql">true</property>
<mapping resource="contact.hbm.xml" />
</session-factory>
</hibernate-configuration>


contact.hbm.xml - OR Mapping

<hibernate-mapping>
<class name="bean.Contact" table="CONTACT" lazy="true" >
<cache usage="read-write" />
<id name="id" type="long" column="ID" >
<generator class="sequence" >
<param name="sequence">contact_id</param>
</generator>
</id>
<property name="firstName">
<column name="FIRSTNAME" />
</property>
<property name="lastName" lazy="true">
<column name="LASTNAME"/>
</property>
<property name="email">
<column name="EMAIL"/>
</property>
</class>
</hibernate-mapping>

and Default EHCache Configuration

Please let me know if any configuration is missed
Any locking related configuration in hibernate / EHCache configuration file ?

I want to prevent write of next parallel, operation MVCC is needed
I have started to explore EHCache, Now While I testing data concurrency , Have some doubts

Parallel transaction updates record, which is not desirable behavoiour for my application, need to fail subsequent transaction on same records
Here I am reading Same record from two different session objects

Time Read Write

1 Tx1 (Read database Record,will fetch from database)

2 Tx2 (Read same database record, will be served from 2LC (EHCache), New instance object as different session is used)

3 Tx1 (Database update successful)

4 Tx2 (Again database update successful , This should not happen in case of repeatable read as before writing transaction must have track the fetch version and intermediate commit has been done on time 3 is done, so one this event exception must arise)

Cache is transaction configured, I think repeatable read should work over here and next update should get failed as data already updated

Is there any configuration missed ?
 
Profile for siddhart -> Messages posted by siddhart [6]
Go to:   
Powered by JForum 2.1.7 © JForum Team