JBoss ESB pipeline interceptors - jboss

I am new to JBoss ESB and I am trying to intercept and handle all messages that happen on my application server.
I found that pipeline interceptors are what I am looking for. However, I am unable to make them work. Could you direct me to any tutorial concerning this problematigue? I tried documentation for JBoss ESB but this section is very vague. Is there any working sample with pipeline interceptors? I have not found any...
Here is what I have tried:
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.message.PipelineInterceptor;
import org.jboss.soa.esb.message.Message;
public class Interceptor implements PipelineInterceptor {
#Override
public void processMessage(Message msg, ConfigTree arg1) {
System.out.println("Intercepted" + msg.getContext());
}
}
I programmed this very simple class and converted it into a .jar file and placed it in the root directory of my project. I also copied jbossesb-properties.xml next to it and uncommented the interceptors section. What else should I do? Where do I specify the path to my interceptor class?
Any help is appreciated...

Ok, after a day of trying everything possible, I think I have solved it. You have to place the .jar file with Interceptor somewhere in the path of ESB (the best way is probably to the folder with deployed ESB in AS) and specify path to it in jbossesb-properties.xml file...

Related

Vertx multiple event loops

I'm a beginner with Vertx and I'm using this link as the starter code.
However, there is no main file and I don't see how the MainVerticle is deployed. I would like to set some deployment options for the MainVerticle but since there is no main file; how would I do that?
I recommend this link for you to improve your vert.x knowledge from zero to hero.You will be able to make a crud application using this repository.
https://github.com/saranglohar/vertx-crud-operations-demo/tree/master/src/main/java/com/vertx/student/crud
The two common ways to do that :
build a fat jar using the maven shade plugin or exec plugin and the io.vertx.core.Launcher class as main class, according to this documentation. Then you will be able to run your fat jar with a java -jar command.
My favorite : use the vertx command line (like you would do with nodejs for example).
I'd prefer the second solution in order to avoid the duplication of the vert.x core library in your filesystem which can have a real cost when you have to run bunch of vert.x microservices.
Afterwards to go further you can encapsulate that with a resilient services orchestrator like systemd or even docker+kubernetes & co.
You can use main() very easily:
public class Application {
public static void main(String args[]) {
Vertx vertx = Vertx.vertx()
vertx.deployVerticle(new MainVerticle());
}
}

Eclipse Scout Neon : service registry does not contain a service of type

I try to call scout service from Scout Form, so I create interface in shared folder
#TunnelToServer
public interface IPersonsFormService extends IService {
void test();
}
and in server I created implementation of this interface
public class PersonsFormService implements IPersonsFormService {
#Override
public void test() {
System.out.println("TEST");
}
}
but I get
o.e.scout.rt.platform.exception.ExceptionHandler - SecurityException:service registry does not contain a service of type com.sixt.leasing.contract.scout.shared.person.IPersonsFormService [majorPrincipal: 'marko']
java.lang.SecurityException: service registry does not contain a service of type com.sixt.leasing.contract.scout.shared.person.IPersonsFormService
It looks like interface is not registered, but in Neon I thought that service is registered with #TunnelToServer annotation.
Where else should I register service ?
This project is extension project of main project.
In Main project all services works,....
Solution: put scout.xml with default content in src/main/resources/META-INF folder of the server project.
Why did this happen? Since this is an extension we apparently forgot to copy this file and Scout Neon seems to ignore projects that don't contain this file.
Figured this out by putting a PlatformListener in that project and since that never triggered it was easier to track down the issue.
This annotation is requested for Remote-Service (see also the 3.5.1. #TunnelToServer section). The implementation class (or the interface) should have the #ApplicationScoped annotation.
For Local-Service, use either the #Bean or the #ApplicationScoped annotation to register the service.
If your annotations are correct, your Jandex index might be broken.
Start the application with -Djandex.rebuild=true to rebuild the application on startup.
This will recalculate each of your target/classes/META-INF/jandex.idx files.
Of course, you can also delete each file manually. Running mvn clean also clean those files.

How to share a GWT RPC RemoteServiceServlet among multiple client modules / apps

I have several GWT modules and web apps running in Jetty. They each want to use my LoginService RPC interface, so I put this interface and its servlet implementation in a common module. I serve the servlet (LoginServiceImpl) from my root web context, and web.xml exposes it at the url "/loginService". In a another GWT module, to use this service, I had to set the entry point, like this...
LoginServiceAsync loginService = GWT.create(LoginService.class);
ServiceDefTarget t = (ServiceDefTarget)loginService;
t.setServiceEntryPoint("/loginService");
Now, the module trying to use the loginService is called discussions, and I get this error on the server.
ERROR: The serialization policy file
'/discussions/discussions/7B344C69AD493C1EC707EC98FE148AA0.gwt.rpc' was not found;
did you forget to include it in this deployment?
So the servlet is reporting an error that mentions the client (the discussions module). I'm guessing that the RPC plumbing passed the name of this .rpc file through from the client, and the servlet is now looking for it. (?) As an experiment, I copied, the *.gwt.rpc files from the discussions module into the root web context, so the servlet could find them. This did stop the error. But I still get another error:
com.google.gwt.user.client.rpc.SerializationException: Type
'mystuff.web.shared.User' was not assignable to
'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field
serializer. For security purposes, this type will not be serialized.: ...
This class is serializable; it worked before in other modules, so now I'm lost.
What is the right way to use the LoginService from multiple clients modules?
Update:
This error was showing up in hosted devmode, and it went away after a full compile. Maybe this is related to gwt serialization policy hosted mode out of sync . I will update again if I can better reproduce the problem.
See my answer here. The short answer is: you'll need to make mystuff.web.shared.Users source available at compile-time to your discussions module.

GWT Clientsided logging without RPC

I just read the Developer's Guide - Logging and it says that the client-sided logging implement throw RPC calls (see Remote Logging ).
My application doesn't use RPC and it is supposed to be hosted on a webserver which doesn't have Java support (so now RPC usable). Is there still a possibility to use the GWT logger on the client?
Just a quick example of gwt-log below..
Add this line in *.gwt.xml file. Its in parent package of your client side source. The top most package..
<inherits name="com.google.gwt.logging.Logging"/>
Add this in .java file, lets say in the onModuleLoad() method
public void onModuleLoad() {
Logger logger = Logger.getLogger("NameOfYourLogger");
logger.log(Level.SEVERE, "this message should get logged");
You can try another logger....see here: http://code.google.com/p/gwt-log/

Play framework weblogic 10.3.3.0 deployment

I built a Play app and tried to deploy on weblogic using the following commands:
play war -o myApp myApp
Later I just deployed the exploded war directory to weblogic, everything worked fine but everytime I try to access a route. I get the following error:
Not found
GET /myApp/params
This is a rest service not an application with UI's. I tried to deploy on tomcat and everything worked fine but I had to make the application context root to be /. I tried the same thing with weblogic but it did not work.
Here is my route file:
GET / Application.index
GET /sectorinformer/{telephone} Application.show
GET /sectorinformer/public/ staticDir:public
* /{controller}/{action} {controller}.{action}
And here is my controller code:
package controllers;
import models.InstalAddress;
import models.SectorInfo;
import play.Logger;
import play.mvc.Controller;
public class Application extends Controller {
public static void index() {
render();
}
public static void show(String telephone) {
Logger.debug("Starting request");
Logger.debug("domain: '%s'", request.domain);
String instalAddressId = InstalAddress.getInstalAddressId(telephone);
SectorInfo si = new SectorInfo();
si.initializeSectorInfo(instalAddressId);
renderXml(si.generateXmlResponse());
}
}
Thanks in advance for any help.
Weblogic 10 is a fully compliant J2EE 5 application server, as a consequence it is bundled with JPA 1.0.
There are two little issues to get Play running on weblogic.
Applying an Oracle patch to have weblogic support JPA 2.0
Adding a deployment descriptor property to prioritize class resolution from web-inf
Both are trivial and the Play documentation should probably mark weblogic 10 as a working deployment target.
To fix #1, open to following oracle link.
For the lazy readers, add this declaration at the top of wlserver/common/bin/commEnv.sh
export PRE_CLASSPATH=$MW_HOME/modules/javax.persistence_1.0.0.0_2-0-0.jar:$MW_HOME/modules/com.oracle.jpa2support_1.0.0.0_2-0.jar
for windows, the file is wlserver/common/bin/commEnv.bat
set PRE_CLASSPATH=%MW_HOME%/modules/javax.persistence_1.0.0.0_2-0-0.jar;%MW_HOME%/modules/com.oracle.jpa2support_1.0.0.0_2-0.jar
To fix #2, create the file weblogic.xml at the following location myplayapp/war/WEB-INF/weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
The war folder is automatically picked up by play war when the web archive is built.
That's it!
I personally believe Play should create weblogic.xml itself, but that's not how it works as of 1.2.1
Unfortunately I don't have either weblogic know nor time to investigate in you interesting problem. I can only can give you some hints what I would do:
Try to connect the app with a debugger or if this doesn't work checkout the Code and build your own version, with a lot of log-statements.
As far as I know every request will handled by ActionInvoker. invoke. Look how the argument comes in. The other point is the Router, which has still a lot of trace-logs. So perhaps you start first and let the whole stuff run on trace-level. Perhaps that give you some hint's where to look in more detail.
To do this start with a clean app and make no configuration tricks, specially don't run it in ROOT-Context. Just create play war myapp -o myapp.war --zip and deploy it (Don't forget --zip). Then analyze the log.
Good look.
Niels
I deployed my Play app (play 1.1.1) to Websphere 6.1 and I encountered some issues. Not sure you have the same issues but here there are (hope it can help you):
1- JDK version: My "play war xxxx --zip" use a JDK 1.6, and Websphere 6.1 uses a JDK 1.5. When I tried to launch my webapp an UnsupportedClassVersionException was thrown. I regenerated my war file using the correct JDK et voilĂ  !
2- When you deploy a war aplication to Websphere, you can specify the context's name. I don't know how to do it with Weblogic, but did you set the correct value ?
As Niels said, analyze logs files: you should find what happens !
Unfortunately, Play! doesn't support Weblogic.
See: http://www.playframework.org/documentation/1.2/deployment