Can't run app via android studio on real android device - android-studio

After adding splash and other screens my app is not launching in the device through the Android Studio, Logcat shows that the package has been successfully installed but it doesn't get launched. Even the dialog box to choose the running device comes up but still no resolution of the problem till now.
When I run it from the device menu, the app runs and any changes made by me is visible but why can't I run directly at the time of installation via android studio.
Here's my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.radio.orion.radio" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="RADIOUZ"
android:theme="#style/AppTheme" >
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/app_id"/>
<activity android:name=".Splash"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"></category>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
</activity>
<activity android:name=".SecondScreen"></activity>
<activity android:name="Sign"></activity>
<activity android:name=".Navdrawer" >
</activity>
<activity android:name=".ArtistSong"></activity>
<activity android:name=".DrawerExtrasNavigation"></activity>
<activity android:name=".DrawerStreamNavigation"></activity>
<activity android:name=".DrawerNavigation"></activity>
<activity android:name=".HomeDrawerNavigation"></activity>
<activity android:name=".Notes"></activity>
<activity android:name=".Wclock"></activity>
<activity android:name=".YourNews"></activity>
<activity android:name=".WishSend"></activity>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="#string/app_name" />
</application>
</manifest>
Here is the run mesages after run:
Installing com.radio.orion.radio
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.radio.orion.radio"
pkg: /data/local/tmp/com.radio.orion.radio
Success
Launching application: com.radio.orion.radio/com.radio.orion.radio.MainActivity.
DEVICE SHELL COMMAND: am start -n "com.radio.orion.radio/com.radio.orion.radio.MainActivity" -a
android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER]
cmp=com.radio.orion.radio/.MainActivity }
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10000000 cmp=com.radio.orion.radio/.MainActivity } from null
(pid=31967, uid=2000) not exported from uid 10400
at android.os.Parcel.readException(Parcel.java:1472)
at android.os.Parcel.readException(Parcel.java:1426)
at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:
2720)
at com.android.commands.am.Am.runStart(Am.java:680)
at com.android.commands.am.Am.onRun(Am.java:270)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:76)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
at dalvik.system.NativeStart.main(Native Method)
And here is the logcat , when i run the app:
10-27 11:05:52.905 32138-32138/? D/AndroidRuntime﹕ >>>>>>
AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
10-27 11:05:52.905 32138-32138/? D/AndroidRuntime﹕ CheckJNI is OFF
10-27 11:05:52.905 32138-32138/? I/AndroidRuntime﹕ Kernel Release Version: 3.10.20-262979-gaee3d1b
10-27 11:05:52.905 32138-32138/? I/dalvikvm﹕ No library specified. The standard exception handler will be used
10-27 11:05:52.925 32138-32138/? D/dalvikvm﹕ Trying to load lib libjavacore.so 0x0
10-27 11:05:52.925 32138-32138/? D/dalvikvm﹕ Added shared lib libjavacore.so 0x0
10-27 11:05:52.925 32138-32138/? D/dalvikvm﹕ Trying to load lib libnativehelper.so 0x0
10-27 11:05:52.925 32138-32138/? D/dalvikvm﹕ Added shared lib libnativehelper.so 0x0
10-27 11:05:52.925 32138-32138/? D/dalvikvm﹕ No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
10-27 11:05:52.935 32138-32138/? D/dalvikvm﹕ Extra Options: not specified
10-27 11:05:52.955 32138-32138/? D/dalvikvm﹕ Note: class Landroid/app/ActivityManagerNative; has 202 unimplemented (abstract)
methods
10-27 11:05:53.055 32138-32138/? E/IMGSRV﹕ :0: PVRDRMOpen: TP3, ret = 33
10-27 11:05:53.055 32138-32138/? E/IMGSRV﹕ :0: PVRDRMOpen: TP3, ret = 34
10-27 11:05:53.055 32138-32138/? E/IMGSRV﹕ :0: PVRDRMOpen: TP3, ret = 34
10-27 11:05:53.055 32138-32138/? E/IMGSRV﹕ :0: PVRDRMOpen: TP3, ret = 34
10-27 11:05:53.115 32138-32138/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am 10-27 11:05:53.125
32138-32145/? I/dalvikvm﹕ Total arena pages for JIT: 11 10-27
11:05:53.125 32138-32145/? I/dalvikvm﹕ Total arena pages for JIT: 12
10-27 11:05:53.125 32138-32145/? I/dalvikvm﹕ Total arena pages for
JIT: 13 10-27 11:05:53.125 32138-32145/? I/dalvikvm﹕ Total arena
pages for JIT: 14 10-27 11:05:53.125 32138-32145/? I/dalvikvm﹕ Total
arena pages for JIT: 15 10-27 11:05:53.125 32138-32145/? I/dalvikvm﹕
Total arena pages for JIT: 16 10-27 11:05:53.125 32138-32145/?
I/dalvikvm﹕ Total arena pages for JIT: 17 10-27 11:05:53.135
32138-32145/? I/dalvikvm﹕ Total arena pages for JIT: 18 10-27
11:05:53.135 32138-32145/? I/dalvikvm﹕ Total arena pages for JIT: 19
10-27 11:05:53.135 32138-32145/? I/dalvikvm﹕ Total arena pages for
JIT: 20
--------- beginning of /dev/log/system 10-27 11:05:53.155 535-864/? I/ActivityManager﹕ Force stopping com.radio.orion.radio
appid=10400 user=0: from pid 32138 10-27 11:05:53.165 32138-32138/?
D/AndroidRuntime﹕ Shutting down VM 10-27 11:05:53.165 32138-32143/?
D/dalvikvm﹕ GC_CONCURRENT freed 111K, 16% free 675K/804K, paused
0ms+1ms, total 3ms 10-27 11:05:53.165 32138-32145/? D/dalvikvm﹕
Compiler shutdown in progress - discarding request 10-27 11:05:53.165
32138-32145/? D/dalvikvm﹕ Compiler shutdown in progress - discarding
request 10-27 11:05:53.165 32138-32145/? D/dalvikvm﹕ Compiler
shutdown in progress - discarding request 10-27 11:05:53.165
32138-32145/? D/dalvikvm﹕ Compiler shutdown in progress - discarding
request 10-27 11:05:53.165 32138-32145/? D/dalvikvm﹕ Compiler
shutdown in progress - discarding request 10-27 11:05:53.165
32138-32145/? D/dalvikvm﹕ Compiler shutdown in progress - discarding
request

Add this code in your splash and run splash
Thread timerThread = new Thread(){
public void run(){
try{
sleep(3500);
}catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent intent = new Intent(Splash.this,SecondActivity.class);
startActivity(intent);
}
}
};
timerThread.start();

Related

Google maps stops the Android Studio application

I am working with google maps, calling the activity from a button, had a problem, the application stops when I try to open the map activity
My manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.alwaysecure">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION."/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="org.apache.http.legacy"
android:required="false"/>
</application>
</manifest>
El activity del mapa:
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity">
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity"
tools:layout_editor_absoluteX="-100dp"
tools:layout_editor_absoluteY="212dp" />
</fragment>
The activity that calls the map activity:
package com.example.alwaysecure;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button btn_login, btn_registrar;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn_login = (Button) findViewById(R.id.btn_login);
btn_registrar = (Button) findViewById(R.id.btn_register);
btn_login.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(),MapsActivity.class);
startActivity(intent);
}
});
/*btn_registrar.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(),RegistrarActivity.class);
startActivity(intent);
}
});*/
}
}
The error:
07/18 03:04:25: Launching 'app' on Nexus 5 API 24.
$ adb shell am start -n "com.example.alwaysecure/com.example.alwaysecure.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Waiting for process to come online...
Connected to process 27619 on device 'Nexus_5_API_24 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/System: ClassLoader referenced unknown path: /data/app/com.example.alwaysecure-2/lib/x86
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
D/: HostConnection::get() New Host Connection established 0xa9876880, tid 27619
D/: HostConnection::get() New Host Connection established 0xa2733000, tid 27642
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
D/EGL_emulation: eglCreateContext: 0xad4850c0: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xad4850c0: ver 2 0 (tinfo 0xad4835e0)
D/EGL_emulation: eglMakeCurrent: 0xad4850c0: ver 2 0 (tinfo 0xad4835e0)
I/zzbz: Making Creator dynamically
I/DynamiteModule: Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:203113001
Selected remote version of com.google.android.gms.maps_dynamite, version >= 203113001
V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/System: ClassLoader referenced unknown path:
W/ResourceType: ResTable_typeSpec entry count inconsistent: given 67, previously 69
ResTable_typeSpec entry count inconsistent: given 2885, previously 2906
ResTable_typeSpec entry count inconsistent: given 471, previously 3453
W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000001a/n/x86
I/Google Maps Android API: Google Play services client version: 12451000
I/Google Maps Android API: Google Play services package version: 212418022
I/Google Maps Android API: Google Play services maps renderer version(legacy): 203113001
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.alwaysecure, PID: 27619
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.alwaysecure/com.example.alwaysecure.MapsActivity}: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class fragment
Caused by: java.lang.IllegalArgumentException: Binary XML file line #12: Duplicate id 0xffffffff, tag null, or parent id 0x7f0900d2 with another fragment for com.google.android.gms.maps.SupportMapFragment
at androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView(FragmentLayoutInflaterFactory.java:116)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:135)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:319)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:298)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:414)
at android.app.Activity.setContentView(Activity.java:2414)
at androidx.activity.ComponentActivity.setContentView(ComponentActivity.java:380)
at com.example.alwaysecure.MapsActivity.onCreate(MapsActivity.java:28)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Process 27619 terminated.
The project was already finished, but due to a name change it got damaged and started showing this error, I'm doing it again from scratch but it keeps showing me this same error.

How to fix the error while saving the image in gallery?

I was trying to save an image in a gallery via an app.
this is the error I got
java.lang.IllegalArgumentException: Couldn't find meta-data for a provider with authority com.example.android.fileprovider
I have a button which would capture an image from the camera by calling the below function.
**Code for saving the image **
val REQUEST_TAKE_PHOTO = 1
private fun dispatchTakePictureIntent() {
Intent(MediaStore.ACTION_IMAGE_CAPTURE).also { takePictureIntent ->
// Ensure that there's a camera activity to handle the intent
takePictureIntent.resolveActivity(packageManager)?.also {
// Create the File where the photo should go
val photoFile: File? = try {
createImageFile()
} catch (ex: IOException) {
// Error occurred while creating the File
Log.i("Exception","${ex.toString()}")
null
}
// Continue only if the File was successfully created
photoFile?.also {
val photoURI: Uri = FileProvider.getUriForFile(
this,
"com.example.android.fileprovider",
it
)
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI)
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO)
}
}
}
}
lateinit var currentPhotoPath: String
#Throws(IOException::class)
private fun createImageFile(): File {
// Create an image file name
val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
val storageDir: File? = getExternalFilesDir(Environment.DIRECTORY_PICTURES)
return File.createTempFile(
"JPEG_${timeStamp}_", /* prefix */
".jpg", /* suffix */
storageDir /* directory */
).apply {
// Save a file: path for use with ACTION_VIEW intents
currentPhotoPath = absolutePath
}
}
Now I in google docs I found out that we need to add some more lines in Manifest.xml file, so I added them, but still, there is an error
<?XML version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.intentexperiment">
<uses-feature android:name="android.hardware.camera"
android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SET_ALARM" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-files-path
android:name="image" android:path="Android/data/com.example.package.name/files/Pictures" />
</paths>
I don't understand where the error is.
EDIT
I have moved the
<path>
...
</path>
in an XML file and accordingly changed the android: resource attribute
but the error now is
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.example.intentexperiment-l0jZknwE-m3bgGza6RJAug==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.intentexperiment-l0jZknwE-m3bgGza6RJAug==/lib/arm64, /system/lib64]]
EDIT 2
after doing this
android:name="androidx.core.content.FileProvider"
still there is a error
java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/com.example.intentexperiment/files/Pictures/JPEG_20200425_194311_3114424866623330911.jpg
at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:744)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)
at com.example.intentexperiment.MainActivity.dispatchTakePictureIntent(MainActivity.kt:54)
at com.example.intentexperiment.MainActivity.access$dispatchTakePictureIntent(MainActivity.kt:22)
at com.example.intentexperiment.MainActivity$onCreate$1.onClick(MainActivity.kt:31)
at android.view.View.performClick(View.java:6600)
at android.view.View.performClickInternal(View.java:6577)
at android.view.View.access$3100(View.java:781)
at android.view.View$PerformClick.run(View.java:25912)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)

Class org.apache.oozie.action.hadoop.SparkMain not found

following are all oozie files which i have been using to run job. I have created folder on hdfs /test/jar and put workflow.xml and coordinator.xml file.
Properties File
nameNode=hdfs://host:8020
jobTracker=host:8050
queueName=default
oozie.use.system.lib.path=trueoozie.coord.application.path=${nameNode}/test/jar/coordinator.xml
oozie.action.sharelib.for.spark=spark2
start=2019-05-22T07:37Z
end=2019-05-22T07:40Z
freq=*/1 * * * *
zone=UTC
user.name=oozie
oozie.action.sharelib.for.spark.exclusion=oozie/jackson
#oozie.libpath=${nameNode}/user/oozie/share/lib
Coordinator File
<coordinator-app xmlns = "uri:oozie:coordinator:0.5" name = "test" frequency = "${freq}" start = "${start}" end = "${end}" timezone = "${zone}">
<controls>
<timeout>1</timeout>
</controls>
<action>
<workflow>
<app-path>${nameNode}/test/jar/workflow.xml</app-path>
</workflow>
</action>
</coordinator-app>
Workflow file
<workflow-app name="sample-wf" xmlns="uri:oozie:workflow:0.5">
<start to="test" />
<action name="test">
<spark xmlns="uri:oozie:spark-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<master>yarn</master>
<mode>cluster</mode>
<name>Spark Example</name>
<class>com.spark.excel.mysql.executor.Executor</class>
<jar>${nameNode}/test/jar/com.spark.excel.mysql-0.1.jar</jar>
<spark-opts>--executor-memory 2G --num-executors 2</spark-opts>
</spark>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>Workflow failed, error message [${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end" />
</workflow-app>
I have setup sharelib path also. Oozie is showing spark2 also through shareliblist and added oozie-sharelib-spark.jar file also in spark2.Ozzie job is submission and running also, but when it try to execute spark job then throughing error.
I had the same error. In my case I had to add in the properties file
oozie.use.system.libpath=true

cluster event bus consumer not getting the message

I have two services(HttpServer and a Consumer) running on two different servers.
I am using Hazelcast for clustering.
Here is my code :
public class SampleRestService extends StartVerticle {
#Override
public void start() {
Router router = Router.router(vertx);
router.route().handler(BodyHandler.create());
router.post("/subscribe").handler(this::handleSubscription);
vertx.createHttpServer().requestHandler(router::accept).listen(9001);
}
public void handleSubscription(RoutingContext routingContext) {
System.out.println("sending to event bus");
vertx.eventBus().send("myserviceadd", routingContext.request().path(), ar -> {
if (ar.succeeded()) {
//req.response().setStatusCode(200).write(result.result().body()).end();
System.out.println("received response from event bus");
routingContext.response().setStatusCode(200).end("myhttp-response" + ar.result().body() + " ** " + routingContext.request().path());
} else if(ar.failed()) {
System.out.println(" response from event bus is failed");
ar.cause().printStackTrace();
routingContext.response().setStatusCode(500).end("failed to subscribeS");
}
});
}
}
Consumer Code :
public class SampleRestComsumer extends SampleConsumerParent {
#Override
public void start() {
vertx.eventBus().consumer("myserviceadd", message -> {
System.out.println("Recevied message: " + message.body());
message.reply(new JsonObject().put("responseCode", "OK").put("message", "This is your response to your event"));
});
}
}
Here is my cluster.xml
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config
hazelcast-config-3.2.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<properties>
<property name="hazelcast.wait.seconds.before.join">0</property>
<property name="hazelcast.logging.type">jdk</property>
</properties>
<group>
<name>dev-test</name>
<password>dev-pass</password>
</group>
<management-center enabled="false">http://localhost:8080/mancenter</management-center>
<network>
<port auto-increment="false" port-count="10000">5701</port>
<outbound-ports>
<!--
Allowed port range when connecting to other nodes.
0 or * means use system provided port.
-->
<ports>0</ports>
</outbound-ports>
<join>
<multicast enabled="false">
<!--<multicast-group>224.2.2.3</multicast-group>-->
<!--<multicast-port>54327</multicast-port>-->
</multicast>
<tcp-ip enabled="true">
<!-- <interface>127.0.0.1</interface> -->
<interface>10.27.92.45</interface>
<interface>10.27.92.47</interface>
</tcp-ip>
<aws enabled="false">
</aws>
</join>
<interfaces enabled="true">
<interface>10.27.92.*</interface>
</interfaces>
</network>
<partition-group enabled="false"/>
<executor-service name="default">
<pool-size>16</pool-size>
<!--Queue capacity. 0 means Integer.MAX_VALUE.-->
<queue-capacity>0</queue-capacity>
</executor-service>
<map name="__vertx.subs">
<!--
Number of backups. If 1 is set as the backup-count for example,
then all entries of the map will be copied to another JVM for
fail-safety. 0 means no backup.
-->
<backup-count>1</backup-count>
<time-to-live-seconds>0</time-to-live-seconds>
<max-idle-seconds>0</max-idle-seconds>
<!--
Valid values are:
NONE (no eviction),
LRU (Least Recently Used),
LFU (Least Frequently Used).
NONE is the default.
-->
<eviction-policy>NONE</eviction-policy>
<!--
Maximum size of the map. When max size is reached,
map is evicted based on the policy defined.
Any integer between 0 and Integer.MAX_VALUE. 0 means
Integer.MAX_VALUE. Default is 0.
-->
<max-size policy="PER_NODE">0</max-size>
<!--
When max. size is reached, specified percentage of
the map will be evicted. Any integer between 0 and 100.
If 25 is set for example, 25% of the entries will
get evicted.
-->
<eviction-percentage>25</eviction-percentage>
<merge-policy>
com.hazelcast.map.merge.LatestUpdateMapMergePolicy
</merge-policy>
</map>
<!-- Used internally in Vert.x to implement async locks -->
<semaphore name="__vertx.*">
<initial-permits>1</initial-permits>
</semaphore>
</hazelcast>
When i am running both the services. They are getting added to cluster and both services are up too but i am getting below error on server
response from event bus is failed
(TIMEOUT,-1) Timed out after waiting 30000(ms) for a reply. address:
7dfec6d2-3eaf-4006-90b1-6c2eaddb28bd
at io.vertx.core.eventbus.impl.HandlerRegistration.sendAsyncResultFailure(HandlerRegistration.java:118)
at io.vertx.core.eventbus.impl.HandlerRegistration.lambda$new$0(HandlerRegistration.java:65)
Please let me know what i am doing wrong.

Azure: Failed to send bytes to XContainer wad-tracefiles

For some reason I get errors while using Diagnostics in Azure. The code of my (WCF) WebRole is:
public override bool OnStart()
{
// To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config
DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
diagnosticConfig.Directories.BufferQuotaInMB = 256;
// Start diagnostics
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfig);
// Write trace line
Trace.WriteLine("CUSTUM TRACE MESSAGE");
// Start instance
return base.OnStart();
}
My Web.config file looks like this:
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<system.diagnostics>
<sharedListeners>
<add name="AzureLocalStorage" type="WCFServiceWebRole1.AzureLocalStorageTraceListener, WCFServiceWebRole1"/>
</sharedListeners>
<sources>
<source name="System.ServiceModel" switchValue="Verbose, ActivityTracing">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
</sources>
<trace autoflush="true">
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
In the Compute Emulator I see the following error:
[MonAgentHost] Output: Monitoring Agent Started
[Diagnostics]: Starting configuration channel polling
[MonAgentHost] Error: MA EVENT: 2012-06-06T10:01:20.111Z
[MonAgentHost] Error: 2
[MonAgentHost] Error: 6396
[MonAgentHost] Error: 6624
[MonAgentHost] Error: NetTransport
[MonAgentHost] Error: 0
[MonAgentHost] Error: x:\btsdx\215\services\monitoring\shared\nettransport\src\xblobconnection.cpp
[MonAgentHost] Error: XBlobConnection::PutBytesXBlob
[MonAgentHost] Error: 1621
[MonAgentHost] Error: ffffffff80050023
[MonAgentHost] Error: 0
[MonAgentHost] Error:
[MonAgentHost] Error: Failed to send bytes to XContainer wad-tracefiles
This error repeats several times. The "wad-tracefiles" container is added by the following code in the AzureLocalStorageTraceListener class:
public static DirectoryConfiguration GetLogDirectory()
{
DirectoryConfiguration directory = new DirectoryConfiguration();
directory.Container = "wad-tracefiles";
directory.DirectoryQuotaInMB = 10;
directory.Path = RoleEnvironment.GetLocalResource("WCFServiceWebRole1.svclog").RootPath;
return directory;
}
Why does writing trace messages fails in this scenario? When I look in my Storage with the Azure Storage Explorer the only table I see is the WADDirectoriesTable and not the the WADLogsTable. The "wad-tracefiles" blob does get created but that is not the place where I should find the Trace messages from my code.
Anyone, any idea? Any help is appreciated!
Your first problem is that you haven't used SetCurrentConfiguration() with your GetDefaultInitialConfiguration() to finally save the transfer time and log level. You must use the set of these API as below:
GetDefaultInitialConfiguration()
SetCurrentConfiguration()
OR
GetCurrentConfiguration()
SetCurrentConfiguration()
Because of it the following line based configuration will not be saved in Diagnostics configuration:
diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
Use above suggestion and then see what happens.
I would also suggest to just create a very simple web or worker role hello world sample and add general TRACE Message by enabling Azure Diagnostics to see if that give you any error. This will prove if you have any issue with your SDK installation or Azure Storage Emulator or not as well.
Thank you for your reply! The project I am using is a really simple WebRole with only one trace message so I can not strip any code out.
I tried your suggestion and you are right, I do not get any error messages anymore with the following code:
public override bool OnStart()
{
setDiagnostics();
Trace.WriteLine("CUSTUM TRACE MESSAGE");
// Start instance
return base.OnStart();
}
private void setDiagnostics()
{
// Get diagnostics connectionstring
string wadConnectionString = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(wadConnectionString));
// Get the diagnostics configuration of the deployment and its role instances that are currently running
DeploymentDiagnosticManager deploymentDiagnosticManager = new DeploymentDiagnosticManager(cloudStorageAccount, RoleEnvironment.DeploymentId);
RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = cloudStorageAccount.CreateRoleInstanceDiagnosticManager(
RoleEnvironment.DeploymentId,
RoleEnvironment.CurrentRoleInstance.Role.Name,
RoleEnvironment.CurrentRoleInstance.Id);
// Load diagnostics configuration
DiagnosticMonitorConfiguration diagConfig = roleInstanceDiagnosticManager.GetCurrentConfiguration();
// Get the default value if there is no config yet
if (diagConfig == null)
diagConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
// Enable EventLogs
diagConfig.WindowsEventLog.DataSources.Add("Application!*");
diagConfig.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1D);
diagConfig.WindowsEventLog.BufferQuotaInMB = 128;
// Failed Request Logs
diagConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
diagConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1D);
diagConfig.Directories.BufferQuotaInMB = 128;
// Crash Dumps
CrashDumps.EnableCollection(true);
// Set new configuration
roleInstanceDiagnosticManager.SetCurrentConfiguration(diagConfig);
// Start the DiagnosticMonitor
DiagnosticMonitor.Start(wadConnectionString, diagConfig);
}
When I look in which tables are present in the Azure Storage Explorer I only see the "WADDirectoriesTable" and the "WADWindowsEventLogsTable". Trace messages should come in the "WADLogsTable" right? So I see the Trace message in the Compute Emulator but I do not see them in my storage... any ideas why?

Resources