Skip to content

Instantly share code, notes, and snippets.

View sebastienblanc's full-sized avatar

Sebastien Blanc sebastienblanc

View GitHub Profile
given: "Application My App is about to be registered......"
def json = new JsonBuilder()
def request = testSpec.getRequestSpecification()
.contentType("application/json")
.header("Accept", "application/json")
.body(json {
name "MyApp"
description "awesome app"
}
)

Push Demo

Introduction

Prodoctor is a company in the health care industry, selling a revolutionary tensiometer. Their clients are doctors. Prodoctor has several sales agents all over the United States. At the headquarters, they have their "first line" sales departement, doing cold calls all along the day. As soon they have a concrete lead, they use their Prodoctor Admin app to filter out available sales Agents available in the lead area. They can then send them a push notification.

The sales agent receives the notification on their mobile device that a new lead is available. The agent will handle the lead by "accepting" the notifcation, informing the other agents that the lead has been processed.

The client app

15:36:16,269 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."prodoctor.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."prodoctor.war".INSTALL: Failed to process phase INSTALL of deployment "prodoctor.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
Caused by: org.jboss.msc.servic
18:15:02,006 ERROR [org.jboss.ejb3.invocation] (EJB default - 3) JBAS014134: EJB Invocation failed on component SenderServiceImpl for method public abstract void org.aerogear.connectivity.service.SenderService.sendToAliases(org.aerogear.connectivity.model.PushApplication,org.aerogear.connectivity.rest.sender.messages.SelectiveSendMessage): javax.ejb.EJBException: java.lang.IllegalArgumentException: registrationIds cannot be empty
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.jav
[{"id":"ff705f12-7958-455c-894a-6ed448dc0e5f","name":"MyApp","description":"awesome app","pushApplicationID":null,"androidApps":[],"simplePushApps":[],"iosapps":[]},{"id":"dfcc2607-8a59-4582-b759-308af400fd61","name":"yopla","description":"awesome app","pushApplicationID":null,"androidApps":[],"simplePushApps":[],"iosapps":[]},{"id":"f45c834d-14d8-49b1-8c3a-5b540ff3c5d6","name":"MyApp2","description":"awesome app","pushApplicationID":null,"androidApps":[],"simplePushApps":[],"iosapps":[]},{"id":"0d204744-26b0-45bb-9541-4eaf20784324","name":"supercoolawesome","description":"awesome app","pushApplicationID":null,"androidApps":[],"simplePushApps":[],"iosapps":[]},{"id":"7db088f1-d609-4ac4-ab83-7a862fdcb294","name":null,"description":null,"pushApplicationID":null,"androidApps":[],"simplePushApps":[],"iosapps":[]},{"id":"d8d9f6f8-8f67-4ac5-a200-86a234449312","name":null,"description":null,"pushApplicationID":null,"androidApps":[],"simplePushApps":[],"iosapps":[]},{"id":"27f723da-8469-4198-b427-4446fe71b80f","name"
{"id":"402881933f6692f0013f66b2feed0006","name":"prodoctorLight2","description":"prodoctorLight","pushApplicationID":"317cce6d-efaf-4ff8-94e3-a45c0a3a688c","androidApps":[],"simplePushApps":[{"id":"402881933f6692f0013f66b4bc630007","name":null,"description":null,"variantID":"eaf3eaf3-1a13-43f2-8934-3e53e035fecd","instances":[{"id":"402881933f6692f0013f66b66d9e0008","deviceToken":"c102c3c6-766c-469c-8562-191be73224c3","deviceType":null,"mobileOperatingSystem":null,"osVersion":null,"alias":"maria","category":"broadcast"}],"pushNetworkURL":"http://localhost:7777/endpoint/"}],"iosapps":[]}
Map categories = new HashMap();
categories.put("lead", "version="+leadVersion++); 
Map json = new HashMap();
json.put("id", lead.getId());
json.put("messageType", "pushed_lead");
json.put("name", lead.getName());
json.put("location", lead.getLocation());
json.put("phone", lead.getPhoneNumber());
json.put("simple-push", categories);
11:09:32,324 ERROR [org.jboss.aerogear.controller.log] (http--0.0.0.0-8080-1) AG_CONTROLLER000005: Exception Message: 'loader constraint violation: when resolving method "org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.<init>(Lorg/apache/http/client/HttpClient;Lorg/apache/http/protocol/HttpContext;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/jboss/aerogear/unifiedpush/resteasy/RestEasyClient, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, org/jboss/resteasy/client/core/executors/ApacheHttpClient4Executor, have different Class objects for the type xecutors.ApacheHttpClient4Executor.<init>(Lorg/apache/http/client/HttpClient;Lorg/apache/http/protocol/HttpContext;)V used in the signature': java.lang.LinkageError: loader constraint violation: when resolving method "org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.<init>(Lorg/apache/http/client/HttpClient;Lorg/apache/http/protocol/Htt
Hi All,
I've got an application https://github.com/aerogear/aerogear-push-quickstart-backend/tree/AGPUSH-154 that is using a dependency that can find here https://github.com/aerogear/aerogear-unified-push-java-client . The latest relies on Resteasy Client bits.
It has been working well, as long I did not use the httpClient bits. But we are adding some basic security stuff and we are using the ApacheHttpClient4Executor , see https://github.com/aerogear/aerogear-unified-push-java-client/blob/master/src/main/java/org/jboss/aerogear/unifiedpush/resteasy/RestEasyClient.java#L83
But now I'm getting a linkage error exception, see stacktrace here :
https://gist.github.com/sebastienblanc/5973915
Putting the scope to provided does not help as I ended with class not found exception on httpclient bits (The Credentail class)
08:32:46,298 WARN [org.jboss.modules] (http--0.0.0.0-8080-3) Failed to define class com.ning.http.client.providers.netty.NettyAsyncHttpProvider in Module "deployment.prodoctor.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/ning/http/client/providers/netty/NettyAsyncHttpProvider (Module "deployment.prodoctor.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:517)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLo