#StackBounty: #java #intellij-idea #playframework-2.0 #sbt #playframework-2.1 How do I run a Play Framework 2.1 project in IntelliJ?

Bounty: 100

I have an existing Play 2.1 project. I’ve been running it with the console and it works fine. However, when I try to run it with IntelliJ using these instructions it doesn’t work:


First I tried just running it by right clicking on the app and selecting “run play 2 app”. It would not run and it gave me this error:

sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.

After some research into the issue I added -Djline.terminal= to my JVM options and tried again. This time it ran, but gave this error when I tried to open a page in the browser:

Global : Unsupported major.minor version 52.0

Finally, I tried reimporting my project into intellij. Before it would import, it forced me to update my SBT version in build.properties from 0.12.2 to 0.12.4. I did this, but still getting the same errors listed above.

NOTE: I have Java 7 set as my JDK.

Here is the full stack trace:

play.api.PlayException: Cannot init the Global object[Global : Unsupported major.minor version 52.0]
    at play.api.WithDefaultGlobal$$anonfun$play$api$WithDefaultGlobal$$globalInstance$1.apply(Application.scala:57) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.api.WithDefaultGlobal$$anonfun$play$api$WithDefaultGlobal$$globalInstance$1.apply(Application.scala:51) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.utils.Threads$.withContextClassLoader(Threads.scala:18) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.api.WithDefaultGlobal$class.play$api$WithDefaultGlobal$$globalInstance(Application.scala:50) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.api.DefaultApplication.play$api$WithDefaultGlobal$$globalInstance$lzycompute(Application.scala:383) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.api.DefaultApplication.play$api$WithDefaultGlobal$$globalInstance(Application.scala:383) ~[play_2.10-2.1.1.jar:2.1.1]
Caused by: java.lang.UnsupportedClassVersionError: Global : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_80]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[na:1.7.0_80]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_80]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7.0_80]
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0_80]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.7.0_80]

Get this bounty!!!

#StackBounty: #java #maven #deployment #transactions Combining multiple Maven goals into one transaction (e.g. deploy and site-deploy, …

Bounty: 50

I configured the build server to do

clean javadoc:jar deploy site-deploy

Now if site-deploy fails (because the site did not build, or somebody used the wrong parent pom), the build server shows a failed build, but the deploy was already applied.

Is there a way to “combine” deploy and site-deploy in a transactional way?

Or should I use a different chain of goals/phases (e.g. install before site-deploy)?

Get this bounty!!!

#StackBounty: #java #multithreading #locking #hazelcast #hazelcast-imap Correct use of Hazelcast EntryProcessor

Bounty: 50

We’re trying to work out the best way to use Hazelcast’s IMap without using pessimistic locking.

EntryProcessor seems like the correct choice, however we need to apply two different types of operations: ‘create’ when containsKey is false, and ‘update’ when containsKey is true.

How can I utilise EntryProcessor to support these logic checks?

If two threads hit the containsKey() at the same time and it returns false to both of them, I don’t want both of them to create the key. I’d want the second thread to apply an update instead.

This is what we have so far:

public void put(String key, Object value) {

    IMap<String, Object> map = getMap();

    if (!map.containsKey(key)) {
           // create key here
    } else {
        // update existing value here
        // ...
        map.executeOnKey(key, new TransactionEntryProcessor({my_new_value}));

private static class MyEntryProcessor implements
        EntryProcessor<String, Object>, EntryBackupProcessor<String, Object>, Serializable {

    private static final long serialVersionUID = // blah blah

    private static final ThreadLocal<Object> entryToSet = new ThreadLocal<>();

    MyEntryProcessor(Object entryToSet) {

    public Object process(Map.Entry<String, Object> entry) {
        return entry.getValue();

    public EntryBackupProcessor<String, Object> getBackupProcessor() {
        return MyEntryProcessor.this;

    public void processBackup(Map.Entry<String, Object> entry) {

You can see that two threads can enter the put method and call containsKey at the same time. The second will overwrite the outcome of the first.

Get this bounty!!!

#StackBounty: #java #algorithm #apache-spark #spark-streaming Build path for different events and assign globalID

Bounty: 50

We are working with spark 1.6 and we are trying to keep global identity for similar events. There can be few “groups”of events with identical ID (in the example as number. letters are added just for uniqueness). And we know that some of these events are similar so we are able to connect them. We want to keep something like:

Z -> 1, 2, 3
X -> 4

so in a future if some events with id 4 will come we can assign X as a global identity.

Please check example for better illustration:

Let’s say we have some streaming data coming into spark job.


Since event 1 is our first appearance we want to assign 1 to Z.
Next what we know is that 1b and 2c are similar. so we want to keep somewhere 2->1 mapping. Same thing is for 2e and 3f so we need mapping 3-2. So for now we have 3 pairs 1->Z, 2->1, 3->2.

And we want to create “historical” path: Z <- 1 <- 2 <- 3
At the end we will have all events with ID = Z.

1a -> Z
1b -> Z
2c -> Z
2d -> Z
2e -> Z
3f -> Z
3g -> Z
3h -> Z
4i -> X

We tried to use mapwithstate but only thing we were able to do was that 2->1 and 3->2. With mapwithstate we were not able to get state for “parent” in state for current event – eg. current event 3 with parent 2 and not able to get 2 -> 1 and neither 1 -> Z.

Is it possible to have some global mapping for this? We already tried accumulators and broadcast but looks like not very suitable. And we were not able to replace events 1 for first mapping and events 2 for second mapping with Z.

If new event 5 will come and it is similar with 3h for example we need to assign mapping 5->Z again.

Get this bounty!!!

#StackBounty: #java #spring #rest #apache-camel #resttemplate REST service call with Camel which requires authentication api called first

Bounty: 50

Camel has to call REST service for some integration, However, the REST service has one authentication api (POST api) which needs to be called first to get a token and then other subsequent api calls has to be invoked with the token embedded in header of HTTP requests.

Does Spring Restemplate or apache camel has some api to support the same?

Get this bounty!!!

#StackBounty: #java #jar Same code behaving differently on two different packaging

Bounty: 100

I have a set of codes which are common for two different products, but a part of the code is behaving differently for each product

URL wsdlURL = IntegrationLandscapeServiceWS.class.getClassLoader().getResource("IntegrationLandscapeService.wsdl");

For One set up it is giving absolute path and for the other its giving relative path and this is leading to problems, my requirement is to get absolute path for the issue.

enter image description here

Code flow:

The call is made from the Main Class File and from there CommonCode in common code it is looking for the WSDL located in LandScapeService.jar

Get this bounty!!!

#StackBounty: #java #android #bluetooth Bluetooth app not working on Lollipop

Bounty: 50

I made a Bluetooth app. It works fine in Nougat, Marshmallow, Jelly Bean, KitKat but for reason, it crashes in Android Lollipop when Discover button (which discovers all the discoverable devices) is clicked.

Here is the method which gets triggered on clicking Discover button –

private void discoverDevices() {
        Log.d(TAG, "btnDiscover: Looking for unpaired devices.");

            Log.d(TAG, "btnDiscover: Canceling discovery.");

            //check BT permissions in manifest

            IntentFilter discoverDevicesIntent = new IntentFilter(BluetoothDevice.ACTION_FOUND);
            registerReceiver(mBroadcastReceiver3, discoverDevicesIntent);

            //check BT permissions in manifest

            IntentFilter discoverDevicesIntent = new IntentFilter(BluetoothDevice.ACTION_FOUND);
            registerReceiver(mBroadcastReceiver3, discoverDevicesIntent);



private void checkBTPermissions() {

            int permissionCheck = this.checkSelfPermission("Manifest.permission.ACCESS_FINE_LOCATION");
            permissionCheck += this.checkSelfPermission("Manifest.permission.ACCESS_COARSE_LOCATION");
            if (permissionCheck != 0) {

                this.requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, 1001); //Any number
            Log.d(TAG, "checkBTPermissions: No need to check permissions. SDK version < LOLLIPOP.");

Permissions in Manifest file-

<uses-feature android:name="android.hardware.bluetooth" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />


apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.example.hpi5.bluetooth"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

I have not tested this app on Lollipop myself as I don’t have any device running on Android L. I got to know about the crash from a friend of mine.

Apk file

Get this bounty!!!

#StackBounty: #java Problem with Java while trying to upgrade packages

Bounty: 200

I’m getting this erros when trying to upgrade packages:

sudo apt upgrade awesome
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... awesome is already the newest version.
The following packages were automatically installed and are no longer required:
  ant ant-optional antlr3 aspectj default-jdk-doc javahelp2 junit junit-doc junit4 junit4-doc libantlr-java
  libantlr3-runtime-java libasm3-java libaspectj-java libatinject-jsr330-api-java libbeansbinding-java libbindex-java
  libbsh-java libbytelist-java libcdi-api-java libcglib-java libcommons-beanutils-java libcommons-codec-java
  libcommons-collections3-java libcommons-compress-java libcommons-digester-java libcommons-httpclient-java
  libcommons-io-java libcommons-lang-java libcommons-net-java libcommons-net1-java libeclipselink-java
  libequinox-osgi-java libfelix-framework-java libfelix-main-java libfreemarker-java
  libgeronimo-interceptor-3.0-spec-java libgeronimo-j2ee-connector-1.5-spec-java libgeronimo-jms-1.1-spec-java
  libgeronimo-jpa-2.0-spec-java libgeronimo-jta-1.1-spec-java libgeronimo-osgi-support-java
  libgeronimo-validation-1.0-spec-java libhamcrest-java libhamcrest-java-doc libicu4j-4.4-java libini4j-java
  libjavaewah-java libjcodings-java libjcommander-java libjemmy2-java libjgit-java libjna-java libjna-jni
  libjna-platform-java libjnlp-servlet-java libjoda-convert-java libjoda-time-java libjpa-2.1-spec-java
  libjsch-agent-proxy-java libjsch-java libjson-simple-java libjsr311-api-java libjvyamlb-java libjzlib-java
  liblucene3-contrib-java liblucene3-java libmail-java libnb-absolutelayout-java libnb-apisupport3-java libnb-ide14-java
  libnb-java5-java libnb-javaparser-java libnb-org-openide-modules-java libnb-org-openide-util-java
  libnb-org-openide-util-lookup-java libnb-platform-devel-java libnb-platform18-java libntdb1 liboro-java
  libosgi-annotation-java libosgi-compendium-java libosgi-core-java libosgi-foundation-ee-java libregexp-java
  libsdo-api-java libsequence-library-java libserf-1-1 libservlet2.5-java libservlet3.1-java libsimple-validation-java
  libsqljet-java libstringtemplate-java libstringtemplate4-java libsvn-java libsvn1 libsvnclientadapter-java
  libsvnkit-java libswing-layout-java libswingx-java libtrilead-ssh2-java libws-commons-util-java libxerces2-java
  libxml-commons-external-java libxml-commons-resolver1.1-java libyaml-snake-java linux-headers-4.2.0-16
  linux-headers-4.2.0-16-generic linux-image-4.2.0-16-generic linux-image-extra-4.2.0-16-generic openjdk-7-doc
  python-ntdb testng
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up oracle-java8-installer (8u111+8u111arm-1~webupd8~0) ...
No /var/cache/oracle-jdk8-installer/wgetrc file found.
Creating /var/cache/oracle-jdk8-installer/wgetrc and
using default oracle-java8-installer wgetrc settings for it.
Downloading Oracle Java 8...
--2017-06-01 18:37:26--  http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)...,
Connecting to download.oracle.com (download.oracle.com)||:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz [following]
--2017-06-01 18:37:26--  https://edelivery.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)..., 2a02:26f0:15:1:8b00::2d3e, 2a02:26f0:15:1:9100::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)||:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz?AuthParam=1496335166_b886052f95ea6f92c97b905b0261ad04 [following]
--2017-06-01 18:37:26--  http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz?AuthParam=1496335166_b886052f95ea6f92c97b905b0261ad04
Connecting to download.oracle.com (download.oracle.com)||:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-06-01 18:37:28 ERROR 404: Not Found.

download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of oracle-java8-set-default:
 oracle-java8-set-default depends on oracle-java8-installer; however:
  Package oracle-java8-installer is not configured yet.

dpkg: error processing package oracle-java8-set-default (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I’m on Ubuntu 15.10.

Get this bounty!!!

#StackBounty: #java #maven #tomcat Apache Tomcat Maven plugin war not found

Bounty: 100

I’m following the documentation here but I end up with a jar that doesn’t find the war to execute. Here’s the error:

java.io.FileNotFoundException: C:UsersortizjDocumentsNetBeansProjectsvalida
tion-managerValidation-Manager-Webtarget.extractwebappsROOT.war (The system
 cannot find the file specified)

For some reason the war file is not added to the jar so it fails when it’s extracting it.

ROOT.war exists and is present in the target folder.

Here’s the relevant POM contents:


Get this bounty!!!

#StackBounty: #java #android #android-activity #screen Process the command without launching MainActivity, in Android

Bounty: 50

I am new to android and stuck at one point with my new screen off test application. I am trying to develop an Android application to turn off or lock the screen directly by clicking the app launcher icon of the application.

I am able to lock the screen with the functionality I want but with one problem. While i click on the screen lock icon in the launcher it takes around a second and then locks the screen (Time is taken by to MainActivity to launch).

I want that time delay to be removed and just wanted to process the command to lock phone when user tap on the app icon in the launcher. But am not able to figure it out.

Here is AndroidManifest.xml


    <activity android:name=".MainActivity"
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />

    <receiver android:name="ScreenOffAdminReceiver"
        <meta-data android:name="android.app.device_admin"
            android:resource="@xml/permissions" />
            <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />



public class MainActivity extends Activity {

    protected void onCreate(Bundle bundle) {
        DevicePolicyManager deviceManger = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
        ComponentName compName = new ComponentName(this, ScreenOffAdminReceiver.class);
        if (deviceManger.isAdminActive(compName)) {
        } else {
            Intent intent = new Intent("android.app.action.ADD_DEVICE_ADMIN");
            intent.putExtra("android.app.extra.DEVICE_ADMIN", compName);
            intent.putExtra("android.app.extra.ADD_EXPLANATION", getString(R.string.devicePolicyManagerMsg));
            startActivityForResult(intent, 0);


public class ScreenOffAdminReceiver extends DeviceAdminReceiver {
    public void onDisabled(Context context, Intent intent) {
        Toast.makeText(context, R.string.deviceAdminDisabled, Toast.LENGTH_SHORT).show();

    public void onEnabled(Context context, Intent intent) {
        Toast.makeText(context, R.string.deviceAdminEnabled, Toast.LENGTH_SHORT).show();

I just want to remove the DELAY while locking the screen. Any help will be highly appreciated. Thanks

Get this bounty!!!