[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: denov  XML
Profile for denov -> Messages posted by denov [12]
Author Message
if i place the two jars into tomcat's lib dir then my app starts up. if i place them into WEB-INF/lib of my app then it doesn't.
i'm having bit of a time trying to upgrade from 3.2.1 to 3.3.0. i'm following the instructions on http://www.terracotta.org/documentation/ga/web-sessions-install.html. when i start up tomcat i get the following

Code:
java.lang.ClassNotFoundException: org.terracotta.session.TerracottaTomcat60xSessionValve


my META-INF/context.xml looks like

Code:
 <Context>
    <Valve className="org.terracotta.session.TerracottaTomcat60xSessionValve" tcConfigUrl="localhost:9510"/>
 </Context>
 


i'm running this under win7x64 using 6.0.21x86 jvm and tomcat 6.0.20

and i've place the 2 (session and toolkit) jars into my class path. they are in my /lib dir with all my other jars. this is a spring project that uses MVC and security.



thanks in advanced.

Not sure what DWR version you're using, but I'd think code should work with <auto-lock> applied to it:

http://svn.directwebremoting.org/dwr/trunk/core/impl/main/java/org/directwebremoting/impl/DefaultScriptSessionManager.java

At least for the getScriptSession() method that is...
 


i am running against the latest 3.0rc1, which is what's in the trunk. i think i just need locks around getScriptSession() and to set sessionMap as a root with

Code:
 <autolock auto-synchronized="false">
    <method-expression>*com.autoreturn.dispatch.db.UserPreferences.getScriptSession(..)</method-expression>
     <lock-level>write</lock-level>
 </autolock>
 
 <roots>
   <root>
       <field-name>org.directwebremoting.impl.DefaultScriptSessionManager.sessionMap</field-name>
       <root-name>DwrSessionMap</root-name>
   </root>
 </roots>
 


what all do i need to restart with changing the lock section of my tc_config? both clients and tc server? do i need to re-gen my boot jar?


Honestly I don't think you want to attempt to try to cluster the internals of DWR (or any other substantial framework) yourself.
 


of course! but i really want to get this to work.
when trying to the following in my tc_config.xml

Code:
            
                 <named-lock>
                     <lock-name>lockDWR</lock-name>
                     <method-expression>* org.directwebremoting.impl.DefaultScriptSessionManager.getScriptSession*(..)
                     </method-expression>
                     <lock-level>write</lock-level>
                 </named-lock>
 
              <roots>
                 <root>
                     <field-name>org.directwebremoting.impl.DefaultScriptSessionManager.sessionMap</field-name>
                     <root-name>DwrSessionMap</root-name>
                 </root>
             </roots>
 
 


i have to used a name lock for the DWR. the code is syncronized, i think correctly. autolocks give me a UnlockedSharedObjectException, even with auto-synchronized="false"

after that i ended up chasing TCNonPortableObjectError and the add to boot jar list exception till i got to the point where it wanted to add some sun.security. jar but the make boot jar script said i couldn't add it. at this point i had to add all sorts of class to be instrumented, include our gzip class for tomcat.

this is all done in a pretty large project that i can't share. what would be easiest thing i could do to get some help with it?

thx.

ari wrote:
What does dwr reverse ajax mean? Is that some special mode of dwr? I know Joe Walker was at Terracotta's booth at JavaOne 2008 with a joint DWR + Terracotta demo.
 


reverse ajax is pushing (vs polling) data in the browser. DWR has 3 modes of this. i'm trying to use piggyback, where DWR waits for a request from the browser and piggybacks the push payload on to the response.

i have DWR and terracotta working using only polling ('normal ajax') but have become a bit stuck trying out how to share the map that hold the list of sessions. i need Browser.withAllPage* to be able to see all sessions regardless to which app server node they are connected to via the load balancers.
has anybody made this work?
i'm trying to cluster DWR for reserve ajax via piggyback. i'm getting the following exception;

Code:
com.tc.object.util.ReadOnlyException: 
 ******************************************************************************
 Attempt to write to a shared object inside the scope of a lock declared as a
 read lock. All writes to shared objects must be within the scope of one or
 more shared locks with write access defined in your Terracotta configuration.
 
 Please alter the locks section of your Terracotta configuration so that this
 access is auto-locked or protected by a named lock with write access.
 
 For more information on this issue, please visit our Troubleshooting Guide at:
 http://terracotta.org/kit/troubleshooting 
 
     Caused by Thread: http-8080-1  in  VM(3)
 ******************************************************************************
 
 	at com.tc.object.tx.ClientTransactionManagerImpl.makeReadOnlyException(ClientTransactionManagerImpl.java:596)
 	at com.tc.object.tx.ClientTransactionManagerImpl.checkAndReportUnlockedSharedObjectException(ClientTransactionManagerImpl.java:527)
 	at com.tc.object.tx.ClientTransactionManagerImpl.checkWriteAccess(ClientTransactionManagerImpl.java:213)
 	at com.tc.object.bytecode.ManagerImpl.checkWriteAccess(ManagerImpl.java:443)
 	at com.tc.object.bytecode.ManagerUtil.checkWriteAccess(ManagerUtil.java:426)
 	at java.util.HashMap.put(Unknown Source)
 	at org.directwebremoting.impl.DefaultScriptSessionManager.getScriptSession(DefaultScriptSessionManager.java:107)
 	at org.directwebremoting.impl.DefaultWebContext.checkPageInformation(DefaultWebContext.java:87)
 	at org.directwebremoting.dwrp.BaseCallHandler.handle(BaseCallHandler.java:83)
 	at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:120)
 	at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:141)
 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 	at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:158)
 	at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
 	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
 	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 	at com.autoreturn.gzip.GZIPFilter.doFilter(GZIPFilter.java:28)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
 	at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
 	at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
 	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
 	at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
 	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
 	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
 	at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
 	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
 	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
 	at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
 	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
 	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
 	at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
 	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
 	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
 	at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
 	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
 	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
 	at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
 	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
 	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 	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:191)
 	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 org.terracotta.modules.tomcat.tomcat_5_5.SessionValve55.tcInvoke(SessionValve55.java:68)
 	at org.terracotta.modules.tomcat.tomcat_5_5.SessionValve55.invoke(SessionValve55.java:55)
 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
 	at java.lang.Thread.run(Thread.java:619)
 


My tc_config looks like;
Code:
 <?xml version="1.0" encoding="UTF-8"?>
 <tc:tc-config xmlns:tc="http://www.terracotta.org/config"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-5.xsd">
 
     <servers>
         <server host="localhost">
             <data>%(user.home)/terracotta/server-data</data>
             <logs>%(user.home)/terracotta/server-logs</logs>
         </server>
     </servers>
 
     <clients>
         <logs>%(user.home)/terracotta/client-logs</logs>
         <modules>
           <module name="tim-tomcat-6.0" version="2.1.0" />
           <module name="tim-spring-security-2.0" version="1.3.0"/>
           <module name="tim-hibernate-entity-3.2" version="1.5.0" />
         </modules>
     </clients>
 
     <application>
     <dso>
 
         <instrumented-classes>
             <include>
                 <class-expression>com.autoreturn.dispatch.db.UserPreferences</class-expression>
             </include>
             <include>
                 <class-expression>com.autoreturn.dispatch.db.TowCompany</class-expression>
             </include>
             <include>
                 <class-expression>com.autoreturn.dispatch.db.PolicePrecinct</class-expression>
             </include>
             <include>
                 <class-expression>com.autoreturn.dispatch.db.User</class-expression>
             </include>
             <include>
                 <class-expression>com.autoreturn.commons.model.Region</class-expression>
             </include>
             <include>
                 <class-expression>org.joda..*</class-expression>
             </include>
             <include>
                 <class-expression>org.springframework.security.userdetails.ldap.LdapUserDetailsImpl</class-expression>
             </include>
             <include>
                 <class-expression>org.directwebremoting.impl.DefaultScriptSessionManager</class-expression>
             </include>
         </instrumented-classes>
 
         <locks>
             <named-lock>
                 <lock-name>lockDWR</lock-name>
                 <method-expression>RealScriptSession org.directwebremoting.impl.DefaultScriptSessionManager.getScriptSession(..)</method-expression>
                 <lock-level>write</lock-level>
             </named-lock>
 
             <autolock auto-synchronized="false">
                 <method-expression>* com.autoreturn.dispatch.db.UserPreferences.*(..)</method-expression>
                 <lock-level>write</lock-level>
             </autolock>
             <autolock auto-synchronized="true">
                 <method-expression>* org.springframework.security.context.SecurityContextImpl.*(..)</method-expression>
                 <lock-level>write</lock-level>
             </autolock>
             <autolock auto-synchronized="true">
                 <method-expression>* org.joda.time.tz.CachedDateTimeZone.*(..)</method-expression>
                 <lock-level>write</lock-level>
             </autolock>
         </locks>
         
         <roots>
             <root>
               <field-name>org.directwebremoting.impl.DefaultScriptSessionManager.sessionMap</field-name>
               <root-name>DwrSessionMap</root-name>
             </root>
         </roots>
 
         <additional-boot-jar-classes>
             <include>javax.naming.directory.BasicAttributes</include>
         </additional-boot-jar-classes>
 
         <web-applications>
             <web-application session-locking="false">ads</web-application>
         </web-applications>
         
     </dso>
     </application>
 
 </tc:tc-config>
 


the method i'm trying to lock in DWR (org.directwebremoting.impl.DefaultScriptSessionManager.getScriptSession) looks like;

Code:
     public RealScriptSession getScriptSession(String sentScriptId, String page, String httpSessionId)
     {
         maybeCheckTimeouts();
 
         DefaultScriptSession scriptSession;
 
         synchronized (sessionLock)
         {
             scriptSession = sessionMap.get(sentScriptId);
             if (scriptSession == null)
             {
                 // Force creation of a new script session
                 String newSessionId = generator.generateId(16);
 
                 scriptSession = new DefaultScriptSession(newSessionId, this, page);
                 Loggers.SESSION.debug("Creating " + scriptSession + " on " + scriptSession.getPage());
 
                 sessionMap.put(newSessionId, scriptSession);
 
                 // See notes on synchronization in invalidate()
                 fireScriptSessionCreatedEvent(scriptSession);
 
                 // Inject a (new) script session id into the page
                 ScriptBuffer script = EnginePrivate.getRemoteHandleNewScriptSessionScript(newSessionId);
                 scriptSession.addScript(script);
 
                 // Use the new script session id not the one passed in
                 Loggers.SESSION.debug("ScriptSession re-sync: " + simplifyId(sentScriptId) + " has become " + simplifyId(newSessionId) + " on " + page);
             }
             else
             {
                 // This could be called from a poll or an rpc call, so this is a
                 // good place to update the session access time
                 scriptSession.updateLastAccessedTime();
 
                 String storedPage = scriptSession.getPage();
                 if (!storedPage.equals(page))
                 {
                     Loggers.SESSION.error("Invalid Page: Passed page=" + page + ", but page in script session=" + storedPage);
                     throw new SecurityException("Invalid Page");
                 }
             }
 
             associateScriptSessionAndPage(scriptSession, page);
             associateScriptSessionAndHttpSession(scriptSession, httpSessionId);
 
             // Maybe we should update the access time of the ScriptSession?
             //  scriptSession.updateLastAccessedTime();
             // Since this call could come from outside of a call from the
             // browser, it's not really an indication that this session is still
             // alive, so we don't.
         }
 
         return scriptSession;
     }
 


have you figure this out? my app is preforming horribly when i enable it in the client (dwr.engine.setActiveReverseAjax(true)).

sneakybeaky wrote:
No, I just went back to using 6.0.17. 


it seems like terracotta doesn't like 6.0.18. i downgraded to 6.0.13 and now tomcat starts up without problems.

sneakybeaky wrote:
Ah well spotted - I didn't realise it was an early access version of the JDK. When I used Java 6.0_17 everything works fine. So it's an issue in the ea release when -Xbootclasspath is used.

Thanks. 


did you fix this - if so how? i'm having the same problem with 6.0_18 (64bit).


thank for the quick replies.

the problem was a hostname mistake. the hostname on the server got change but /etc/hosts didn't get updated.

what's the -n for? i don't seem see this in the docs. is there any way i can get away without using?
i'm trying to configure a NAP TC cluster. i'm running into 2 different problems. one being a 'SPLIT BRAIN DETECTED' and the other is 'ClusterIDs dont match'. depending on what order i start my TC servers in and if i use or don't use the -n option i'll get one or the other. these problems show up after i start turning on my tomcat nodes. without tomcat running my TC cluster seems to be working. i'm using the same tc-config.xml file on both servers and both tomcat nodes. my config looks like
Code:
 <?xml version="1.0" encoding="UTF-8"?>
 <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>
     <server name="tc1" host="terracotta.autoreturn.com">
       <data>/var/terracotta/tc1-data</data>
       <logs>/var/terracotta/server-logs</logs>
       <statistics>/var/terracotta/server-statistics</statistics>
       <dso-port>9510</dso-port>
       <jmx-port>9520</jmx-port>
       <l2-group-port>9530</l2-group-port>
       <dso>
         <persistence>
           <mode>permanent-store</mode>
         </persistence>
       </dso>
     </server>
     <server name="dev-app1" host="dev-app1.autoreturn.com">
       <data>/var/terracotta/tc2-data</data>
       <logs>/var/terracotta/server-logs</logs>
       <statistics>/var/terracotta/server-statistics</statistics>
       <dso-port>9510</dso-port>
       <jmx-port>9520</jmx-port>
       <l2-group-port>9530</l2-group-port>
       <dso>
         <persistence>
           <mode>permanent-store</mode>
         </persistence>
       </dso>
     </server>
     
     <ha>
        <mode>networked-active-passive</mode>
        <networked-active-passive>
           <election-time>5</election-time>
        </networked-active-passive>
     </ha>  
 
     <update-check>
 	<enabled>true</enabled>
     </update-check>
 
   </servers>
   
   <clients>
     <logs>/var/terracotta/client-logs/%(webserver.log.name)</logs>
     <statistics>/var/terracotta/statistics/%(webserver.log.name)</statistics>
   </clients>
 
 
   <application>
     <dso>
       <instrumented-classes>
         <exclude>org.apache.coyote..*</exclude>
         <exclude>org.apache.catalina..*</exclude>
         <exclude>org.apache.jasper..*</exclude>
         <exclude>org.apache.tomcat..*</exclude>
         <include>
           <class-expression>org.acegisecurity..*</class-expression>
         </include>
         <include>
           <class-expression>java.lang.String$CaseInsensitiveComparator</class-expression>
         </include>
         <include>
           <class-expression>com.autoreturn.dispatch.db.UserPreferences</class-expression>
         </include>
         <include>
           <class-expression>com.autoreturn.commons.model.Region</class-expression>
         </include>
         <include>
           <class-expression>org.joda..*</class-expression>
         </include>
         <include>
           <class-expression>org.hibernate..*</class-expression>
         </include>
         <include>
           <class-expression>com.autoreturn..*</class-expression>
         </include>
         <include>
           <class-expression>org.springframework.core.NestedRuntimeException</class-expression>
         </include>
       </instrumented-classes>
       <!--Tell DSO which applications in your web container is using DSO-->
       <web-applications>
         <web-application>ads</web-application>
       </web-applications>
       <!--We declare the field 'service.ProductCatalog.catalog' a root, making it
            available for all instances of our app that runs via DSO-->
       <roots>
         <root>
           <field-name>demo.townsend.service.ProductCatalog.catalog</field-name>
           <root-name>ProductCatalog</root-name>
         </root>
       </roots>
       <additional-boot-jar-classes>
         <include>java.util.Locale</include>
         <include>java.lang.String$CaseInsensitiveComparator</include>
         <include>javax.naming.directory.BasicAttributes</include>
         <include>javax.naming.directory.BasicAttribute</include>
         <include>com.sun.jndi.ldap.LdapAttribute</include>
         <include>javax.naming.CompositeName</include>
         <include>com.sun.jndi.toolkit.ctx.ComponentDirContext</include>
         <include>com.sun.jndi.toolkit.ctx.PartialCompositeDirContext</include>
         <include>com.sun.jndi.toolkit.ctx.AtomicContext</include>
         <include>com.sun.jndi.toolkit.ctx.ComponentContext</include>
         <include>com.sun.jndi.toolkit.ctx.PartialCompositeContext</include>
         <include>com.sun.jndi.ldap.LdapCtx</include>
         <include>javax.naming.ldap.LdapName</include>
         <include>javax.naming.NameImpl</include>
         <include>javax.naming.ldap.Rdn</include>
         <include>javax.naming.ldap.Rdn$RdnEntry</include>
       </additional-boot-jar-classes>
       <transient-fields>
         <field-name>org.acegisecurity.ui.savedrequest.SavedRequest.contextPath</field-name>
         <field-name>org.acegisecurity.ui.savedrequest.SavedRequest.servletPath</field-name>
       </transient-fields>
     </dso>
   </application>
 
 </tc:tc-config>
 


does it matter what order i start my TC servers in? what mode should they start in - PASSIVE-UNINITIALIZED, ACTIVE-COORDINATOR ?

thx
 
Profile for denov -> Messages posted by denov [12]
Go to:   
Powered by JForum 2.1.7 © JForum Team