hive permission denied for user anonymous using beeline shell

I have created the 3 node hadoop cluster with 1 namenode and 2 datanode.

I can perform read write query from hive shell but not beeline

Many suggestion and answer i found related to this issue . In every suggestion it was mentioned to give the permission for the userX for each individual table. But i dont know how to set permission for anonymous user once for all .

Why i am getting the user anonymous while accessing the data from beeline or from java program.

I Am able to read the data from the both beeline shell and using java jdbc connection. But cant insert the data in the table .

Mime4j Casting Exception

I’m using mime4j for parsing mails. I have following methods:

    private void parseBodyParts(Multipart multipart) throws IOException {
        for (BodyPart part : multipart.getBodyParts()) {
            if (part.isMimeType("text/plain")) {
                String txt = getTxtPart(part);
                txtBody.append(txt);
            } else if (part.isMimeType("text/html")) {
                String html = getTxtPart(part);
                htmlBody.append(html);
            } else if (part.getDispositionType() != null && !part.getDispositionType().equals("")) {
                //If DispositionType is null or empty, it means that it's multipart, not attached file
                attachments.add(part);
            }

            //If current part contains other, parse it again by recursion
            if (part.isMultipart()) {
                parseBodyParts((Multipart) part.getBody());
            }
        }
    }

This is for parsing body parts, and following is getting text part:

    private String getTxtPart(Entity part) throws IOException {
        //Get content from body
        TextBody tb = (TextBody) part.getBody();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        tb.writeTo(baos);
        return new String(baos.toByteArray());
    } 

At some e-mails, this code throws an exception which called:

java.lang.ClassCastException: org.apache.james.mime4j.message.StorageBinaryBody cannot be cast to org.apache.james.mime4j.message.TextBody

at TextBody tb = (TextBody) part.getBody(); line.

Where I’m wrong?

Creating a notification inside DialogFragment class doesn’t work! (Android)

I’ve been searching around and tried different solutions but I can’t seem to get this to work.

I have a MainActivity with a list and an “Add” button. When i click the addbutton i open a DialogFragment. In the dialog user inputs data and press “add” and i want a notification that says “xxxx has been added to list” but it never shows.

I have a seperate class for AddDialog which looks like this:

public class AddDialogFragment extends DialogFragment {
Button btnAdd;
Button btnCancel;
TextView etNewSerial, etNewBrand, etNewModel;
String newSerial, newBrand, newModel;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.dialog_add, container, false);
    getDialog().setTitle("Add new serial!");
    btnAdd = (Button) rootView.findViewById(R.id.btnAddNew);
    etNewSerial = (TextView) rootView.findViewById(R.id.etNewSerial);
    etNewBrand = (TextView) rootView.findViewById(R.id.etNewBrand);
    etNewModel = (TextView) rootView.findViewById(R.id.etNewModel);

    btnAdd.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
             newSerial = etNewSerial.getText().toString();
             newBrand = etNewBrand.getText().toString();
             newModel = etNewModel.getText().toString();

            String url = "MY_VOLLEY_URL"
            StringRequest request = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    int icon = 0;
                    CharSequence notiText = "Item Added!";
                    long notiTime = System.currentTimeMillis();
                    CharSequence notiTitle = "Item Added!";//Titel
                    CharSequence notiContent = newSerial + " added!";
                    PendingIntent pendingIntent = PendingIntent.getActivity(getActivity(), 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);
                    NotificationCompat.Builder notBuilder = new NotificationCompat.Builder(getActivity());
                    notBuilder.setSmallIcon(icon)
                            .setTicker(notiText)
                            .setWhen(notiTime)
                            .setAutoCancel(true)
                            .setContentText(notiContent)
                            .setContentTitle(notiTitle)
                            .setContentIntent(pendingIntent);
                    Notification notification = notBuilder.build();
                    NotificationManager myNotificationManager = (NotificationManager)getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
                    myNotificationManager.notify(1, notification);
                    getDialog().dismiss();
                }
            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                }
            });
            Volley.newRequestQueue(getActivity()).add(request);
        }
    });
    return rootView;
}
}

But the notification never shows. I’ve been trying to replace the “getActivity()” with different methods for context but it doesn’t seem to matter. Does anyone has some tips to make this possible?

how can i access the data that that classified or clustered with weka classes in java?

import javax.print.attribute.DateTimeSyntax;
import weka.core.Instances;
import weka.core.converters.ConverterUtils.DataSource;
import weka.classifiers.bayes.NaiveBayes;
import weka.classifiers.trees.J48;
import weka.classifiers.functions.SMO;
public class Classification {
    public static void main(String[] args) throws Exception{
        //load dataset
        DataSource source = new DataSource("j:/weka/wekadataset/iris.arff");
        Instances dataset = source.getDataSet();
        // set the class to the last class attribute
        dataset.setClassIndex(dataset.numAttributes()-1);
        //create and build classifier
        NaiveBayes nb = new NaiveBayes();
        nb.buildClassifier(dataset);
    }
}

// Here i want get the data for each class and write them in seperated file.

Error during Building an APK file in Android Studio

I was trying to build an apk for my project but i am facing this error and

Error:Execution failed for task
‘:app:transformClassesWithDexForDebug’.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException:
Multiple dex files define Lcom/google/android/gms/internal/zzajl;

i also added multiDexEnabled true but still getting error

Error:Execution failed for task
‘:app:transformClassesWithJarMergingForDebug’.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzaix.class

Below is my Build.gradle file

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "in.package.name"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true


    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {
        release {
            minifyEnabled true
            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'
    compile 'com.google.android.gms:play-services-ads:11.0.1'
    testCompile 'junit:junit:4.12'
    // Adding support library for this demo app
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.firebase:firebase-database:9.6.1'


}
apply plugin: 'com.google.gms.google-services'

Please suggest me some solution
Thanks

Consuming Dynamics GP native web service from Java using Apache CXF framework

I have a requirement to consume Dynamics GP native web service from Java and i am using Apache CXF to create the soap client. We are using kerbaros authentication as part of CXF (spnego).

We are able to call the web service from a .net based soap client from the same computer by passing the username, password and domain name as input for authentication.

But with java.. we are getting SocketTimeoutException as below.

[Krb5LoginModule] authentication failed
org.apache.cxf.interceptor.Fault: General security error (An error occurred
in trying to obtain a TGT: Receive timed out)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.DualStackPlainDatagramSocketImpl.socketReceiveOrPeekData(Native Method)
at 
java.net.DualStackPlainDatagramSocketImpl.receive0(DualStackPlainDatagramSocketImpl.java:124)
at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:143)
at java.net.DatagramSocket.receive(DatagramSocket.java:812)
at sun.security.krb5.internal.UDPClient.receive(NetClient.java:206)
at sun.security.krb5.KdcComm$KdcCommunication.run(KdcComm.java:411)
at sun.security.krb5.KdcComm$KdcCommunication.run(KdcComm.java:364)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.krb5.KdcComm.send(KdcComm.java:348)
at sun.security.krb5.KdcComm.sendIfPossible(KdcComm.java:253)
at sun.security.krb5.KdcComm.send(KdcComm.java:229)
at sun.security.krb5.KdcComm.send(KdcComm.java:200)
at sun.security.krb5.KrbAsReqBuilder.send(KrbAsReqBuilder.java:316)
at sun.security.krb5.KrbAsReqBuilder.action(KrbAsReqBuilder.java:361)
at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:766)
... 40 more

We have login.config and krb5.conf files as below.

login.config ==============

spnego-client {
com.sun.security.auth.module.Krb5LoginModule required
debug=true
refreshKrb5Config=true;
};

======================

krb5.conf================

[libdefaults]
default_realm=DOMAIN1.MYCOMPANY.LOCAL
[realms]
DOMAIN1.MYCOMPANY.LOCAL = {
kdc=MACHINE01.domain1.mycompany.local
default_domain=DOMAIN1.MYCOMPANY.LOCAL
}
[domain_realm]
.domain1.mycompany.local=DOMAIN1.MYCOMPANY.LOCAL
domain1.mycompany.local=DOMAIN1.MYCOMPANY.LOCAL

=======================

Endpoint : http://MACHINE01:112233/Dynamics/GPService/GPService

client.getRequestContext().put(“ws-security.callback-handler”, new NamePasswordCallbackHandler(“UERNAME”,”PASSWORD”));

Android Studio skips try bracket?

So I have this little App that should only show a JSON-Object(not even parse it) in the Textview “tvJsonItem” after you push the button “btnHit”. I have built in multiple Toasts to follow its procedure, but if i push the button, i only get the Toast Test1 from the onPostExecute. It seems like the Programme skips the whole try bracket.

    public class MainActivity extends AppCompatActivity {

private TextView tvData;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Button btnHit = (Button) findViewById(R.id.btnHit);
    tvData = (TextView) findViewById(R.id.tvJsonItem);
}

public void onClick(View view) {
    new JSONTask().execute();
    Toast.makeText(getApplicationContext(), "onClick", Toast.LENGTH_LONG);
}


public class JSONTask extends AsyncTask<String, String, String> {

    @Override
    protected String doInBackground(String...params) {

        HttpURLConnection connection = null;
        BufferedReader reader = null;
        URL url = null;
        try {
            url = new URL("https://jsonparsingdemo-cec5b.firebaseapp.com/jsonData/moviesDemoItem.txt");
            connection = (HttpURLConnection) url.openConnection();
            connection.connect();
            InputStream stream = connection.getInputStream();
            reader = new BufferedReader(new InputStreamReader(stream));
            Toast.makeText(MainActivity.this, "test2", Toast.LENGTH_LONG).show();
            StringBuffer buffer = new StringBuffer();

            String line = "";
            while ((line = reader.readLine()) != null) {
                buffer.append(line);
            }
            String result = buffer.toString();
            return result;
        } catch (MalformedURLException e) {
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), "Malformed", Toast.LENGTH_LONG);
        } catch (IOException e) {
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), "IOException", Toast.LENGTH_LONG);
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return null;
        }
    }


    protected void onPostExecute(String result){
    super.onPostExecute(result);
        tvData.setText(result);
        Toast.makeText(getApplicationContext(), "test1", Toast.LENGTH_LONG).show();
    }
}

}

Two Maven archetypes into one

I would’ve like to create spring project with structure like this:

|-- pom.xml
`-- src
    `-- main
    |   `-- java
    |       `-- App.java
        `-- webapp
            |-- WEB-INF
            |   `-- web.xml
            `-- index.jsp           
    `-- test
        `-- java
            `-- AppTest.java

Right now I’m using one of those (and copy elements from another one).

  • Maven Webapp Archetype

|-- pom.xml
'-- src
'-- main
'-- webapp
|-- WEB-INF
| '-- web.xml
'-- index.jsp

or

  • maven-archetype-quickstart

    |-- pom.xml
    '-- src
    |-- main
    | '-- java
    | '-- App.java
    '-- test
    '-- java
    '-- AppTest.java

Is there a way to do it easier? I was thinking about creating my own archetype but maybe there is way to open them both at once. I was searching for similar question, but couldnt find it (Sorry for my bad english).