How can i set an order for .jar files in WEB-INF/lib

108 views
Skip to first unread message

Manuel Werder

unread,
Jan 21, 2016, 5:18:38 AM1/21/16
to Google App Engine

Hey guys

I'm working on a project with Google App Engine. To get Data from my devices we're using MQTT. The org.eclipse.paho.client.mqttv3.* library starts a Thread with "client.connect()". After some researches i found that you cant just simply create Threads when working with GAE. Following error is shown:

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")

I continued searching and someone told to use following code instead of a "normal" Thread:

Thread monitoringThread = ThreadManager.createThreadForCurrentRequest( new Runnable() {..}


So i decompiled the paho library, looked up where the Thread is created and changed it. I created a new class exported it as mymqttclient.jar In eclipse i changed the order of my build at Properties -> Java Build Path -> Order and Export so mymqttclient.jar is loaded before the mqtt-client-0.4.0.jar So that it will use my created function with the monitoringThread.

But how can i change the order of the .jar's in the web-inf/lib ?

Thank you very much for your answers, i couldnt find something useful until now.

Nick (Cloud Platform Support)

unread,
Jan 21, 2016, 5:45:08 PM1/21/16
to Google App Engine
Is mymqttclient.jar not a patched version of mqtt-client-0.4.0.jar which simply modifies any lines dealing with Threads? Why include the original jar? It seems inevitable that conflicts will arise when you include two jars defining the same classes in the same packages.

Nick (Cloud Platform Support)

unread,
Jan 21, 2016, 5:45:47 PM1/21/16
to Google App Engine
... to clarify, I guess in addition to answering my above post, I'm looking for a clarification on what you mean by ordering the .jars at all.


On Thursday, January 21, 2016 at 5:18:38 AM UTC-5, Manuel Werder wrote:

Manuel Werder

unread,
Jan 22, 2016, 1:38:55 AM1/22/16
to Google App Engine
Hey Nick
In mymqttclient.jar is just a class with the specific function i wanted to Change. In eclipse  i can set the order in which the Project will load my .jar's for Java Projects. That means first it will load my .jar with the edited function and therefore will ignore the original jar's function. I hope you understand what i mean. But when i want to do it with a web application i dont know how to do this.
But nevermind i think what you said is the cleaner way how to do it. So I tried it and it seems to work. But now it says:
"The Socket API will be enabled for this application once billing has been
enabled in the admin console."
so I added the project to my billing account, but it still says I have to enable billing...

Nick (Cloud Platform Support)

unread,
Jan 22, 2016, 4:39:53 PM1/22/16
to Google App Engine
Hey Manuel,

Is that an error output from your application, in the logs? Or a pop-up in-browser? If the former, could you try to post any logs or stack traces relevant?

Manuel Werder

unread,
Jan 28, 2016, 3:36:54 AM1/28/16
to Google App Engine
yeah it was: 
com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: The Socket API will be enabled for this application once billing has been enabled in the admin console.

but as i said it was already enabled. so i deployed it to another project where billing already is enabled also. 
And it works there. Seems to be a bug with my project or something?
Thanks for your help though,
Manuel

Ludovic Champenois

unread,
Jan 28, 2016, 4:30:08 PM1/28/16
to google-a...@googlegroups.com
On 1/28/16 12:36 AM, Manuel Werder wrote:
yeah it was: 
com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: The Socket API will be enabled for this application once billing has been enabled in the admin console.
but as i said it was already enabled. so i deployed it to another project where billing already is enabled also. 
And it works there. Seems to be a bug with my project or something?
Thanks for your help though,

Manuel
Am Freitag, 22. Januar 2016 22:39:53 UTC+1 schrieb Nick (Cloud Platform Support):
Hey Manuel,

Is that an error output from your application, in the logs? Or a pop-up in-browser? If the former, could you try to post any logs or stack traces relevant?

On Friday, January 22, 2016 at 1:38:55 AM UTC-5, Manuel Werder wrote:
Hey Nick
In mymqttclient.jar is just a class with the specific function i wanted to Change. In eclipse  i can set the order in which the Project will load my .jar's for Java Projects. That means first it will load my .jar with the edited function and therefore will ignore the original jar's function. I hope you understand what i mean. But when i want to do it with a web application i dont know how to do this.
But nevermind i think what you said is the cleaner way how to do it. So I tried it and it seems to work. But now it says:
"The Socket API will be enabled for this application once billing has been
enabled in the admin console."
so I added the project to my billing account, but it still says I have to enable billing...


Am Donnerstag, 21. Januar 2016 23:45:47 UTC+1 schrieb Nick (Cloud Platform Support):
... to clarify, I guess in addition to answering my above post, I'm looking for a clarification on what you mean by ordering the .jars at all.
--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/b067416b-aa14-4010-9b6d-48e151a96fa3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manuel Werder

unread,
Feb 1, 2016, 4:43:27 AM2/1/16
to Google App Engine
That's exactly what i was looking for Ludovic, thanks!
Reply all
Reply to author
Forward
0 new messages