Problem Classpath for jaydebeapi from raspberry - java

I try to make Oracle request in python from Raspberry pi. The problem is:
"Oracle does not support the ARM CPU architecture which the Raspberry Pi uses. You downloaded and unzipped the Oracle Instant Client, but it can't actually run. And without the Oracle Client libraries, cx_oracle will not work, and neither will generic Python ODBC connectors."
Info:
Apache Maven 3.2.5
Maven home: /opt/apache-maven-3.2.5
Java version: 1.8.0_212, vendor: Raspbian
Java home: /usr/lib/jvm/java-8-openjdk-armhf/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "4.19.42-v7+", arch: "arm", family: "unix"
The location of ojdbc6.jar is:
/home/pi/ojdbc6.jar
I need python, so installed JPype and JayDeBeApi and I wrote this on jupyter notebopok:
import jaydebeapi
import jpype
import os
conn= jaydebeapi.connect('oracle.jdbc.driver.OracleDriver',
'[admin]/[root]#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=helloworld.com)(PORT=1521))(CONNECT_DATA=(SID=hello42)))',
'/home/pi/ojdbc6.jar')
But i have this error:
---------------------------------------------------------------------------
java.lang.RuntimeExceptionPyRaisable Traceback (most recent call last)
<ipython-input-12-2085c24bdf88> in <module>
----> 1 conn=jaydebeapi.connect('oracle.jdbc.driver.OracleDriver','[admin]/[root]#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=helloworld.com)(PORT=1521))(CONNECT_DATA=(SID=hello42)))','/home/pi/ojdbc6.jar')
/usr/local/lib/python3.5/dist-packages/jaydebeapi/__init__.py in connect(jclassname, url, driver_args, jars, libs)
379 else:
380 libs = []
--> 381 jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
382 return Connection(jconn, _converters)
383
/usr/local/lib/python3.5/dist-packages/jaydebeapi/__init__.py in _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs)
188 return jpype.JArray(jpype.JByte, 1)(data)
189 # register driver for DriverManager
--> 190 jpype.JClass(jclassname)
191 if isinstance(driver_args, dict):
192 Properties = jpype.java.util.Properties
/usr/local/lib/python3.5/dist-packages/jpype/_jclass.py in JClass(name)
71 jc = _jpype.findClass(name)
72 if jc is None:
---> 73 raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)
74
75 return _getClassFor(jc)
java.lang.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class oracle.jdbc.driver.OracleDriver not found
I think the problem is the classpath, but I am still a beginner. What would be the commands to type to configure this?
thank you in advance !

I'm pretty sure that the '/home/pi/ojdbc6.jar' is currently treated as driver_args instead of jars variable.
The correct way:
conn=jaydebeapi.connect('oracle.jdbc.driver.OracleDriver',
'[admin]/[root]#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=helloworld.com)(PORT=1521))(CONNECT_DATA=(SID=hello42)))',
jars='/home/pi/ojdbc6.jar')
Alternatively you can add the Oracle light client jar manually to jpype classpath.
jpype.startJVM(jpype.getDefaultJVMPath(), '-Djava.class.path=/home/pi/ojdbc6.jar'
conn=jaydebeapi.connect('oracle.jdbc.driver.OracleDriver',
'[admin]/[root]#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=helloworld.com)(PORT=1521))(CONNECT_DATA=(SID=hello42)))')

Related

Building OpenJDK Panama 19

i wanted to build OpenJDK panama for Windows 11 WSL from site:
uname Linux DESKTOP-LCGGQ32 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
git clone https://github.com/openjdk/panama-foreign
cd panama-foreign
On Windows 11 WSL I tried Commands:
./configure --with-boot-jdk=/mnt/c/Tools/jdk-17 --with-libclang="/mnt/c/Tools/LLVM" --with-toolchain-version=2019
Then
make
it fails on make
as shown below:
Building target 'default (exploded-image)' in configuration 'windows-x86_64-server-release'
Compiling 1 files for BUILD_TOOLS_HOTSPOT
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
<3>init: (11742) ERROR: UtilAcceptVsock:244: accept4 failed 110
<3>init: (11743) ERROR: UtilAcceptVsock:244: accept4 failed 110
make[3]: *** [CompileToolsHotspot.gmk:47: /mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/buildtools/buildtools/hotspot_tools_classes/_the.BUILD_TOOLS_HOTSPOT_batch] Error 255
make[2]: *** [make/Main.gmk:95: buildtools-hotspot] Error 2
make[2]: *** Waiting for unfinished jobs....
make[3]: *** [ToolsLangtools.gmk:37: /mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/buildtools/langtools_tools_classes/_the.BUILD_TOOLS_LANGTOOLS_batch] Error 255
make[2]: *** [make/Main.gmk:74: buildtools-langtools] Error 2
ERROR: Build failed for target 'default (exploded-image)' in configuration 'windows-x86_64-server-release' (exit code 2)
=== Output from failing command(s) repeated here ===
* For target buildtools_buildtools_hotspot_tools_classes__the.BUILD_TOOLS_HOTSPOT_batch:
<3>init: (11742) ERROR: UtilAcceptVsock:244: accept4 failed 110
* For target buildtools_langtools_tools_classes__the.BUILD_TOOLS_LANGTOOLS_batch:
<3>init: (11743) ERROR: UtilAcceptVsock:244: accept4 failed 110
* All command lines available in /mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/make-support/failure-logs.
=== End of repeated output ===
No indication of failed target found.
HELP: Try searching the build log for '] Error'.
HELP: Run 'make doctor' to diagnose build problems.
make[1]: *** [/mnt/c/repo/panama-foreign/make/Init.gmk:315: main] Error 2
make: *** [/mnt/c/repo/panama-foreign/make/Init.gmk:186: default] Error 2
Configuration summary:
Name: windows-x86_64-server-release
Debug level: release
HS debug level: product
JVM variants: server
JVM features: server: 'cds compiler1 compiler2 epsilongc g1gc jfr jni-check jvmci jvmti management parallelgc serialgc services shenandoahgc vm-structs zgc'
OpenJDK target: OS: windows, CPU architecture: x86, address length: 64
Version string: 19-internal-adhoc.root.panama-foreign (19-internal)
Source date: Determined at build time
Tools summary:
Environment: wsl2 version 5.10.16.3-microsoft-standard-WSL2, #1 SMP Fri Apr 2 22:23:49 UTC 2021 (Ubuntu 20.04.4 LTS); windows version 10.0.22000.556; prefix "/mnt"; root "\wsl.localhost\Ubuntu-20.04"
Boot JDK: java version "17" 2021-09-14 LTS Java(TM) SE Runtime Environment (build 17+35-LTS-2724) Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing) (at /mnt/c/tools/jdk-17)
Toolchain: microsoft (Microsoft Visual Studio 2019)
C Compiler: Version 19.29.30136 (at /mnt/c/progra~2/micros~2/2019/profes~1/vc/tools/msvc/1429~1.301/bin/hostx86/x64/cl.exe)
C++ Compiler: Version 19.29.30136 (at /mnt/c/progra~2/micros~2/2019/profes~1/vc/tools/msvc/1429~1.301/bin/hostx86/x64/cl.exe)
Build performance summary:
Build jobs: 15
Memory limit: 15858 MB
WARNING: The result of this configuration has overridden an older
configuration. You should run 'make clean' to make sure you get a
proper build. Failure to do so might result in strange build problems.
cat: standard output: No such file or directory
I have looked the failure logs
File1:
buildtools_buildtools_hotspot_tools_classes__the.BUILD_TOOLS_HOTSPOT_batch.cmdline
/mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/fixpath exec /mnt/c/tools/jdk-19/bin/javac.exe -J-XX:+UseSerialGC -J-Xms32M -J-Xmx512M -J-XX:TieredStopAtLevel=1 -g -Xlint:all -source 18 -target 18 -Xlint:-options -implicit:none -Xprefer:source -XDignore.symbol.file=true -encoding ascii -Werror -d /mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/buildtools/buildtools/hotspot_tools_classes #/mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/buildtools/buildtools/hotspot_tools_classes/_the.BUILD_TOOLS_HOTSPOT_batch.filelist
File2:
buildtools_langtools_tools_classes__the.BUILD_TOOLS_LANGTOOLS_batch.cmdline
/mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/fixpath exec /mnt/c/tools/jdk-19/bin/javac.exe -J-XX:+UseSerialGC -J-Xms32M -J-Xmx512M -J-XX:TieredStopAtLevel=1 -g -Xlint:all -source 18 -target 18 -Xlint:-options -implicit:none -Xprefer:source -XDignore.symbol.file=true -encoding ascii -Werror -d /mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/buildtools/langtools_tools_classes #/mnt/c/repo/panama-foreign/build/windows-x86_64-server-release/buildtools/langtools_tools_classes/_the.BUILD_TOOLS_LANGTOOLS_batch.filelist
Seems like the problem is because of WSL
https://github.com/microsoft/WSL/issues/6420
But i dont know how to fix this issue for panama.

How can I initialize Gradle projects in non-English systems?

I am trying to use Gradle on my Windows machine. The command I want to be able to use is:
gradle init --type java-application
But here is the error I get when I run this command on Powershell (or cmd):
> Task :init FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':init'.
> The requested build type 'java-application' is not supported. Supported types:
- 'basic'
- 'cpp-application'
- 'cpp-library'
- 'groovy-appl²cat²on'
- 'groovy-gradle-plugin'
- 'groovy-l²brary'
- 'java-appl²cat²on'
- 'java-gradle-plugin'
- 'java-l²brary'
- 'kotlin-appl²cat²on'
- 'kotlin-gradle-plugin'
- 'kotlin-l²brary'
- 'pom'
- 'scala-appl²cat²on'
- 'scala-l²brary'
- 'swift-application'
- 'swift-library'
As seen in the output, there is probably an encoding issue here. Because
java-appl²cat²on
is displayed as a possible type.
I used versions 6.9 and 7.0.2 and the results are the same. My system language is Turkish but I also use Git, Maven etc. without any issues.
Here is the output of gradle --version in case it is useful:
------------------------------------------------------------
Gradle 6.9
------------------------------------------------------------
Build time: 2021-05-07 07:28:53 UTC
Revision: afe2e24ababc7b0213ccffff44970aa18035fc0e
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_231 (Oracle Corporation 25.231-b11)
OS: Windows 10 10.0 amd64
Update: Issue #17383 has been fixed and is targeted for Gradle 7.2.
You may hit a bug in Gradle. I was able to reproduce the issue by forcing tr-TR locale in environment variable JAVA_TOOL_OPTIONS. I filed a bug in the Gradle issue tracker to have this checked: Build init plugin is locale sensitive.
As a workaround, you could force English locale for project initialization, in Powershell:
PS> $env:JAVA_TOOL_OPTIONS="-Duser.language=en -Duser.country=US"
PS> gradle.bat init --type java-application
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en -Duser.country=US
Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Groovy) [1..2]

Deployment via tomcat7-maven-plugin keeps adding "/deploy?path" to the target path

I'm trying to deploy a new version of my app to the path /app-test using the ## notation.
I've set the warFileName in pom.xml to be app-test##2021-01-21-pkix-fix and then called
mvn clean tomcat7:deploy
which generates and builds a .war successfully:
...
[INFO] Generating war /xyz/target/app-test##2021-01-21-pkix-fix.war
[INFO] Building war: /xyz/target/app-test##2021-01-21-pkix-fix.war
As it proceeds to upload the resources, it tries to do so multiple times while adding /deploy?path for the 2nd time. The third attempt makes even less sense:
[INFO] Deploying war to http://mydomain.eu/app-test##2021-01-21-pkix-fix
Uploading: http://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
Uploaded: http://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
Uploading: https://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
Uploaded: https://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
Uploading: https://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
Uploaded: https://mydomain.eu/manager/text/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix/deploy?path=%2Fapp-test%23%232021-01-21-pkix-fix
The deployment then fails:
FAIL - Failed to deploy application at context path /app-test##2021-01-21-pkix-fix/deploy?path=/app-test##2021-01-21-pkix-fix
because paths must not contain the = char which is confirmed by the catalina-daemon.out error log:
...
javax.management.MalformedObjectNameException: Invalid character '=' in value part of property
at javax.management.ObjectName.construct(ObjectName.java:618)
at javax.management.ObjectName.<init>(ObjectName.java:1382)
...
Here's my condensed pom.xml.
I suspect this has to do with my relatively recent mvn upgrade through homebrew. Here's my current version:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 1.8.0_112, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
Why does tomcat keep adding /deploy?path to my deployments?
As I'm investigating further, it's likely it's related to the tomcat7-maven-plugin but the docs haven't really clarified anything.
When all else fails, there's always the option to deploy the .war manually.
Package the program first:
mvn clean package [-P profile_name]
and then locate the .war in /target:

trap int3 error in libglib - debian eclipse

I get this error randomly while using eclipse IDE with my PC turned on for more than a day:
(kern.log)
trap: java [16410] trap int3 ip: 7f2a62422c75 sp: 7f2a9f686da0 error: 0 in libglib-2.0.so.0.5800.3 [7f2a623ea000 + 7e000]
when I get the error, eclipse crashes.
This is my operating system configuration on Debian 10 buster:
Linux 4.19.0-10-amd64 # 1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU / Linux
This is the eclipse version:
Version: 2019-12 (4.14.0)
Build id: 20191212-1212
I tried to run a clear setup but I always get the same error
Could it be a software or hardware problem?
Thanks

JBoss crashes on libclient64.dylib access

I´m trying to get Oracle instantclient up and running on OS X with Java 1.6.0_65. I did all steps described in the Oracle documentation: https://docs.oracle.com/cd/E11882_01/install.112/e38228/toc.htm
but the problem keeps the same:
Invalid memory access of location 0x0 rip=0x106369f87
The stack trace is:
Process: java [6234]
Path: /Library/Java/JavaVirtualMachines/jdk1.6.0_65.jdk/Contents/Home/bin/java
Identifier: com.apple.javajdk16.cmd
Version: 1.0 (1.0)
Code Type: X86-64 (Native)
Parent Process: sh [6222]
Responsible: Terminal [1179]
User ID: 33291
PlugIn Path: /Library/Java/JavaVirtualMachines/jdk1.6.0_65.jdk/Contents/Home/bundle/Libraries/libclient64.dylib
PlugIn Identifier: libclient64.dylib
PlugIn Version: ??? (1)
Date/Time: 2015-07-28 11:22:49.211 +0200
OS Version: Mac OS X 10.10.4 (14E46)
Report Version: 11
Anonymous UUID: 54BA4C92-323A-644A-55CF-CDBEDA054F4E
Time Awake Since Boot: 5500 seconds
Crashed Thread: 27 Java: main
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Regions Near 0:
-->
__TEXT 0000000106233000-000000010623b000 [ 32K] r-x/rwx SM=COW /Library/Java/JavaVirtualMachines/jdk1.6.0_65.jdk/Contents/Home/bin/java
Application Specific Information:
Java information:
Exception type: Bus Error (0xa) at pc=106369f87
Java VM: Java HotSpot(TM) 64-Bit Server VM (20.65-b04-462 mixed mode macosx-amd64)
Current thread (7fddcf86d800): JavaThread "main" [_thread_in_vm, id=309616640, stack(112646000,112746000)]
Stack: [112646000,112746000]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j oracle.jdbc.driver.T2CConnection.t2cSetSessionTimeZone(JLjava/lang/String;)I+0
j oracle.jdbc.driver.T2CConnection.logon()V+825
j oracle.jdbc.driver.PhysicalConnection.<init>(Ljava/lang/String;Ljava/util/Properties;Loracle/jdbc/driver/OracleDriverExtension;)V+323
....
I tried with both 32 and 64 versions. I did it using the appropriate client version together with either activating or deactivating the -d32 flag on the application start.
Both seam to have the same problem.
Does anyone has an idea what can be wrong here?
Thanks
UPDATE:
I replaced OCI by THIN and moved the crash ahead.
jdbc:oracle:thin:#${dbserver:our.domain.de}:${dbport:1234}:${dbsid:OURSID}
jdbc:oracle:oci:#(description=(ADDRESS=(COMMUNITY=tcp.world)(PROTOCOL=TCP)(Host=our.domain.de)(Port=1521))(connect_data=(sid=OURSID)))
It crashes now after reading of the data sources:
12:53:52,490 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
12:53:52,490 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
Invalid memory access of location 0x0 rip=0x10ff50f87
AFAIK client libs were not well maintained by Oracle and they simply did not support the newest OS X version - for years. They crashed on Mac
Try to use 12c drivers. But when even thin drivers crash your JVM, then there must be something wrong with your Java installation. Maybe you have multiple JDBC drivers in your classpath?

Categories

Resources