[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]
Spring + Terracotta Example  XML
Forum Index -> Terracotta for Spring
Author Message
navneet

journeyman

Joined: 03/12/2007 21:17:02
Messages: 13
Location: Delhi, India
Offline

My Example is as follow (using spring + terracotta):

public class Class1{

}
public class Class2{

}

public abstract class AbstractClass{

public Class1 c1;
public Class2 c2;

// getter/setter
// other unimplemented methods.

}


public class ConcreteClass extends AbstractClass{

// method implemented here+ other methods.

}


applicationContext.xml
------------------------------

<bean id="c1" class="Class1"/>
<bean id="c2" class="Class2"/>

<bean id="con" class="ConcreteClass">
<property name="c1" ref="c1"/>
<property name="c2" ref="c2"/>
</bean>

---------------------------------------

tc-config.xml
(under <spring><jee-application name="spring"><application-contexts><application-context>)
-----------------

<bean name="con">
<non-distributed-field>c1</non-distributed-field>
<non-distributed-field>c2</non-distributed-field>
</bean>



--------------------------------

Problem:

when terracotta instrumenting "con" bean then it gives error.


Attempt to share an instance of a non-portable class referenced by a portable class. This
unshareable class has not been included for sharing in the configuration. Please add this
class to the <includes> section of the configuration file.



But when I make "AbstractClass" as non abstract class and create its bean in applicationContext.xml and passes it to tc-config.xml file in <application-context><bean> tag and make c1 and c2 as non distributive field then it works.

Any idea where I am wrong.
-I posted this in terracotta session also by mistake.



Regards,
Navneet Singhal
ekulesho

master

Joined: 12/04/2006 08:49:08
Messages: 57
Offline

There is a discovery mechanism in Terracotta for Spring that should automatically add classes for all clustered beans into the instrumentation. However it skips classes that explicitly declared in <instrumented-classes> section of tc-config.xml (that is done to allow manual tweaking of the instrumentation and locking parameters). Can you please verify that you don't have ConcreteClass listed there.

If it is not listed, it is possible that this scenario somehow trigger a bug in this discovery mechanism. So, please open a JIRA issue and attach sources of those classes, spring's xml file and tc-config.xml

Also, as a workaround you can try to add both AbstractClass and ConcreteClass into the <instrumented-classes> section.
[WWW]
navneet

journeyman

Joined: 03/12/2007 21:17:02
Messages: 13
Location: Delhi, India
Offline

Thanks for reply.

I have not added either Concrete class nor Abstract class to the instrumented-classes tag.
I only add Concrete class to the
<spring>
<jee-application name="spring">
<application-contexts>
<application-context>
<bean name="con">
<non-distributed-field>c1</non-distributed-field>
<non-distributed-field>c2</non-distributed-field>
</bean>

........


I will try the workaround you have suggested and will post to the forum.
I will also add the code to that.





Regards,
Navneet Singhal
 
Forum Index -> Terracotta for Spring
Go to:   
Powered by JForum 2.1.7 © JForum Team