CWSIA0112E: The property name Keep-Alive is not a valid Java identifier - spring-boot

I see tonnes of logs for all header properties that have hyphen -
[30-5-18 17:13:14:321 CEST] 00001622 SystemOut O WARN
[integration.jms.DefaultJmsHeaderMapper] failed to map Message header
'Keep-Alive' to JMS property javax.jms.MessageFormatException:
CWSIA0112E: The property name Keep-Alive is not a valid Java
identifier.
[30-5-18 17:13:14:321 CEST] 00001622 SystemOut O WARN
[integration.jms.DefaultJmsHeaderMapper] failed to map Message header
'Transfer-Encoding' to JMS property javax.jms.MessageFormatException:
CWSIA0112E: The property name Transfer-Encoding is not a valid Java
identifier.
How can I resolve all these errors and warnings
Does a custom header mapper help, any example?
Using Spring boot 1.4.3 and integration version 4.3.6. Application running on websphere default JMS provider 8.5.x
Thanks

I believe that the error means that you can't use dash in the property name.
You need to re-map this Keep-Alive into something like KeepAlive using HeaderEnricher and then remove it using HeaderFilter.

Related

Sleuth Brave headers are not compatible with JMS spec

I am using Sleuth in Spring Integration project to pass along tracing headers across JMS messages. IBM MQ is used for Queue Manager. This configuration is working all fine functionally. However, all the Brave header X-B3-* are not compatible with JMS spec? As IBM MQ client lib throws a warning about this -
Warning Message:
JMSCC0049: The property name 'X-B3-Sampled' is not a valid Java(tm) identifier.
JMS Payload:
2018-03-13 11:54:42.919 INFO [domain-batch,d5a9e59728d0846a,954264c0e98a448b,false] 141252 --- [ask-scheduler-2] c.l.p.module.biz.BackendServiceClient : Message: GenericMessage [payload=2018-03-13T11:54:42.856, headers={JMS_IBM_Character_Set=UTF-8, jms_destination=queue:///DEV.QUEUE.1, JMS_IBM_Encoding=273, jms_timestamp=1520956482869, JMS_IBM_PutApplType=28, spanId=9a20699cdc50f7e9, JMS_IBM_Format=MQSTR , JMSXDeliveryCount=1, X-B3-Sampled=0, JMS_IBM_PutTime=15544287, X-B3-TraceId=d5a9e59728d0846a, id=d40cfbec-5dce-a8cd-0d96-da0e3d761459, jms_messageId=ID:414d5120514d3120202020202020202035a3a35aae92fa20, JMS_IBM_MsgType=8, JMSXUserID=app , X-B3-ParentSpanId=385f47b14a627448, priority=4, JMSXAppID=BackendServiceApplication , spanTraceId=d5a9e59728d0846a, spanParentSpanId=385f47b14a627448, nativeHeaders={spanTraceId=[d5a9e59728d0846a], spanId=[9a20699cdc50f7e9], spanParentSpanId=[385f47b14a627448], spanSampled=[0]}, jms_redelivered=false, JMS_IBM_PutDate=20180313, X-B3-SpanId=9a20699cdc50f7e9, spanSampled=0}]
Is there an option in sleuth to change the header naming convention for JMS? Similar to the baggage naming convention ? Hopefully I am not missing something from the documentation.
EDIT:
Add the following log level config to suppress the warning exception
logging:
level:
org.springframework.integration.jms.DefaultJmsHeaderMapper: ERROR
I think those warnings can be ignored. We're setting both the X-B3-Sampled and the spanSampled headers (check this out https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation.java). The first ones are not compatible the second ones are JMS compatible
https://github.com/openzipkin/brave/issues/584 is the longer topic in brave. JMS is unfortunate.
Luckily, we've recently changed the format of the successor to B3 "Trace Context" which no longer uses hyphens so won't make JMS sad. https://github.com/w3c/distributed-tracing/tree/master/trace_context Note: this is not an implementation version of the spec yet, but anyway you can follow it.

WebSphere 8.5.5 and JMS annotations crash server application

I'm deploying an app that makes use of Spring 4.2.5, Hibernate 4.2.8, and JMS 1.1 on to WebSphere 8.5.5 and Oracle 12.
Resources such as the database connection manager, and JMS connection factory are set in the server and wired into the Spring app using JNDI.
When the app starts I see this in the logs:
[3/18/16 15:18:32:717 EST] 0000008b SystemOut O [B#631dd237/Set;
at org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor$1.inspect(JmsListenerAnnotationBeanPostProcessor.java:202)
at org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor$1.inspect(JmsListenerAnnotationBeanPostProcessor.java:198)
at org.springframework.core.MethodIntrospector$1.doWith(MethodIntrospector.java:72)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:495)
at org.springframework.core.MethodIntrospector.selectMethods(MethodIntrospector.java:68)
at org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor.postProcessAfterInitialization(JmsListenerAnnotationBeanPostProcessor.java:197)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1559)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
... 58 more
[3/18/16 15:18:32:718 EST] 0000008b SystemOut O [FIAT-CSP-NA] [WebContainer : 0] 2016-03-18 15:18:32,718 [INFO ] org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean: Closing JPA EntityManagerFactory for persistence unit default
As you can see it appears there is some sort of error in the JMSListenerAnnotationBeanPostProcessor, followed by a message indicating that the JPA entity manager is shutting down.
I presume from this that there is a JMS problem which is shutting down the app.
Has anyone seen this? Do you know what might be the issue?
I'm really stuck on this.
The answer turned out to be class path issues. (Isn't everything on Websphere!)
I needed to remove several jars from the war file that where conflicting with jars web sphere supplied.

How to configure Dynacache CacheProvider?

I'm trying to implement a Dynacache CacheProvider and having problems. Here is what I've done:
I've got my Dynacache CacheProvider implementation jar under D:\IBM\WebSphere85\AppServer\lib
I have com.ibm.ws.cache.CacheConfig.cacheProviderName configured as JVM custom property with the correct CacheProvider implementation class.
Created cacheinstance.properties located under D:\IBM\WebSphere85\AppServer\properties with the relevant settings including the com.ibm.ws.cache.CacheConfig.cacheProviderName right class name value.
I have the cacheinstance.properties also part of the Dynacache CacheProvider implementation jar.
I have the Object cache Instance configured to have a new dyna cache. This also have the com.ibm.ws.cache.CacheConfig.cacheProviderName as a custom system property.
My application using the following to access the cache:
code:
Properties props = new Properties();
props.put("com.ibm.ws.cache.CacheConfig.cacheProviderName","com.myCacheProvider");
map = (DistributedObjectCache)DistributedObjectCacheFactory.getMap("mycache",props);
I'm getting the following when the application trying to access DynaCache:
[9/18/12 10:10:52:917 EDT] 00000050 ServerCache E DYNA1066E: Unable to initialize the cache provider "com.myCacheProvider". The Dynamic cache will be used to create the cache instance "default" instead of the configured cache provider.
[9/18/12 10:10:52:919 EDT] 00000050 ServerCache E ENGLISH ONLY MESSAGE: cacheProvider is null. Check for the cache provider libraries
[9/18/12 10:10:52:920 EDT] 00000050 ServerCache I DYNA1001I: WebSphere Dynamic Cache instance named default initialized successfully.
I'm using WAS 8.5.
Any ideas what is going on and how to debug this?
Guy,
I would turn on Dyna cache trace to see why this error occurs
Trace String:
com.ibm.ws.cache.=all:com.ibm.ws.drs.=all
This should give us clues on what is happening and depending on what we see from the trace would provide us info on what to do next.
HTH

WebSphere MQ and mmx : Not able to connect with queues

We are using WebSphere MQ and mmx , however we are facing issues while trying to connect with queue:
[2/10/12 13:24:51:861 CST] 00000011 SystemOut O 13:24:51,861 INFO [ListenerThread] - Retry [=1] reconnecting to JMS Queue/Topic
[2/10/12 13:24:51:864 CST] 00000012 SystemOut O 13:24:51,864 INFO [ListenerThread] - Retry [=1] reconnecting to JMS Queue/Topic
[2/10/12 13:24:51:874 CST] 00000012 SystemOut O 13:24:51,874 INFO [JMSListener] - init() failed with JMSException during initializing JMS access: xxsvclnk.queue.ISEEOutboundQueue
[2/10/12 13:24:51:875 CST] 00000011 SystemOut O 13:24:51,875 INFO [JMSListener] - init() failed with JMSException during initializing JMS access: xxreqctr.queue.ISEEInboundQueue
Please let us know possible causes for this issue . we have done all the relevant changes (host name:port ) etc.
Per the update in the comments, the apps don't print linked exceptions and you do not have access to fix them. JMS exceptions are a multi-level data structure. The linked exceptions exist to hold vendor-specific diagnostic codes. If your apps do not print the entire JMS exception then the apps should be reported to the vendor or programmers as containing sev-1 defects. There is no possible justification for a JMS application to not print all levels of a multi-level diagnostic data structure. This post is a brilliant example of exactly why such practices are unjustified. Without a stack trace and linked exceptions, there is no data with which to diagnose production problems. The week (if that) saved on delivery of the code will be paid for many times over with an extended outage.
Your only other option here is to do tracing. Exactly what options are available depends on the versions of WMQ client and WMQ server that are installed. You do have enough access and/or support to find that out, yes?

mqjbnd05 error when deploying app on websphere

I have a fresh install of Wesphere 6.1 Fixpack 23. I have an app deployed that requires an MQSeries JMS Queue. I set up an MQSeries provider-based request and reply queue and an MQSeries provider-based queue connection factory. When the deployed app tries to access the queue, I receive the following error.
Any assistance would be appreciated. Thanks!
[5/28/09 10:33:42:538 EDT] 00000033 ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: espaapp. Exception thrown : org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.UnsatisfiedLinkError: mqjbnd05 (Not found in java.library.path)
Caused by: java.lang.UnsatisfiedLinkError: mqjbnd05 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:953)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:922)
at java.lang.System.loadLibrary(System.java:451)
at com.ibm.mq.MQSESSION.loadLib(MQSESSION.java:1028)
at com.ibm.mq.server.MQSESSION$1.run(MQSESSION.java:246)
at java.security.AccessController.doPrivileged(AccessController.java:192)
at com.ibm.mq.server.MQSESSION.(MQSESSION.java:243)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)
at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONServer.java:68)
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:508)
at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:213)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:186)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:225)
at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:84)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:173)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:795)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:709)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:664)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:160)
at com.ibm.mq.MQQueueManager.(MQQueueManager.java:550)
at com.ibm.mq.MQSPIQueueManager.(MQSPIQueueManager.java:62)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2427)
at com.ibm.mq.jms.MQConnection.createQMXA(MQConnection.java:1806)
at com.ibm.mq.jms.MQQueueConnection.(MQQueueConnection.java:105)
at com.ibm.mq.jms.MQQueueConnection.(MQQueueConnection.java:66)
at com.ibm.mq.jms.MQXAQueueConnection.(MQXAQueueConnection.java:59)
at com.ibm.mq.jms.MQXAQueueConnectionFactory.createXAQueueConnection(MQXAQueueConnectionFactory.java:82)
at com.ibm.ejs.jms.JMSManagedQueueConnection.createConnection(JMSManagedQueueConnection.java:123)
at com.ibm.ejs.jms.JMSManagedConnection.(JMSManagedConnection.java:315)
at com.ibm.ejs.jms.JMSManagedQueueConnection.(JMSManagedQueueConnection.java:71)
... More
Does this help?
java.lang.UnsatisfiedLinkError occurs when connecting to a queue manager
Also, within the JMS -> Queue Connection Factories section, select your Queue Connection Factory and check if your "Transport Type" is set to 'BINDINGS' or 'CLIENT'
I swapped mine to CLIENT and that seemed to help a lot.
Such error often happens as a result of passing null to port, host or QManager to connection factory. Try to check all parameters during execution. Normally MQ does not require mqjbnd05 library.
Try to find this file
libmqjbnd05.so
Add that to the LIBPATH for your JVM and try again.
GO to WebSphere Admin console. Environment -> WebSphere variables. Look for MQ_INSTALL_ROOT and modify its value to your MQ installation directory [MQ Home].

Resources