Replication exception with WebSphere 7 sessions - jsf

I have a JSF 2 + Spring 3 application that's currently being deployed to a clustered WebSphere 7 environment. The servers are configured for memory-to-memory replication for session handling. While running tests on the application, a common exception that's being generated is the following:
[1/3/12 20:34:48:784 EST] 0000003c WASSession E MTMBuffWrapper storeObject SESN0200E: Caught Exception while trying to serialize.
[1/3/12 20:34:48:785 EST] 0000003c WASSession E MTMHashMap handlePropertyHits SESN0202E: Failed to replicate attribute com.sun.faces.renderkit.ServerSideStateHelper.LogicalViewMap
Any idea as to what this means and how to resolve it? Thanks.

All objects on the session have to be Serializable for memory-to-memory replication (or database persistence) to work. Apparently the specified one is not.
(Hint, you can usually Google on the specific error code, which usually will send you to one of the official WebSphere InfoCenter pages.)

Related

enableTransaction not working with J2ee Container

I get below error when I consume message in a Jboss ejb container
2022-05-18 22:37:24,699 ERROR [org.jboss.resource.adapter.jms.inflow.JmsActivation] Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec#8315a9(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter#10a62f0 destination=queues/Subscriber.global.globalvirtual.e2e.cmdm.changepub.Virtual destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=java:/ACTIVEMQJMSNONXAProviderAsync user=ldcp.cmdm pass= )
javax.jms.JMSException: Please enable transactions on PulsarConnectionFactory with enableTransaction=true
After getting this error - I set enableTransaction=true and started getting different error
javax.jms.JMSException: not supported
at com.datastax.oss.pulsar.jms.PulsarConnection.createConnectionConsumer(PulsarConnection.java:685)
the error is in createConnectionConsumer.
This is the method called by the JBoss container.
This method is currently not implemented
https://github.com/datastax/pulsar-jms/blob/96606d0f22a1af8fdde0c5eff0f5dde086d9862c/pulsar-jms/src/main/java/com/datastax/oss/pulsar/jms/PulsarConnection.java#L685
the implementation should be quite straighforward.
There are integration tests for Payara and Apache TomEE but JBoss is still not covered.
Please open an issue on github.

Amazon SQS Outbound channel adapter won't initialize

I'm trying to start up a spring-int-aws flow that is writing to an SQS queue, but the context won't load.
Error starting ApplicationContext. To display the auto-configuration report
re-run your application with 'debug' enabled.
2016-10-03 14:10:51.848 ERROR 3741 --- [ main]
o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.springframework.integration.aws.outbound.SqsMessageHandler#0':
Bean instantiation via constructor failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.integration.aws.outbound.SqsMessageHandler]: Constructor
threw exception; nested exception is java.lang.NoSuchMethodError:
org.springframework.cloud.aws.messaging.core.QueueMessagingTemplate.<init
(Lcom/amazonaws/services/sqs/AmazonSQS;Lorg/springframework/cloud/aws/core/env/ResourceIdResolver;)V
....
Did some research: Inside of the SQSMessageHandler (v 1.0.0-RELEASE) it's attempting to create a QueueMessagingTemplate using a declared AmazonSQS object, however the QueueMessagingTemplate (v1.1.3 Release) it requires an AmazonSQSAsync object in the constructor. Since spring-cloud-aws uses the sub-interface, it seems that spring-int-aws should as well.
Am I missing something, or should this be an issue filed against the project?
spring-integration-aws is built against 1.1.1.
Please open an issue there so we can make a compatible build.
That said, it's pretty unusual for Spring projects to break APIs in a point release, so we should raise an issue for spring-cloud-aws too, to ask them to restore the other ctor (if possible), and cross-link the issues.
I opened issues.
We would wait for the disposition of that issue before doing anything in spring-integration-aws (but we should still go ahead and support the async option).

Why is taking too long to respond to Websphere the first time I invoke a SOAP Web Service (JAX-WS)?

I am using Websphere 8.5.5 and I've noted that my first call to a JAX-WS Web Services takes too long to respond. I get this in the LOG (trace level) and after 15 mins it works. I have EclipseLink MOXy as a JAXB provider
jaxb.properties:
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
javax.xml.bind.JAXBException:
Exception Description: Name collision. Two classes have the XML type with uri http://www.w3.org/2001/XMLSchema and name string.
- with linked exception:
[Exception [EclipseLink-50007] (Eclipse Persistence Services - 2.4.2.qualifier): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Name collision. Two classes have the XML type with uri http://www.w3.org/2001/XMLSchema and name string.]
Well, after a lot of research I've found that it seems to be a bug of Websphere because it adds some array classes to the JAXB Context for example (byte[], int[], String[]) the problem is that when it adds String[] to the list of classes for the JAXB Context MOXy can't handle and gives that error.
The good news is that it can be solved by adding a custom property into the "Generic JVM arguments" since Websphere >= 8.5.5.2
Servers > Server Types > WebSphere application servers > server_name >
Java and Process Management > Process definition > Java Virtual
Machine >Generic JVM arguments
-Dcom.ibm.websphere.webservices.jaxwsOptimizeLevelOne=true
In the following resources it doesn't say it does that but after checking JAXBContext creation in EclipseLink you can see that it doesn't send anymore those array classes thus solving the problem.
More information on this:
https://publib.boulder.ibm.com/httpserv/cookbook/WebSphere_Application_Server-WAS_Classic-Web_Services.html
http://www-01.ibm.com/support/docview.wss?uid=swg1PI14203
Log trace to detect how much time it takes to create JAXBContext on Websphere can be activated specifying this log level:
com.ibm.ws.websvcs.JAXBContextTrace=all
[7/7/16 16:34:28:908 CDT] 00000089 JAXBContextTr 3
org.apache.axis2.jaxws.message.databinding.JAXBUtils getJAXBContext
new JAXBContext constructed, elapsed time msec: 1035

Hazelcast exception in logging

Using:
Hazelcast 3.6.1
Log4j 2.5
slf4j 1.7.13
Hazelcast client using Log4j cannot log the Membership 'printout'
Member [localhost]:19325
This client is being initialized programmatically (not via spring).
Instead, exception is thrown by logging infrastructure
2016-03-09 15:49:34,195 hz.client_0_qv-core.event-4 ERROR An exception occurred processing Appender STDOUT java.lang.IllegalArgumentException: can't parse argument number:
Member [localhost]:19325
at java.text.MessageFormat.makeFormat(MessageFormat.java:1429)
at java.text.MessageFormat.applyPattern(MessageFormat.java:479)
at java.text.MessageFormat.<init>(MessageFormat.java:362)
at java.text.MessageFormat.format(MessageFormat.java:840)
at org.apache.logging.log4j.message.MessageFormatMessage.formatMessage(MessageFormatMessage.java:94)
The error isn't related to the number of cluster members.
Server is able to print the message just fine using the same codebase.
I can provide the full stack trace if needed.
Defining logging configuration with system property: -Dhazelcast.logging.type solved the issue.
Have you tried to bind Hazelcast logging directly to log4j?
http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#logging-configuration

How to handle error being thrown by ClusterListenerThread during the instantiation (by Spring) of my Hazelcast Client bean?

I am using Spring to configure a (lazy loaded) Hazelcast Client that connects to a 2 member cluster.
<hz:client id="hazelcast" lazy-init="true">
<hz:group name="${HzName}" password="${HzPassword}"/>
<hz:properties>
<hz:property name="hazelcast.client.connection.timeout">10000</hz:property>
<hz:property name="hazelcast.client.retry.count">600</hz:property>
<hz:property name="hazelcast.jmx">true</hz:property>
<hz:property name="hazelcast.logging.type">slf4j</hz:property>
</hz:properties>
<hz:network smart-routing="true" redo-operation="true" connection-attempt-period="5000"
connection-attempt-limit="2">
<hz:member>${HzMember1}</hz:member>
<hz:member>${HzMember2}</hz:member>
</hz:network>
</hz:client>
My issue is:
If, at the time of my application starting, BOTH of the cluster members happen to be unavailable then I am seeing ClusterListenerThread throwing a SEVERE exception:
WARNING: Unable to get alive cluster connection, try in 4945 ms later, attempt 1 of 2.
16-Apr-2015 14:57:34 com.hazelcast.client.spi.impl.ClusterListenerThread
WARNING: Unable to get alive cluster connection, try in 4987 ms later, attempt 2 of 2.
16-Apr-2015 14:57:39 com.hazelcast.client.spi.impl.ClusterListenerThread
SEVERE: Error while connecting to cluster!
java.lang.IllegalStateException: Unable to connect to any address in the config!
at com.hazelcast.client.spi.impl.ClusterListenerThread.connectToOne(ClusterListenerThread.java:273)
at com.hazelcast.client.spi.impl.ClusterListenerThread.run(ClusterListenerThread.java:79)
Caused by: com.hazelcast.spi.exception.RetryableIOException: java.util.concurrent.ExecutionException: com.hazelcast.core.HazelcastException: java.net.ConnectException: Connection refused
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$OwnerConnectionFuture.createNew(ClientConnectionManagerImpl.java:649)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$OwnerConnectionFuture.access$300(ClientConnectionManagerImpl.java:605)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.ownerConnection(ClientConnectionManagerImpl.java:268)
at com.hazelcast.client.spi.impl.ClusterListenerThread.connectToOne(ClusterListenerThread.java:245)
...which subsequently results in my Hazelcast Client bean not being instantiated and therefore everything downstream that relies upon it's existence blowing up as well.
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcast': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public static com.hazelcast.core.HazelcastInstance com.hazelcast.client.HazelcastClient.newHazelcastClient(com.hazelcast.client.config.ClientConfig)] threw exception; nested exception is java.lang.IllegalStateException: Cannot get initial partitions!
How can I detect and handle the error being thrown by ClusterListenerThread during the instantiation (by Spring) of my Hazelcast Client bean?
nb. I'm frustrated by the fact that the Client bean is not being constructed (despite there being no available members) because I know for a fact that an already constructed Client can handle having all of it's member's become unavailable and will happily start working again when one or more of those members become available again.
What you need to do is configure connectionAttemptLimit and connectionAttemptPeriod.
If you set connectionAttemptLimit to INT_MAX and pick a reasonable connectiontAttemptPeriod, the client will practically try to connect to given memberlist forever every X seconds. This is currently more like a workaround, because when you first open HazelcastClient it will block until one of the members become available. A further workaround, you can try to open the client in another dedicated thread.
About making a fully supported feature, there was a discussion going on by the hazelcast team here.
https://github.com/hazelcast/hazelcast/issues/552
I am adding a question as a reference to the issue.

Resources