[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
additional-boot-jar-classes  XML
Forum Index -> Terracotta Platform
Author Message
alaa.murad

neo

Joined: 08/22/2008 12:37:35
Messages: 3
Offline

Hi everyone,
I successfully clustered my first simple application and I was impressed by Terracotta and I think this is the best addition to the Java platform since Java 1.5. But when I moved Terracotta to my real application that use Batik and other Java2D class, I got error for the boot jar, I really don't know what that means ,but I added the classes that Terracotta complained about, but the problem never ended , I kept adding classes and every time I ran the application it complain again about new classes. can it just show me all the classes that I need to add at once ?.

<additional-boot-jar-classes>
<include>sun.font.TextSource</include>
<include>sun.font.StandardTextSource</include>
<include>sun.font.CoreMetrics</include>
<include>java.awt.font.GlyphVector</include>
<include>sun.font.StandardGlyphVector</include>
<include>sun.font.AttributeValues</include>
<include>java.text.NumberFormat</include>
<include>java.text.Format</include>
<include>java.text.DecimalFormat</include>
<include>java.text.DecimalFormatSymbols</include>
<include>java.text.DigitList</include>
<include>java.util.Locale</include>
<include>java.awt.geom.Area</include>
<include>java.awt.geom.CubicCurve2D</include>
<include>java.awt.geom.CubicCurve2D$Double</include>
<include>sun.awt.geom.Curve</include>
<include>sun.awt.geom.Order0</include>
<include>java.awt.font.TextLayout</include>
<include>sun.awt.geom.Order1</include>
<include>sun.awt.geom.Order3</include>
<include>java.awt.font.TextLine$TextLineMetrics</include>
<include>java.awt.font.TextLine</include>
<include>java.awt.font.FontRenderContext</include>
<include>sun.font.ExtendedTextLabel</include>
<include>sun.font.TextLabel</include>
<include>sun.font.ExtendedTextSourceLabel</include>
<include>sun.awt.SunHints$Value</include>
<include>java.awt.RenderingHints$Key</include>
<include>sun.awt.SunHints$Key</include>
<include>sun.font.Decoration</include>
<include>sun.font.Decoration</include>
<include>java.awt.Font</include>
</additional-boot-jar-classes>

As you can see that the list kept getting bigger and bigger and the problem still there.

I also don't really need to cluster any of those classes!!

Any idea ?

Al
tgautier

seraphim

Joined: 06/05/2006 12:19:26
Messages: 1781
Offline

Something you are trying to cluster is referencing objects of those types. If you are not explicitly trying to cluster those classes, you need to figure out what is making that reference, and turn it transient.

I wish I could point you to a resource that describes this in detail, but at the moment the document that would describe this particular step is missing the part about the transients.

The document that describes the process of configuration is here:

http://www.terracotta.org/web/display/orgsite/Configuring+Terracotta

In the future, this doc will also discuss how to deal with snipping the object graph in the right place to avoid unnecessary clustered object graphs.

Your instinct is right though - when you are adding instrumentation for classes that are not written by you, there is most likely something wrong.

As a short term fix - when you get the next exception, leave your server running. Connect the admin console to it, and navigate to the clustered object browser. This will give you a picture of the object graph at that point - navigate the graph and confirm that it contains the data you were intending to cluster. If you encounter references to data that you think should not be clustered, that is the point where you should add a transient field to snip that part of the graph off.
[WWW]
colonel

journeyman

Joined: 07/23/2008 03:22:04
Messages: 12
Offline

I've also had the same issue: In adding TC support to my (web-)app, I've had to do lots and lots of iterations of

1) start TC client app
2) execute some actions until NonPortableException or similar occurs
3) shutdown app
4) edit tc-config.xml
- continue with step 1)

I'm lucky in that my app is not that big and I really tried to limit the usage of TC to a few critical sections... but still it took me a a few hours of repetitive work to finally get TC configured up properly.

@TC guys: Is there any way users can contribute to the project's code? Maybe I can put in a few hours and save the next people getting started w/ TC on an existing project some hours of unnecessary work.
I would think that this issue could be quite easily resolved by traversing the object graph from the first non instrumented reference and putting together a nice output for the user which helps w/ fixing the tc-config.xml batch-wise instead of one-class-at-a-time.

@Al:
If you haven't already, you could try to find the points in your code where there are field references that you could exclude from clustering instead of adding their classes to the list of instrumented classes. The only issue is that one has to take care of getting the correct reference back if a field is omitted on clustering and the parent object is getting constructed from what is already there in the TC server. (Hope I'm coming across.. ;) Let me know if I don't, I could then show a piece of sample code and config.)

- Denis
alaa.murad

neo

Joined: 08/22/2008 12:37:35
Messages: 3
Offline

Ok ,now I'm getting a new error, the class java.lang.ref.SoftReference is an internal class in Batik , I do use Batik but I don't understand why Terracotta bother clustering it.

/////////////////////////////////////////////////////
Attempt to share an instance of a non-portable class referenced by a portable class. This
unshareable class is a JVM- or host machine-specific resource. Please ensure that instances
of this class don't enter the shared object graph.

For more information on this issue, please visit our Troubleshooting Guide at:
http://terracotta.org/kit/troubleshooting

Referring class : sun.font.StandardGlyphVector
Referring field : sun.font.StandardGlyphVector.vbcacheRef
Thread : main
JVM ID : VM(32)
Unshareable class: java.lang.ref.SoftReference

Action to take:

1) Change your application code
* Ensure that no instances of java.lang.ref.SoftReference
are added to any shared object graph

- OR -

2) Mark the offending field as transient (and thus not shared)
* edit your tc-config.xml file
* locate the <dso> element
* add this snippet inside the <dso> element, above the <locks> element

<transient-fields>
<field-name>null</field-name>
</transient-fields>

* if there is already a <transient-fields> element present, simply add
the new field inside it


*******************************************************************************

at com.tc.object.ClientObjectManagerImpl.throwNonPortableException(ClientObjectManagerImpl.java:826)
at com.tc.object.ClientObjectManagerImpl.checkPortabilityOfTraversedReference(ClientObjectManagerImpl.java:718)
at com.tc.object.ClientObjectManagerImpl.access$900(ClientObjectManagerImpl.java:82)
at com.tc.object.ClientObjectManagerImpl$NewObjectTraverseTest.checkPortability(ClientObjectManagerImpl.java:1059)
at com.tc.object.Traverser.addReferencedObjects(Traverser.java:48)
at com.tc.object.Traverser.traverse(Traverser.java:89)
at com.tc.object.ClientObjectManagerImpl.addToManagedFromRoot(ClientObjectManagerImpl.java:982)
at com.tc.object.ClientObjectManagerImpl.create(ClientObjectManagerImpl.java:338)
at com.tc.object.ClientObjectManagerImpl.lookupOrCreateIfNecesary(ClientObjectManagerImpl.java:402)
at com.tc.object.ClientObjectManagerImpl.lookupOrCreate(ClientObjectManagerImpl.java:375)
at com.tc.object.tx.ClientTransactionManagerImpl.logicalInvoke(ClientTransactionManagerImpl.java:743)
at com.tc.object.TCObjectLogical.logicalInvoke(TCObjectLogical.java:20)
at com.tc.object.bytecode.ManagerImpl.logicalInvoke(ManagerImpl.java:235)
at com.tc.object.bytecode.ManagerUtil.logicalInvoke(ManagerUtil.java:274)
at java.util.Hashtable.put(Hashtable.java)
at com.nnaass.liger.core.World.startPopulations(World.java:46)
at com.nnaass.front.WorldButtons.main(WorldButtons.java:29)
Exception in thread "main" com.tc.exception.TCNonPortableObjectError:
*******************************************************************************
Attempt to share an instance of a non-portable class referenced by a portable class. This
unshareable class is a JVM- or host machine-specific resource. Please ensure that instances
of this class don't enter the shared object graph.

For more information on this issue, please visit our Troubleshooting Guide at:
http://terracotta.org/kit/troubleshooting

Referring class : sun.font.StandardGlyphVector
Referring field : sun.font.StandardGlyphVector.vbcacheRef
Thread : main
JVM ID : VM(32)
Unshareable class: java.lang.ref.SoftReference

colonel

journeyman

Joined: 07/23/2008 03:22:04
Messages: 12
Offline

I was too slow I guess :)

tgautier wrote:

As a short term fix - when you get the next exception, leave your server running. Connect the admin console to it, and navigate to the clustered object browser. This will give you a picture of the object graph at that point - navigate the graph and confirm that it contains the data you were intending to cluster. If you encounter references to data that you think should not be clustered, that is the point where you should add a transient field to snip that part of the graph off. 


Good suggestion, that'll help me next time I come across a TCNonPortableException. You really should put that in the docs, as it's not easy to figure out where a reference comes from most of the time.
jgalang

master

Joined: 05/24/2006 15:08:59
Messages: 54
Offline

I'd suggest looking at the sharededitor sample application that comes with the kit.

It's an application that uses Java 2D classes (similar to yours) and it will give you an idea on how to work with TC in the same scenario. One take-away from it is that, it avoids clustering those classes or classes that would pull it in the object graph.

(In addition to Taylor's comment above) a rule of thumb is to cluster only fields that represent states or classes that represent the model portion of your application.

Some small refactoring work might be in your future :)


Want to post to this forum? Please join the Terracotta community: >Sign up

tgautier

seraphim

Joined: 06/05/2006 12:19:26
Messages: 1781
Offline

colonel wrote:

@TC guys: Is there any way users can contribute to the project's code? Maybe I can put in a few hours and save the next people getting started w/ TC on an existing project some hours of unnecessary work.
I would think that this issue could be quite easily resolved by traversing the object graph from the first non instrumented reference and putting together a nice output for the user which helps w/ fixing the tc-config.xml batch-wise instead of one-class-at-a-time.

 


Yes definitely, but typically we start people off in the Forge on external projects, integrations and the like before moving on to full contribution.

I can make a suggestion though for a simple application that has very little dependency on Terracotta that would implement something like you suggest (work in batch rather than iteratively).

It would go like this:

The app would connect to the debug port of a running Java process. Let it pick an instance as a root, and then it should traverse the object graph from that point.

The output of traversing this object graph could be a config file that has all the appropriate instrumented classes, boot-jar and locking stanzas appropriately filled in.

Essentially, it could be a "config file" jump start tool - you don't need much in the way of support from Terracotta to try out a project like this - you just need to know the format of the XML file and how to connect to the Java jdb port and read memory.

After an initial prototype is built, I can imagine it having features that allow you to automatically select parts of the graph to be transient, to adjust lock stanzas (read/write) and so on.

What do you think? We can easily give you write access to the Terracotta Forge.


[WWW]
colonel

journeyman

Joined: 07/23/2008 03:22:04
Messages: 12
Offline

Great idea, that would be a very nice tool indeed and the effort for implementing it is not too high.
Can I just put up a new wiki page in the TC Forge Confluence for a quick design writeup of the tool and as a place for discussion if someone else would like to get involved?
And write access to the Forge would be great. What do I need to do for that?
tgautier

seraphim

Joined: 06/05/2006 12:19:26
Messages: 1781
Offline

Yes, you should already have write access in the wiki (access it from the home page of terracotta.org / community / wiki).

http://www.terracotta.org/confluence/display/wiki/Home

It won't really matter much where you put your page - we are going to tackle reorganizing the wiki soon now that the main push for re-launching the terracotta.org site is finished.

Just post a pointer back here where your page is.

I will send a note to get you access to labs in the Forge. This is where projects start off.
[WWW]
 
Forum Index -> Terracotta Platform
Go to:   
Powered by JForum 2.1.7 © JForum Team