[Tomcat, HTTPD, Servlets & JSP] - How to set Character Encoding correctly?
by spec_third
Hi,anybody help me
I write two jsp files. Content as following:
a.jsp
------------------------------------------------
| <%@ page language="java" contentType="text/html; charset=UTF-8"%>
| <html>
| <HEAD>
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
| </HEAD>
| <body>
| <script language="javascript">
| function _goto(){
| location.href=encodeURI("b.jsp?names=??");
| }
| </script>
| </body>
| </html>
b.jsp
------------------------------------------------------------------
| <%@ page language="java" contentType="text/html; charset=UTF-8"%>
| <html>
| <HEAD>
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
| </HEAD>
| <body>
| <%
| request.setCharacterEncoding("UTF-8");
| String names = request.getParameter("names");
| System.out.println("Names:"+names);
| %>
| </body>
| </html>
following is configuration:
jbossweb-tomcat50.sar/server.xml
| <Service name="jboss.web" className="org.jboss.web.tomcat.tc5.StandardService">
| <Connector useBodyEncodingForURI="true" URIEncoding="UTF-8"/>
|
Console print:
Names:????????????
While I set 'useBodyEncodingForURI' to false,Console print is OK:
Names:??
why? what is real meaning of 'useBodyEncodingForURI=true'.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957617#3957617
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957617
19 years, 9 months
[JBoss Seam] - Re: ajax4js and seam integration - my guide
by gus888
Hi Holger,
Thank you very much for your guidance. Now, I did not get the "java.lang.ClassNotFoundException: No ClassLoaders found for:
org.ajax4jsf.framework.util.config.FilterBean" when I start the JBoss4.0.4.GA. However, when I run my application from browser, I got another exceptions:
javax.servlet.ServletException: org.apache.jasper.JasperException
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:64)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:224)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
I did put all the libs:
el-api.jar
el-ri.jar
jsf-facelets.jar
ajax4jsf.jar
oscache-2.2.jar
in $JBOSSSERVERHOME/default/lib. Thank you and anybody in advance for further guidance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957616#3957616
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957616
19 years, 9 months
[JBoss jBPM] - Re: How to Handle Process Execution History
by brado
I must really be missing something here. I traced into the jbpmContext.save(processInstance) call, and the call stack eventually arrives at the following method in the org.jbpm.svc.save.CheckUnpersistableVariablesOperation class:
| public void save(ProcessInstance processInstance, JbpmContext jbpmContext) {
| Collection updatedVariableContainers = VariableContainer.getUpdatedVariableContainers(processInstance);
| if (updatedVariableContainers!=null) {
|
| // loop over all updated variable containers
| Iterator iter = updatedVariableContainers.iterator();
| while (iter.hasNext()) {
| VariableContainer variableContainer = (VariableContainer) iter.next();
| Map variableInstances = variableContainer.getVariableInstances();
| if (variableInstances!=null) {
|
| // loop over all variable instances in the container
| Iterator varInstancesIter = variableInstances.entrySet().iterator();
| while (varInstancesIter.hasNext()) {
| Map.Entry entry = (Map.Entry) varInstancesIter.next();
| String name = (String) entry.getKey();
| VariableInstance variableInstance = (VariableInstance) entry.getValue();
|
| // if the variable is of the unpersistable type... booom!
| if (variableInstance instanceof UnpersistableInstance) {
| Object value = variableInstance.getValue();
| if (value!=null) {
| throw new JbpmException("variable '"+name+"' in '"+variableContainer+"' contains '"+value+"': type '"+value.getClass().getName()+"' is unpersistable according to the jbpm.varmapping.xml configuration");
| } else {
| throw new JbpmException("variable '"+name+"' in '"+variableContainer+"' was created with a non persistable value");
| }
| }
| }
| }
| }
| }
| }
|
Tracing through this code, I don't see where or how either log data or the process instance is ever saved to the database. I must be missing it, but where in this code (or in any code) is the actual save made to the database? Again, I'm using jbpm3.1.1.
Thanks for your help...
Brad
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957615#3957615
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957615
19 years, 9 months
[JBoss Eclipse IDE (users)] - Re: Frequent
by rob.stryker@jboss.com
Here's the issue: the plugin.xml requires a global max. For right now I set the global max at 7.5 minutes (450,000 ms). Any user-defined max will not be able to go beyond this global max. If you think this global max is too low, please suggest a higher one.
For the release we are making this week, there is no preference dialog yet, and you are correct to notice that changing the xml does not change the results for you.
My code checks the plugin preferences (which you are not yet able to set) and if they are not set, it defaults to 180000 ms (instead of the 120000 ms from before, but as you said still not high enough for you.)
The build this week will go out with this 3 minute effective max unless you all make a big stink about it and demand a higher one, in which case I can probably convince Marshall to initiate a rebuild and set the effective max to the global max for this release.
I suppose I should have done that anyway.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957614#3957614
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957614
19 years, 9 months
[JBoss jBPM] - Re: How to Handle Process Execution History
by brado
After further review, I think the links given may have left some important information out, in combination with possibly some confusing comments in the default jbpm.cfg.xml file. Anyway, I altered my jbpm.cfg.xml file once again, to be exactly the same as the default file (the reason I did this is that I think the default file may be getting overwritten with an empty jbpm.cfg.xml due to how the ant build script is working).
Anyway, I did this, and those changes to the jbpm.cfg.xml (the ones recommended in the links given and the ones I performed) build to the jbpm.sar.cfg.jar which is inside the sar file. After deploying this new sar, JBoss starts cleanly again. However, running the process and saving the process does not write anything to the JBPM_LOG table or the JBPM_PROCESSINSTANCE table. Both are still empty. So I guess I'm right back where I started. Here's my current jbpm.cfg.xml file:
<jbpm-configuration>
|
| <!--
| The default configurations can be found in org/jbpm/default.jbpm.cfg.xml
| Those configurations can be overwritten by putting this file called
| jbpm.cfg.xml on the root of the classpath and put in the customized values.
| -->
|
| <jbpm-context>
| <service name="persistence"
| factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
| <service name="message"
| factory="org.jbpm.msg.db.DbMessageServiceFactory" />
| <service name="scheduler"
| factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
| <service name="logging"
| factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
| <service name="authentication"
| factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
| </jbpm-context>
|
| <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
| <string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />
| <string name="resource.business.calendar"
| value="org/jbpm/calendar/jbpm.business.calendar.properties" />
| <string name="resource.default.modules"
| value="org/jbpm/graph/def/jbpm.default.modules.properties" />
| <string name="resource.converter"
| value="org/jbpm/db/hibernate/jbpm.converter.properties" />
| <string name="resource.action.types"
| value="org/jbpm/graph/action/action.types.xml" />
| <string name="resource.node.types"
| value="org/jbpm/graph/node/node.types.xml" />
| <string name="resource.parsers"
| value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
| <string name="resource.varmapping"
| value="org/jbpm/context/exe/jbpm.varmapping.xml" />
|
| <long name="jbpm.msg.wait.timout" value="5000" singleton="true" />
| <int name="jbpm.byte.block.size" value="1024" singleton="true" />
| <string name="mail.smtp.host" value="localhost" />
| <bean name="jbpm.task.instance.factory"
| class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl"
| singleton="true" />
| <bean name="jbpm.variable.resolver"
| class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
| <bean name="jbpm.mail.address.resolver"
| class="org.jbpm.identity.mail.IdentityAddressResolver"
| singleton="true" />
|
| </jbpm-configuration>
|
Help!
Thanks,
Brad
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957611#3957611
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957611
19 years, 9 months
[JBoss Eclipse IDE (users)] - Re: Frequent
by mjdinsmore
Rob, You mentioned:
"rob.stryker(a)jboss.com" wrote : How long is it taking your server to start? If it is actually close to where my timeout is, I can either try to increase the timeout or allow the user to do it.
Does your later comment:
"rob.stryker(a)jboss.com" wrote : For this week's release I've up'd the default timeout to 180000 ms, and I've added what I feel is better information to the event log regarding what's going on. You'll also be able to select an item in the 'event log' section of the view and, if the properties view is visible, get some additional information.
|
| Hopefully this will help. At least I'm certain if it happens again I'll get more useful information back.
|
| - Stryker
mean that you did not add the user configurable timeout? I tried changing ...\eclipse\plugins\org.jboss.ide.eclipse.as.core_1.0.0.Alpha\plugin.xml with the startTimeout and stopTimeout values to something else but it didn't seem to have any effect. I'd be happy if the timeout was set to 300000 ms as even 180000 ms isn't going to be anywhere close to long enough for things to start up... (the larger value would at least give me breathing room)
Am I missing something? Should that manual change in the plugin.xml file actually be used?
thanks,
Mike
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957610#3957610
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957610
19 years, 9 months
[JBoss Messaging] - Can not read data for version 3. Supported versions: 1, 2
by toddjtidwell
I have deployed JBoss Messaging 1.01 CR3 as per the instructions given. I have created my own destinations successfully. However, my standalone producer application is throwing the following error:
ava.io.IOException: Can not read data for version 3. Supported versions: 1, 2
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:458)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:328)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:116)
at org.jboss.remoting.Client.invoke(Client.java:610)
at org.jboss.remoting.Client.invoke(Client.java:602)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.invoke(ClientConnectionFactoryDelegate.java:198)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate$getClientAOPConfig_8697532701842707646.invokeNext(ClientConnectionFactoryDelegate$getClientAOPConfig_8697532701842707646.java)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPConfig(ClientConnectionFactoryDelegate.java)
at org.jboss.jms.client.JBossConnectionFactory.ensureAOPConfigLoaded(JBossConnectionFactory.java:234)
at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:197)
at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:109)
at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:104)
Server Side, I am seeing this error in the logs:
20:07:35,544 ERROR [ServerThread] failed
java.lang.IllegalStateException: Invalid format type 36
at org.jboss.jms.server.remoting.JMSWireFormat.read(JMSWireFormat.java:6
99)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(Se
rverThread.java:350)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.j
ava:412)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.jav
a:239)
Does anyone have any ideas?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957609#3957609
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957609
19 years, 9 months
[JBossCache] - Re: TreeCache/Hibernate/JBossAS optimistic locking problem
by steve.ebersole@jboss.com
| //$Id: OptimisticTreeCache.java 9965 2006-05-30 13:00:28 -0500 (Tue, 30 May 2006) steve.ebersole(a)jboss.com $
| package org.hibernate.cache;
|
| import java.util.HashMap;
| import java.util.Iterator;
| import java.util.Map;
| import java.util.Set;
| import java.util.Comparator;
|
|
| import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
| import org.jboss.cache.Fqn;
| import org.jboss.cache.optimistic.DataVersion;
| import org.jboss.cache.config.Option;
| import org.jboss.cache.lock.TimeoutException;
|
| /**
| * Represents a particular region within the given JBossCache TreeCache
| * utilizing TreeCache's optimistic locking capabilities.
| *
| * @see OptimisticTreeCacheProvider for more details
| *
| * @author Steve Ebersole
| */
| public class OptimisticTreeCache implements OptimisticCache {
|
| // todo : eventually merge this with TreeCache and just add optional opt-lock support there.
|
| private static final Log log = LogFactory.getLog( OptimisticTreeCache.class);
|
| private static final String ITEM = "item";
|
| private org.jboss.cache.TreeCache cache;
| private final String regionName;
| private final Fqn regionFqn;
| private OptimisticCacheSource source;
|
| public OptimisticTreeCache(org.jboss.cache.TreeCache cache, String regionName)
| throws CacheException {
| this.cache = cache;
| this.regionName = regionName;
| this.regionFqn = Fqn.fromString( regionName.replace( '.', '/' ) );
| }
|
|
| // OptimisticCache impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| public void setSource(OptimisticCacheSource source) {
| this.source = source;
| }
|
| public void writeInsert(Object key, Object value, Object currentVersion) {
| writeUpdate( key, value, currentVersion, null );
| }
|
| public void writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion) {
| try {
| Option option = new Option();
| DataVersion dv = ( source != null && source.isVersioned() )
| ? new DataVersionAdapter( currentVersion, previousVersion, source.getVersionComparator(), source.toString() )
| : NonLockingDataVersion.INSTANCE;
| option.setDataVersion( dv );
| cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
| }
| catch ( Exception e ) {
| throw new CacheException( e );
| }
| }
|
| public void writeLoad(Object key, Object value, Object currentVersion) {
| try {
| Option option = new Option();
| option.setFailSilently( true );
| option.setDataVersion( NonLockingDataVersion.INSTANCE );
| cache.remove( new Fqn( regionFqn, key ), "ITEM", option );
|
| option = new Option();
| option.setFailSilently( true );
| DataVersion dv = ( source != null && source.isVersioned() )
| ? new DataVersionAdapter( currentVersion, currentVersion, source.getVersionComparator(), source.toString() )
| : NonLockingDataVersion.INSTANCE;
| option.setDataVersion( dv );
| cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
|
| // Cache impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| public Object get(Object key) throws CacheException {
| try {
| Option option = new Option();
| option.setFailSilently( true );
| // option.setDataVersion( NonLockingDataVersion.INSTANCE );
| return cache.get( new Fqn( regionFqn, key ), ITEM, option );
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
| public Object read(Object key) throws CacheException {
| try {
| return cache.get( new Fqn( regionFqn, key ), ITEM );
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
| public void update(Object key, Object value) throws CacheException {
| try {
| Option option = new Option();
| option.setDataVersion( NonLockingDataVersion.INSTANCE );
| cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
| public void put(Object key, Object value) throws CacheException {
| try {
| log.trace( "performing put() into region [" + regionName + "]" );
| // do the put outside the scope of the JTA txn
| Option option = new Option();
| option.setFailSilently( true );
| option.setDataVersion( NonLockingDataVersion.INSTANCE );
| cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
| }
| catch (TimeoutException te) {
| //ignore!
| log.debug("ignoring write lock acquisition failure");
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
| public void remove(Object key) throws CacheException {
| try {
| // tree cache in optimistic mode seems to have as very difficult
| // time with remove calls on non-existent nodes (NPEs)...
| if ( cache.get( new Fqn( regionFqn, key ), ITEM ) != null ) {
| Option option = new Option();
| option.setDataVersion( NonLockingDataVersion.INSTANCE );
| cache.remove( new Fqn( regionFqn, key ), option );
| }
| else {
| log.trace( "skipping remove() call as the underlying node did not seem to exist" );
| }
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
| public void clear() throws CacheException {
| try {
| Option option = new Option();
| option.setDataVersion( NonLockingDataVersion.INSTANCE );
| cache.remove( regionFqn, option );
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
| public void destroy() throws CacheException {
| try {
| Option option = new Option();
| option.setCacheModeLocal( true );
| option.setFailSilently( true );
| option.setDataVersion( NonLockingDataVersion.INSTANCE );
| cache.remove( regionFqn, option );
| }
| catch( Exception e ) {
| throw new CacheException( e );
| }
| }
|
| public void lock(Object key) throws CacheException {
| throw new UnsupportedOperationException( "TreeCache is a fully transactional cache" + regionName );
| }
|
| public void unlock(Object key) throws CacheException {
| throw new UnsupportedOperationException( "TreeCache is a fully transactional cache: " + regionName );
| }
|
| public long nextTimestamp() {
| return System.currentTimeMillis() / 100;
| }
|
| public int getTimeout() {
| return 600; //60 seconds
| }
|
| public String getRegionName() {
| return regionName;
| }
|
| public long getSizeInMemory() {
| return -1;
| }
|
| public long getElementCountInMemory() {
| try {
| Set children = cache.getChildrenNames( regionFqn );
| return children == null ? 0 : children.size();
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
| public long getElementCountOnDisk() {
| return 0;
| }
|
| public Map toMap() {
| try {
| Map result = new HashMap();
| Set childrenNames = cache.getChildrenNames( regionFqn );
| if (childrenNames != null) {
| Iterator iter = childrenNames.iterator();
| while ( iter.hasNext() ) {
| Object key = iter.next();
| result.put(
| key,
| cache.get( new Fqn( regionFqn, key ), ITEM )
| );
| }
| }
| return result;
| }
| catch (Exception e) {
| throw new CacheException(e);
| }
| }
|
| public String toString() {
| return "OptimisticTreeCache(" + regionName + ')';
| }
|
| public static class DataVersionAdapter implements DataVersion {
| private final Object currentVersion;
| private final Object previousVersion;
| private final Comparator versionComparator;
| private final String sourceIdentifer;
|
| public DataVersionAdapter(Object currentVersion, Object previousVersion, Comparator versionComparator, String sourceIdentifer) {
| this.currentVersion = currentVersion;
| this.previousVersion = previousVersion;
| this.versionComparator = versionComparator;
| this.sourceIdentifer = sourceIdentifer;
| log.trace( "created " + this );
| }
|
| /**
| * newerThan() call is dispatched against the DataVersion currently
| * associated with the node; the passed dataVersion param is the
| * DataVersion associated with the data we are trying to put into
| * the node.
| * <p/>
| * we are expected to return true in the case where we (the current
| * node DataVersion) are newer that then incoming value. Returning
| * true here essentially means that a optimistic lock failure has
| * occured (because conversely, the value we are trying to put into
| * the node is "older than" the value already there...)
| */
| public boolean newerThan(DataVersion dataVersion) {
| log.trace( "checking [" + this + "] against [" + dataVersion + "]" );
| if ( dataVersion instanceof CircumventChecksDataVersion ) {
| log.trace( "skipping lock checks..." );
| return false;
| }
| else if ( dataVersion instanceof NonLockingDataVersion ) {
| // can happen because of the multiple ways Cache.remove()
| // can be invoked :(
| log.trace( "skipping lock checks..." );
| return false;
| }
| DataVersionAdapter other = ( DataVersionAdapter ) dataVersion;
| if ( other.previousVersion == null ) {
| log.warn( "Unexpected optimistic lock check on inserting data" );
| // work around the "feature" where tree cache is validating the
| // inserted node during the next transaction. no idea...
| if ( this == dataVersion ) {
| log.trace( "skipping lock checks due to same DV instance" );
| return false;
| }
| }
| return versionComparator.compare( currentVersion, other.previousVersion ) >= 1;
| }
|
| public String toString() {
| return super.toString() + " [current=" + currentVersion + ", previous=" + previousVersion + ", src=" + sourceIdentifer + "]";
| }
| }
|
| /**
| * Used in regions where no locking should ever occur. This includes query-caches,
| * update-timestamps caches, collection caches, and entity caches where the entity
| * is not versioned.
| */
| public static class NonLockingDataVersion implements DataVersion {
| public static final DataVersion INSTANCE = new NonLockingDataVersion();
| public boolean newerThan(DataVersion dataVersion) {
| log.trace( "non locking lock check...");
| return false;
| }
| }
|
| /**
| * Used to signal to a DataVersionAdapter to simply not perform any checks. This
| * is currently needed for proper handling of remove() calls for entity cache regions
| * (we do not know the version info...).
| */
| public static class CircumventChecksDataVersion implements DataVersion {
| public static final DataVersion INSTANCE = new CircumventChecksDataVersion();
| public boolean newerThan(DataVersion dataVersion) {
| throw new CacheException( "optimistic locking checks should never happen on CircumventChecksDataVersion" );
| }
| }
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957608#3957608
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957608
19 years, 9 months
[JBossCache] - Re: TreeCache/Hibernate/JBossAS optimistic locking problem
by steve.ebersole@jboss.com
So if you could, I can post here the latest changes I have made to the o.h.c.OptimisticTreeCache class for you to verify. It should fix the vast majority of the issue you were seeing. There are still some "transactionality mismatch" (for lack of a better term) issues Hibernate and JBoss Cache need to work through. For Hibernate users this would effect only two areas I am aware of:
1) query result caching. This will not work at all with JBoss Cache in optimistic mode. The underlying issue being that Hibernate tries to write some info needed for query result caching into the underlying cache during after-transaction processing which JBoss Cache barfs at. Actually this *will* work as long as the queries are not requested less than .6 seconds after updates to any of the "table spaces" that affect that result...
2) an edge case where CMT is utilized relying on Hibernate's flush-on-completion where Hibernate made no calls into the TreeCache prior to the commit/flush and the flush actually needs to write state changes...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957607#3957607
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957607
19 years, 9 months