[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]
Echo2 support  XML
Forum Index -> Terracotta for Web Sessions
Author Message
luca.garulli

neo

Joined: 04/10/2007 06:24:31
Messages: 1
Offline

Hi,
I'm trying to integrate Terracotta with Echo2 Web Framework. The first one problem I see is that Echo2 mantains a reference to HttpSession, so the Terracotta Session Configuration tool asks me to include com.terracotta classes since they substitute default Tomcat HttpSession implementation.

I can try to define that attribute as transient by descriptor but what happens when someone try to access to that NULL field?

Are there some best practices to resolve the problem to have references to HttpSession inside an object contained itself inside the HttpSession?

Thanks in advance,
Luca Garulli
www.RomaFramework.org
zeeiyer

consul

Joined: 05/24/2006 14:28:28
Messages: 493
Offline

I can try to define that attribute as transient by descriptor but what happens when someone try to access to that NULL field? 


You can initialize the values of the attributes declared transient with some "on-load" bean-shell code which gets executed when that object gets loaded/faulted into a JVM from the Terracotta server (or handle the "null" in your application). See http://wiki.terracotta.org/confluence/display/docs1/Concept+and+Architecture+Guide#ConceptandArchitectureGuide-portability

Wrt the question around circular references - they are handled and since Terracotta preserves object-identity circular references do not seriously impact replication payload - since what is passed around are just references and not entire-copies of the objects invovled (HttpSessions in this case).

But just to ensure no misunderstanding, I gather that in your scenario, there are HttpSession instances that reference an object which in turn references the HttpSession instance itself - I take it you are using Terracotta Sessions and then trying to cluster sessions and you are attempting to mark the reference to HttpSession in that object as transient. Please confirm. So, your beanshell code could be re-setting that "nulled" reference by calling an "init" method in that class which does something like:
Code:
 Session s = SessionManager.getManager().getSession("mysessionid"); 
 <nulled-reference> = s
 

so when it get faulted into a JVM it resets the reference to the right value.

Ofcourse, one may also want to examine the app, to see if there is a need for a circular reference.
Best,
Sreeni Iyer
Terracotta.

Sreeni Iyer, Terracotta.
Not a member yet - Click here to join the Terracotta Community
Gordon

journeyman

Joined: 12/13/2006 00:38:30
Messages: 44
Offline

Hi Luca,

There are a couple of questions here -- a specific question about clustering the Echo2 web framework, and a more general question about working with transients. When a field of a shared object is marked transient, you can "re-hydrate" the field -- which would otherwise be NULL, as you say, by using bean shell scripting (shown below in the tc-config.xml snippet) or alternatively, a public void method that takes no arguments. The one you choose is executed/inoked when the object is faulted into any VM other than the one on which the reference was originally created.

<instrumented-classes>
<!-- This includes a certain set of classes for instrumentation. -->
<include>
<!-- The class(es) to include, as an AspectWerkz-compatible
class specification expression. See the Product Guide
for more details. (REQUIRED) -->
<class-expression>com.mycompany.pkga.*</class-expression>

<!-- If set to 'true', then any fields in the given class(es)
that have the Java 'transient' modifier are not shared
across JVMs. If set to 'false', they are.

Default: false -->
<honor-transient>true</honor-transient>
<on-load>
<!--This method will be called on instances of the specified class
on load of the object. Used to rewire transients. -->
<!--<method>aMethod</method>-->

<!-- This bean shell script is called right after an object is loaded -->
<execute><![CDATA[self.myTransientField = new ArrayList();]]></execute>
</on-load>
</include>

With respect to clustering Echo2, we have not formally attempted to cluster that yet internally. Please take a moment to report back on your efforts, and I or someone else on the team will be happy to continue to assist you in your efforts.

Regards,

Gordon
Sr. Systems Engineer
Terracotta, Inc.
praveena

journeyman

Joined: 03/07/2008 04:42:59
Messages: 19
Offline


Hi, I found that ROMA framework also used ECHO2 for their UI and other designing. Pleae let me know how far the issues of clustering was solved so far. Would be very thank ful if anyone who involved in this thread respond at the earliest how did the ECHO2 framework could resolve the issue with clustering.




Thanks in advance,
Praveena.
steve

ophanim

Joined: 05/24/2006 14:22:53
Messages: 619
Offline

The best way to get stuff like this clustered is to get people from the project interested on the echo2 forums. If they take on the work we will take the time to support them in a deep way. This is how many things have been integrated.

Want to post to this forum? Join the Terracotta Community
praveena

journeyman

Joined: 03/07/2008 04:42:59
Messages: 19
Offline


Thats sounding great Mr. Steve. The samples available are really impressive. But I want to know if there is solution to solve the exceptions raised with the ECHO2. Can Terracotta solve those?

Here is the o/p console I have got when running a simple echo2 application in the session-configurator.

Jun 11, 2008 5:46:16 PM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-9081
Jun 11, 2008 5:46:17 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jun 11, 2008 5:46:19 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-9081
2008-06-11 17:46:41,938 INFO - Terracotta 2.6.1, as of 20080530-180519 (Revision 8695 by cruise@rh4mo0 from 2.6)
2008-06-11 17:46:42,640 INFO - Configuration loaded from the file at '/home/praveena/software/terracotta-2.6.1/tools/sessions/configurator-sandbox/tomcat6.0/tc-config.xml'.

********************************* WARNING **********************************
* The following set of classes were automatically included in the boot jar
* since they are required super classes. Please add them in the
* <additional-boot-jar-classes> section of the terracotta config:
* [java.lang.Exception, java.lang.Throwable]
****************************************************************************

2008-06-11 17:46:44,984 INFO - Terracotta 2.6.1, as of 20080530-180519 (Revision 8695 by cruise@rh4mo0 from 2.6)
2008-06-11 17:46:45,425 INFO - Configuration loaded from the file at '/home/praveena/software/terracotta-2.6.1/tools/sessions/configurator-sandbox/tomcat6.0/tc-config.xml'.
2008-06-11 17:46:45,625 INFO - Log file: '/home/praveena/software/terracotta-2.6.1/tools/sessions/configurator-sandbox/logs/client-logs/9081/terracotta-client.log'.
2008-06-11 17:46:50,549 INFO - Statistics buffer: '/home/praveena/software/terracotta-2.6.1/tools/sessions/configurator-sandbox/statistics/9081'.
Jun 11, 2008 5:46:52 PM org.apache.catalina.startup.Embedded initDirs
SEVERE: Cannot find specified temporary folder at /home/praveena/software/terracotta-2.6.1/tools/sessions/configurator-sandbox/tomcat6.0/9081/temp
Jun 11, 2008 5:46:53 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-9081
Jun 11, 2008 5:46:53 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1161 ms
Jun 11, 2008 5:46:53 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 11, 2008 5:46:53 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
Jun 11, 2008 5:46:54 PM org.apache.catalina.realm.JAASRealm setContainer
INFO: Set JAAS app name Catalina
Jun 11, 2008 5:46:57 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive DepartmentTaskList.war
Jun 11, 2008 5:46:58 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive Cart.war
Jun 11, 2008 5:46:58 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/praveena/software/terracotta-2.6.1/tools/sessions/configurator-sandbox/tomcat6.0/9081/webapps/MySampleApp/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jun 11, 2008 5:46:58 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-9081
Jun 11, 2008 5:46:58 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5422 ms
com.tc.exception.TCNonPortableObjectError:
*******************************************************************************
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.

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

Referring class : com.terracotta.session.SessionRequest
Referring field : com.terracotta.session.SessionRequest.res
Thread : http-9081-1
JVM ID : VM(0)
Non-included class: org.apache.catalina.connector.Response

Action to take:

1) Reconfigure to include the unshareable classes
* edit your tc-config.xml file
* locate the <dso> element
* add this snippet inside the <dso> element

<instrumented-classes>
<include>
<class-expression>org.apache.catalina.connector.Response</class-expression>
</include>
</instrumented-classes>

* if there is already an <instrumented-classes> element present, simply add
the new includes inside it

It is possible that some or all of the classes above are truly non-portable, the solution
is then to mark the referring field as transient.


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

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.fieldChanged(ClientTransactionManagerImpl.java:627)
at com.tc.object.TCObjectImpl.objectFieldChanged(TCObjectImpl.java:297)
at nextapp.echo2.app.ApplicationInstance.__tc_setdefaultWindow(ApplicationInstance.java)
at nextapp.echo2.app.ApplicationInstance.setDefaultWindow(ApplicationInstance.java:680)
at nextapp.echo2.app.ApplicationInstance.doInit(ApplicationInstance.java:248)
at nextapp.echo2.webcontainer.ContainerInstance.init(ContainerInstance.java:218)
at nextapp.echo2.webcontainer.ContainerSynchronizeService.renderInit(ContainerSynchronizeService.java:417)
at nextapp.echo2.webrender.service.SynchronizeService.service(SynchronizeService.java:269)
at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
at nextapp.echo2.webrender.WebRenderServlet.doPost(WebRenderServlet.java:189)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at com.tc.tomcat55.session.SessionValve55.tcInvoke(SessionValve55.java:63)
at com.tc.tomcat55.session.SessionValve55.invoke(SessionValve55.java:50)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


PS: The web console is giving a dialog box "An application error has occured. Your session has been reset"

And my command console responded with a "Out of heap memory " and with the following stack trace

[root@praveena sessions]# ./sessions-configurator.sh
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at java.lang.StringCoding$StringEncoder.encode(StringCoding.java:232)
at java.lang.StringCoding.encode(StringCoding.java:272)
at java.lang.String.getBytes(String.java:947)
at sun.awt.datatransfer.DataTransferer.translateTransferable(DataTransferer.java:1021)
at sun.awt.datatransfer.DataTransferer$6.run(DataTransferer.java:2145)
Exception in thread "Timer-0" java.lang.OutOfMemoryError: Java heap space
at java.nio.ByteBuffer.wrap(ByteBuffer.java:350)
at java.nio.ByteBuffer.wrap(ByteBuffer.java:373)
at java.nio.charset.CharsetEncoder.isLegalReplacement(CharsetEncoder.java:318)
at java.nio.charset.CharsetEncoder.replaceWith(CharsetEncoder.java:267)
at java.nio.charset.CharsetEncoder.<init>(CharsetEncoder.java:186)
at java.nio.charset.CharsetEncoder.<init>(CharsetEncoder.java:209)
at sun.nio.cs.UTF_8$Encoder.<init>(UTF_8.java:369)
at sun.nio.cs.UTF_8$Encoder.<init>(UTF_8.java:366)
at sun.nio.cs.UTF_8.newEncoder(UTF_8.java:51)
at java.lang.StringCoding$StringEncoder.<init>(StringCoding.java:215)
at java.lang.StringCoding$StringEncoder.<init>(StringCoding.java:207)
at java.lang.StringCoding.encode(StringCoding.java:266)
at java.lang.String.getBytes(String.java:947)
at java.io.UnixFileSystem.canonicalize0(Native Method)
at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:157)
at java.io.File.getCanonicalPath(File.java:559)
at java.util.prefs.FileSystemPreferences.lockFile(FileSystemPreferences.java:885)
at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:714)
at java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:807)
at java.util.prefs.FileSystemPreferences.syncWorld(FileSystemPreferences.java:451)
at java.util.prefs.FileSystemPreferences.access$1200(FileSystemPreferences.java:33)
at java.util.prefs.FileSystemPreferences$4.run(FileSystemPreferences.java:419)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Exception in thread "Thread-83" java.lang.OutOfMemoryError: Java heap space
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod0(Class.java:2679)
at java.lang.Class.getMethod(Class.java:1603)
at com.tc.management.JMXConnectorProxy$ConnectorInvocationHandler.invoke(JMXConnectorProxy.java:90)
at $Proxy0.getMBeanServerConnection(Unknown Source)
at com.tc.management.JMXConnectorProxy.getMBeanServerConnection(JMXConnectorProxy.java:141)
at com.tc.admin.ServerConnectionManager.testIsConnected(ServerConnectionManager.java:302)
at com.tc.SessionIntegratorFrame.isL2Accessible(SessionIntegratorFrame.java:1484)
at com.tc.SessionIntegratorFrame.access$4900(SessionIntegratorFrame.java:101)
at com.tc.SessionIntegratorFrame$L2ShutdownMonitor.run(SessionIntegratorFrame.java:1836)
Exception in thread "Thread-85" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-84" java.lang.OutOfMemoryError: Java heap space




gkeim

ophanim

Joined: 12/05/2006 10:22:37
Messages: 685
Location: Terracotta, Inc.
Offline

As I noted on one of the other threads you have going about your dufficulty, the NonPortableObjectDialog is attempting to show a very large object graph. You can limit the depth of the object graph by setting this system property for your Tomcat instances:

export JAVA_OPTS=-Dorg.terracotta.non-portable.max-walk-depth=3

Set this in the shell from which you are running the Session Configurator and then restart.

Gary Keim (terracotta developer) Want to post to this forum? Join the Terracotta Community
 
Forum Index -> Terracotta for Web Sessions
Go to:   
Powered by JForum 2.1.7 © JForum Team