Spring Integration 4.1.0 Migration problems - java

I'm having problems migrating my application form spring-integration 4.0.4 to the recent 4.1.0 release.
Once replacing the jars, my integration context throws an exception for each <recipient-list-router/> tag.
The thrown exception is a java.lang.ClassCastException the message is:
Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy62 cannot be cast to org.springframework.integration.context.IntegrationObjectSupport
at org.springframework.config.AbstractSimpleMessageHandlerFactoryBean.createHandlerInternal(AbstractSimpleMessageHandlerFactoryBean.java:130)
at org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean.getObject(AbstractSimpleMessageHandlerFactoryBean.java:102)
at org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean.getObject(AbstractSimpleMessageHandlerFactoryBean.java:44)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanReagistrySupport.java:168)
... 20 more
I am using Spring-Integration 4.1.0.RELEASE, spring-core 4.1.2.RELEASE, and running on jdk1.8.0_05.
My Integration beans context contains two <recipient-list-router/> tags, which upon removal, do not throw this error.

The code from AbstractSimpleMessageHandlerFactoryBean says:
else if(!(this.handler instanceof AbstractReplyProducingMessageHandler)) {
if (logger.isDebugEnabled()) {
logger.debug("adviceChain can only be set to AbstractReplyProducingMessageHandler or its subclass, "
+ ((IntegrationObjectSupport) this.handler).getComponentName() + " doesn't support it.");
}
}
So, let's switch of debug for the org.springframework.integration category!
From other side I agree that it is a bug, because if our messageHandler is a Proxy we can't simply cast it to the IntegrationObjectSupport.
So, feel free to raise a JIRA ticket on the matter.
From other side it isn't clear why removal of <recipient-list-router/> evict an issue...
Because <recipient-list-router/> doesn't support <request-handler-advice-chain>.
I agree that we have introduced in the 4.1 the RecipientListRouterManagement and if you use JMX the special MBean will be registered for the RecipientListRouter and the last one becomes Proxy, but it isn't clrear how that proxying relates to the request-handler-advice-chain log message...
Would be great if you can debug for that line from AbstractSimpleMessageHandlerFactoryBean and show us the real object for that Proxy.
And show, please, more StackTrace . Maybe we can see more context to figure out the root of cause.
Thank you!

Related

Using WOLA in Liberty WebApp to access CICS

Trying to use WOLA direct from a webapp in Liberty to CICS. Using same CICS region successfully with z/OS Connect V2 (zCEE). With Liberty, I have configured:
<featureManager>
<feature>servlet-3.1</feature>
<feature>jndi-1.0</feature>
<feature>jaxrs-1.1</feature>
<feature>zosLocalAdapters-1.0</feature>
</featureManager>
and
<!-- WOLA group to which others register -->
<zosLocalAdapters wolaGroup="GROUP" wolaName2="LIBRTOLA" wolaName3="WOLA3" />
<connectionFactory id="wolaCF" jndiName="eis/ola">
<properties.ola RegisterName=CICSMLAW/>
</connectionFactory>
<resourceAdapter location="/usr/lpp/IBM/zosconnect/v2r0/wlp/lib/ola.rar"/>
In the messages.log, I see good and bad items there:
CWWKB0103I: Authorized service group WOLA is available The WebSphere Optimized Local Adapter channel registered with the Liberty profile server using the following name: GROUP LIBRTOLA WOLA3
and the bad:
com.ibm.ws.app.manager.AppMessageHelper E CWWKZ0013E: It is not possible to start two applications called ola.
So the failure on registration: Requestlgth: 97
Requestparms data 1: BBOC START_SRVR RGN=CICSMLA DGN=GROUP NDN=LIBRTOLA
Requestparms data 2: SVN=WOLA3 SVC= MNC=1 MXC=10 TXN=N SEC=N REU=N
Requestparms data 3:
Processing a START SERVER request.
Starting WAS adapters Server task ...
Server transaction id will be: BBO$
Link transaction defaults to: BBO#
Service name will be:
Trace TDQ: BBOQ
Processing a REGISTER API request.
Register name: CICSMLA string len: 7
WAS Daemon: GROUP WAS Node: LIBRTOLA WAS Server: WOLA3
Min. connections: 1
Max. connections: 10
Transactional: N string len: 1
Security propagation: N string len: 1
Invoking OLA Register API for CICSMLA .
on with the Liberty profile server was not successful. The return code is 8, and the reason code 8.
And the failure in the JNDI call:
Context ctx = new InitialContext();
ConnectionFactory cf = (com.ibm.ws390.ola.jca.ConnectionFactoryImpl)ctx.lookup("java:comp/env/eis/ola");
Results in error:
[err] javax.naming.NameNotFoundException: javax.naming.NameNotFoundException: java:comp/env/eis/ola
[err] at com.ibm.ws.jndi.url.contexts.javacolon.internal.JavaURLContext.lookup(JavaURLContext.java:356) [err] at [internal classes]
[err] at javax.naming.InitialContext.lookup(InitialContext.java:428)
[err] at com.ibm.ctl.bank.impls.CTLBankWolaImpl.(CTLBankWolaImpl.java:51)
[err] at com.ibm.ctl.bank.web.OLTPBankRest.setImpl(OLTPBankRest.java:235)
Thanks
You have a lot going on here.
I'm not sure why you're starting ola.rar from the z/OS Connect v2 product, inside of a Liberty server. The zosLocalAdapters-1.0 feature already loads the ola.rar that ships with Liberty. You should remove the configuration from server.xml. That should resolve the CWWKZ0013E error.
You should see two CWWKB0103I messages in messages.log, one for WOLA (which you included) and one for CLIENT.WOLA. Please be sure you see both. It's possible you're on a very old version of Liberty that doesn't print the second CWWKB0103I message, so if this is true, please disregard that part.
I don't think you would have gotten this far without finding the WOLA configuration instructions for the Liberty server in the knowledge center, but here they are for other's benefits:
https://www.ibm.com/support/knowledgecenter/en/was_beta_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_dat_enableconnector.html
OK next, I can't see your application to know whether you've got a resource-reference to a connection factory configured. I assume you do because you're doing a java:comp/env lookup. You do not need to cast to com.ibm.ws390.ola.jca.ConnectionFactoryImpl, and actually I highly recommend removing that since that is an internal class and subject to change at any time. It may be that the application class loader doesn't have access to that class, and that may be part of the problem.
Finally, you have a problem in CICS starting the link server. You are getting RC=8 RSN=8. A list of services and return/reason codes can be found here:
https://www.ibm.com/support/knowledgecenter/en/was_beta_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/rwlp_dat_olaapis.html
An 8/8 on BBOA1REG (register) indicates the register token is already in use. Basically, the RGN= name you picked is already in use. Are you sure there isn't a PLTPI transaction or something else in the CICS region that is already registered with that name? Perhaps try a different name just to see if it works, and if it does, maybe try BBOC LIST_SRVR to see what it is? It's difficult to say how it's getting started without knowing more about your system.
I hope this helps. Take care!

QuickFixJ - quickfix.UnsupportedMessageType: null(Websphere)

I developing something with QuickFixJ and I meet a strange situation. We have a stub to simulate the fix acceptor, locally on my environment is working I can send/receive messages we use a custom message type the quickfixj jar is regenerated based on new dictionary, new message types...
Example message from my env. communication between the FIX initiator and FIX_STUB(acceptor) :
16:49:58.475 [http-8080-4] INFO quickfixj.msg.outgoing - FIXT.1.1:FIX->FIX_STUB: 8=FIXT.1.1|9=267|35=RQS|34=3|49=FIX|52=20160628-13:49:58.474|56=FIX_STUB|20000=1|20001={json string}|20002=1.0|10=171|
<20160628-13:49:58, FIXT.1.1:FIX_STUB->FIX, incoming> (8=FIXT.1.1|9=267|35=RQS|34=3|49=FIX|52=20160628-13:49:58.474|56=FIX_STUB|20000=1|20001={json string}|20002=1.0|10=171|)
16:49:58.476 [QFJ Message Processor] INFO c.r.fix.api.stub.FixApplication - FIX STUB MESSAGE TYPE:quickfix.fix50sp2.Request
<20160628-13:49:58, FIXT.1.1:FIX_STUB->FIX, outgoing> (8=FIXT.1.1|9=308|35=RSP|34=3|49=FIX_STUB|52=20160628-13:49:58.527|56=FIX|20000=1|20001={json string}||20002=1.0|10=240|)
16:49:58.528 [NioProcessor-2] INFO quickfixj.msg.incoming - FIXT.1.1:FIX->FIX_STUB: 8=FIXT.1.1|9=308|35=RSP|34=3|49=FIX_STUB|52=20160628-13:49:58.527|56=FIX|20000=1|20001={json string}||20002=1.0|10=240|
16:49:58.529 [QFJ Message Processor] INFO c....fix.engine.FixEngineImpl - FIX MESSAGE TYPE:quickfix.fix50sp2.Response
on Tomcat is working but when we try to use the exactly same code in a test environment and deploy to a Websphere server I get this error:
2016-06-28 11:17:44,196 appl="rtv" env="SYS" version="3.8.12" loglevel="INFO " message="FIXT.1.1:FIX->FIX_STUB: 8=FIXT.1.19=26735=RQS34=249=FIX52=20160628-09:17:44.19656=FIX_STUB20000=120001={json string}20002=1.010=147" thread="WebContainer : 1" logger="quickfixj.msg.outgoing"
2016-06-28 11:17:44,198 appl="rtv" env="SYS" version="3.8.12" loglevel="INFO " message="FIX STUB MESSAGE TYPE:quickfix.fix50sp2.Message" thread="QFJ Message Processor" logger="c.r.fix.api.stub.FixApplication"
2016-06-28 11:17:44,202 appl="rtv" env="SYS" version="3.8.12" loglevel="ERROR" message="FIX STUB MESSAGE CRACK FAILED" thread="QFJ Message Processor" logger="c.r.fix.api.stub.FixApplication"
quickfix.UnsupportedMessageType: null
at quickfix.fix50sp2.MessageCracker.onMessage(MessageCracker.java:39) ~[quickfixj-messages-all-1.6.2.jar:1.6.2]
at quickfix.fix50sp2.MessageCracker.crack50(MessageCracker.java:1787) ~[quickfixj-messages-all-1.6.2.jar:1.6.2]
at quickfix.fix50sp2.MessageCracker.crack(MessageCracker.java:1555) ~[quickfixj-messages-all-1.6.2.jar:1.6.2]
at com....fix.api.stub.FixApplication.fromApp(FixApplication.java:97) ~[rita-web-3.8.jar:na]
As you can see in the example the type(message sub class) it's handled correctly (quickfix.fix50sp2.Request,quickfix.fix50sp2.Response ) but on Websphere is NOT (quickfix.fix50sp2.Message). MessageCracker is used.
Can you help me to fix this issue, to find out why this is happening is related to OS, web server or some FIX configuration?
I fixed the issue... it was related to classloader and duplicate classes. The way that I got the jar files contained also the default messages(maven dependencies ...) on Tomcat the application pick up the right classes while the WebSphere took the default one this is why the application MessageCracker didn't handled properly the messages.

Custom Internal Server Error Message Play Framework

In play framework, every time you get an Internal Server Error (500) in production mode, the browser shows a web page with
Oops, an error occured, This exception has been logged with id XXXX
I would like to customize the error message (or at least translate it to spanish), keeping the error id that makes it easier to look for in the application log.
I've tried to configure an error page in the Global settings in JAVA like this:
public Promise<Result> onError(RequestHeader request, Throwable t) {
return Promise.<Result>pure(internalServerError(
views.html.error.render(t)
));
}
Where I've a view named error.scala.html.
It is not working right now, it does not show any errors, just ignores it. Also with this alternative, I don't know how to display the error id.
I appreciate any suggestions, thanks a lot.
Is your Global class in the root package? That's a quite common mistake and also the reason why it is ignored.

GcsServiceImpl.createOrReplace Not working?

Summary
This happened since May 20th's night (Pacific Time). Initially, I thought it was Google Cloud Storage failure. It seems now that they supported my way of storing data before. But somehow, after May 20th, that API does not work the same way as before.
How did I call
GcsFileOptions fileOptions = new GcsFileOptions.Builder().mimeType("image/png").acl("public-read").build();
GcsFilename filename = new GcsFilename(fileBucket, objectName); // fileBucket="test", objectName="/code/my/yeuei"
GcsService service = GcsServiceFactory.createGcsService();
GcsOutputChannel oc = service.createOrReplace(filename,fileOptions); //error happens here.
Error
Google Cloud Storage API gives error when the object is not existing.
GcsServiceImpl.createOrReplace method
I am creating a new object.
E 10:03:00.643 com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
com.google.appengine.tools.cloudstorage.NonRetriableException: java.lang.NullPointerException
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:120)
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:166)
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:156)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl.createOrReplace(GcsServiceImpl.java:68)
This line seems causing the error -
Caused by: java.lang.NullPointerException
at com.google.appengine.tools.cloudstorage.oauth.URLFetchUtils$HTTPRequestInfo.<init>(URLFetchUtils.java:80)
at com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsService.beginObjectCreation(OauthRawGcsService.java:184)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:71)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:68)
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:108)
Nothing on the status page. You might wish to check it in the future.
Ok. This is resolved. I am still not sure how it is introduced in the first place.
Here is what happens -
There is a class URLFetchUtils in App Engine GCS Client library, when it initiates, it did not check if payload is null, that creates the NullPointer exception. Today, GCS Java Client Library has an update fixed this issue, so if you use the latest version (app engine GCS 0.3.12), this error will go away. Interestingly, I have no idea how it worked before :) ... But anyway, I am glad that my app is working again - after about 24 hours down.

Log4J SMTP digest/aggregate emails?

I have a JBOSS batch application that sometimes sends hundreds on emails in a minute to the same email address with Log4J errors. This causes problems with Gmail, because it says we are sending emails too quickly for that gmail account.
So I was wondering if there was a way to basically create a "digest" or "aggregate" email puts all the error logs in 1 email and sends that every 5 minutes. So that way every 5 minutes we may get a large email, but at least we actually get the email instead of it being delayed for hours and hours by gmail servers rejecting it.
I read this post that suggested something about using an evaluator to do that, but I couldn't see how that is configured in the Log4J xml configuration file. It also seemed like it might not be able to "digest" all the logs into 1 email anyway.
Has anyone done this before? Or know if it's possible?
From (the archived) SMTPAppender Usage page:
set this property
log4j.appender.myMail.evaluatorClass = com.mydomain.example.MyEvaluator
Now you have to create the evaluator class and implement the org.apache.log4j.spi.TriggeringEventEvaluator interface and place this class in a path where log4j can access it.
//Example TriggeringEventEvaluator impl
package com.mydomain.example;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.spi.TriggeringEventEvaluator;
public class MyEvaluator implements TriggeringEventEvaluator {
public boolean isTriggeringEvent(LoggingEvent event) {
return true;
}
}
You have to write the evaluator logic within this method.
I created a free useable solution for log4j2 with an ExtendedSmtpAppender.
(If you still use log4j 1.x, simply replace your log4j-1.x.jar with log4j-1.2-api-2.x.jar - and log4j-core-2.x.jar + log4j-api-2.x.jar of course.)
You get it from Maven Central as de.it-tw:log4j2-extras (This requires Java 7+ and log4j 2.8+).
If you are restricted to Java 6 (and thus log4j 2.3) then use de.it-tw:log4j2-Java6-extras
Additionally, see the GitLab project: https://gitlab.com/thiesw/log4j2-extras (or https://gitlab.com/thiesw/log4j2-Java6-extras)
[OLD text:
If you use log4j2, see answer to other stack overflow issue: https://stackoverflow.com/a/34072704/5074004
Or directly go to my external but publically available solution presented in https://issues.apache.org/jira/browse/LOG4J2-1192
]

Categories

Resources