UnicodeDecodeError occurs when deploying to Google App Engine (Eclipse/Java) - java

I have created a web application using Java (Java 8) on Eclipse IDE (version 2019-06 (4.12.0)). When trying to deploy it to Google App Engine, the following error messages are shown:
Beginning deployment of service [default]...
Traceback (most recent call last):
File "C:\Work\google-cloud-sdk\platform\bundledpython\lib\logging__init__.py", line 861, in emit
msg = self.format(record)
File "C:\Work\google-cloud-sdk\platform\bundledpython\lib\logging__init__.py", line 734, in format
return fmt.format(record)
File "C:\Work\google-cloud-sdk\lib\googlecloudsdk\core\log.py", line 337, in format
msg = super(_LogFileFormatter, self).format(record)
File "C:\Work\google-cloud-sdk\platform\bundledpython\lib\logging__init__.py", line 465, in format
record.message = record.getMessage()
File "C:\Work\google-cloud-sdk\platform\bundledpython\lib\logging__init__.py", line 329, in getMessage
msg = msg % self.args
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8e in position 10: ordinal not in range(128)
Logged from file context_util.py, line 386
I guess there is something about the python file in my google-cloud-sdk, but I never edited or even did anything to it. Would it be a version problem? It seems that my application could be deployed successfully, but this error bugs me.
Here is my gcloud version:
Google Cloud SDK 277.0.0
app-engine-java 1.9.77
app-engine-python 1.9.88
bq 2.0.52
cloud-datastore-emulator 2.1.0
core 2020.01.17
gsutil 4.47

Related

bazel build android_binary with Guava dependency complains about min_sdk_version despite being set in manifest [duplicate]

I need help in how to set the target and compile Sdk versions separately for bazel.
I want to run tensorflow on the phone following this tutorial. After editing WORKSPACE for bazel as follows:
android_sdk_repository(
name = "androidsdk",
api_level = 24,
build_tools_version = "24.0.1",
path = "/home/Android/Sdk",
)
android_ndk_repository(
name="androidndk",
path="/home/Android/Sdk/ndk-bundle",
api_level=21)
I get PARSE ERROR on the phone upon apk installing:
adb install -r bazel-bin/tensorflow/examples/android/tensorflow_demo.apk
I have usb debugging and 3rd party apk installation enabled. The phone uses Android 4.4.4 so I changed WORKSPACE configuration to match it (tools and API installed by SDK manager properly) as:
android_sdk_repository(
name = "androidsdk",
api_level = 19,
build_tools_version = "19.1.0",
path = "/home/Android/Sdk",
)
android_ndk_repository(
name="androidndk",
path="/home/Android/Sdk/ndk-bundle",
api_level=21)
Upon building as:
bazel build //tensorflow/examples/android:tensorflow_demo
I end up with few errors of that type:
Error at 5 : /tmp/android_resources_tmp7060220119759636814/merged_resources/values-v21/values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Following this answer, I should build for compile API version > 21 but at the same time target API version 19. It can be easily set for gradle. However I have not found any clue how to do that for bazel. Any suggestions are appreciated!
If you want to target a lower Android API level, the file you want to edit is actually tensorflow/examples/android/AndroidManifest.xml. Leave the WORKSPACE file settings at the highest API level you have installed via your sdk (APIs can be installed with $ANDROID_HOME/tools/android).
You can lower the min API level to 19 in AndroidManifest.xml, but be aware you will encounter runtime errors on your phone running the demo unless you replace the demo code that interfaces with the camera2 api (which was added with API level 21) with analogous android.hardware.camera code.

FFmpeg linker error: Error due to text relocations in libavcodec shared object

I am trying to build an Android app which uses FFmpeg native code for video decoding and encoding. I have a 64-bit machine running 32-bit Ubuntu 14.04, ADT version 23. I downloaded FFmpeg-2.4.4 (32-bit) and built it for Android following the steps mentioned here - http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
I used latest Android NDK, that is NDK r10c. For testing, I used FFmpeg's API example code given in this link - http://ffmpeg.org/doxygen/trunk/decoding__encoding_8c-source.html
I was able to build all the shared objects successfully and Android project gets compiled successfully without any errors.
Following code is Android code to load all shared objects
public class CallNative {
public static String libName = "decode_encode" ;
public CallNative(){
System.loadLibrary("avutil-54");
System.loadLibrary("swresample-1");
System.loadLibrary("avcodec-56");
System.loadLibrary("avformat-56");
System.loadLibrary("swscale-3");
System.loadLibrary("avfilter-5");
System.loadLibrary(libName);
}
public native int decode(String Filename, int length);
}
And, this is how, decode function is called from Android.
Uri videoURI = Uri.parse(fileUri.toString());
String videoFilePath = getFilePathFromURI(getApplicationContext(), videoURI);
Log.d("SPLASH","Entering native decode call");
CallNative n = new CallNative();
n.decode(videoFilePath, videoFilePath.length());
Log.d("SPLASH","successfully returned from decode call");
When I debugged, App crashes when it enters native function call. I get following linker error.
W/linker(32244): libavcodec-56.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
I tried the same with FFmpeg 2.4.3 and 2.0.6 packages as well. I am getting the same error.
How to resolve this?
The code will work on all android version < 23.
I.e. if you set your targetSkdVersion to 21, the code will run with a warning.
Unfortunately, since Marshmallow (v23), Google no longer allows loading libraries with text relocations. Thus if you set your target sdk version to 23, your app will crash.
Google will not change this behavior, see: https://code.google.com/p/android/issues/detail?id=191235&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
Ffmpeg team won't remove the text relocations "anytime soon", see: https://trac.ffmpeg.org/ticket/4928
So currently it seems your only option is to set your target sdk to 21.

Error when push Liberty for Java application in IBM Bluemix

when I run sample IBM Bluemix Liberty for Java application https://github.com/ibmjstart/bluemix-java-postgresql-uploader.git following error:
-----> Downloaded app package (1.9M)
-----> Downloaded app buildpack cache (4.0K)
OK
/var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:101:in build_pack': Unable to detect a supported application type (RuntimeError) from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:74:inblock in compile_with_timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:68:in timeout' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:73:incompile_with_timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:54:in block in stage_application' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:inchdir'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:in stage_application' from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in'
FAILED
Server error, status code: 400, error code: 170001, message: Staging error: cannot get instances since staging failed
TIP: use 'cf logs jpu-henryhan --recent' for more information
The top error looks like you left off the -p <path_to_war> parameter when doing a push. If you just push a directory containing a WAR file, it will not be detected by the Java buildpack.
The tip provided in the output of your cf push request is relevant.
TIP: use 'cf logs jpu-henryhan --recent' for more information
Running that command will tail the log files produced during the staging process and let you see what error may have been raised. Often, it can be a missing dependency or a transient failure of some sort.
I just successfully deployed the sample using the "deploy to Bluemix" button and manually via the cf command line tool. Unless you changed the code, it is most likely that this error is a transient failure.
Run following command:
$ cf push jpu- -b https://github.com/cloudfoundry/java-buildpack --no-manifest --no-start -p PostgreSQLUpload.war
add the parameter to set the buildpack "-b https://github.com/cloudfoundry/java-buildpack"

Oracle weblogic server stop failed

When i debug my application in net beans, oracle weblogic server displays below exception in console.
Connecting to t3://localhost:7001 with userid weblogic ...
This Exception occurred at Wed Oct 16 16:56:01 IST 2013.
javax.naming.AuthenticationException
Problem invoking WLST - Traceback (innermost last):
File "D:\Weblogic\Middleware_1\base_domain\shutdown.py", line 3, in ?
File "<iostream>", line 22, in connect
File "<iostream>", line 648, in raiseWLSTException
WLSTException: Error occured while performing connect :
User: weblogic, failed to be authenticated.
Use dumpStack() to view the full stacktrace
my application uses oracle weblogic server and results will published into orale Bi publisher
My shutdown.py:
wlsUserID = java.lang.System.getenv('wlsUserID') wlsPassword = java.lang.System.getenv('wlsPassword') connect(username=wlsUserID, password=wlsPassword, url='t3://localhost:7001', adminServerName='AdminServer') shutdown('AdminServer','Server', ignoreSessions='true') exit()
I think your WebLogic AdminServer is locked when you try shutdown. Can you delete .lok files in your AdminServer directory or check Lock & Edit function in WebLogic console?
EDIT: If not able to delete .lok files and you want to stop WebLogic you can use the nmkill command. I don't know what type of OS you use. I always use kill -9command in Unix to stop WebLogic. To start WebLogic server you first need to start NodeManager and after the AdminServer. Here is nmStart command.
Normally you will have to define your userid and password in boot.properties file in security folder of your Admin/Managed Server. In your case the location will be "D:\Weblogic\Middleware_1\base_domain\servers\AdminServer\security". If the file boot.properties is not existent create one in that location and mention the following in plain text:
username=weblogic
password=password123
If the server startup is successful it will be encrypted automatically.
We too faced the same issue earlier. Just i reloaded the .bash_profile or .bash_rc files where i have placed the JAVA, ORACLE_HOME paths. After re-loading the files, the issues is resolved and I am able to shutdown the weblogic server.

Heroku installing play framework modules

I'm trying to install a module on my heroku app. Running this locally (minus the heroku run at the start) works, but I get an error when trying to run it on Heroku.
heroku run play install securesocial-0.2.2
and here's the output
...
~ Do you want to install this version (y/n)? y
~ Installing module securesocial-0.2.2...
~
~ Fetching http://www.playframework.org/modules/securesocial-0.2.2.zip
Traceback (most recent call last):
File ".play/play", line 153, in <module>
status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
File "/app/.play/framework/pym/play/commands/modulesrepo.py", line 58, in execute
install(app, args, env)
File "/app/.play/framework/pym/play/commands/modulesrepo.py", line 378, in install
Downloader().retrieve(fetch, archive)
File "/app/.play/framework/pym/play/commands/modulesrepo.py", line 88, in retrieve
try: urllib.urlretrieve(url, destination, self.progress)
File "/usr/local/lib/python2.7/urllib.py", line 91, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
File "/usr/local/lib/python2.7/urllib.py", line 241, in retrieve
tfp = open(filename, 'wb')
IOError: [Errno 2] No such file or directory: u'/app/.play/modules/securesocial-0.2.2.zip'
What's the proper way to do this? I've been searching, but I can't find any documentation on it.
Never used heroku but perhaps this step by step tutorial might help you out.
After you add the module locally you should be able to add the changes that are made to git and then push a new version of your app to Heroku.

Categories