JNA library for z/OS (USS) - cassandra

I am trying to run cassandra on z/OS USS (Mainframe) which loads JNA jar. CASSANDRA fails to start with an error -
ERROR [main] 2020-04-01 01:07:44,272 NativeLibraryLinux.java:64 - Failed to link the C library against JNA. Native methods will be unavailable.
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/z/os-s390x/libjnidispatch.so) not found.
I could not find com/sun/jna/z/os-s390x/libjnidispatch.so inside the jar. libjnidispatch.so uses libffi C library. There is a port available https://github.com/eclipse/openj9/tree/master/runtime/libffi/z. I am not sure how to compile libffi and libjnidispatch.so on USS (Mainframe).
Is there any JNA library/libjnidispatch.so port available on z/OS USS (Mainframe)?

There is an open source project that is implementing Devops on Z called Polycephaly. Here is a link to their comments on this error.
They do not specifically refer to Cassandra but this is an error related to Jenkins as one of several distributed tools to improve DevOps on z/OS.
The error does not seem to impact what they are doing as there are alternative classes available to manage this function.
Note: the error 'com/sun/jna/z/os-s390x/libjnidispatch.so' not found is normal. The z/OS Java doesn't contain the Oracle JNI classes. This will not cause any issues.

Related

groovy exception while building presto at 0.229

I'm learning presto, and want to run Presto in my IDE.
So I builded presto with "./mvnw clean install -DskipTests", following the instructions in this document: https://github.com/Teradata/presto.
But I encountered an exception as follow
[ERROR] Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:3.1.10:spotbugs (spotbugs) on project presto-root: Execution spotbugs of goal com.github.spotbugs:spotbugs-maven-plugin:3.1.10:spotbugs failed: Unable to load the mojo 'spotbugs' in the plugin 'com.github.spotbugs:spotbugs-maven-plugin:3.1.10'. A required class is missing: groovy/lang/GroovyObject
My version of Presto is tag 0.229.
How can I fix this problem?
following the instructions in this document: https://github.com/Teradata/presto.
This is an obsolete repository.
The team maintaining it left Teradata in 2017 and started Starburst Data company (read more https://www.globenewswire.com/news-release/2017/12/13/1261305/0/en/Starburst-Accelerates-Presto-Adoption-for-Fast-Interactive-Queries-of-Big-Data.html).
In 2019 the team works closely with Presto Software Foundation.
Thus, https://github.com/trinodb/trino is the current "home address" to use.
[ERROR] Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:3.1.10:spotbugs (spotbugs) on project presto-root: Execution spotbugs of goal com.github.spotbugs:spotbugs-maven-plugin:3.1.10:spotbugs failed: Unable to load the mojo 'spotbugs' in the plugin 'com.github.spotbugs:spotbugs-maven-plugin:3.1.10'. A required class is missing: groovy/lang/GroovyObject
I have not encountered a problem like that before.
Note that Presto currently recommends Java 8 to build.
You can use e.g. Open JDK, Adopt Open JDK or Azul's distribution.
If more troubleshooting is needed, that isn't really fit for SO question-answer design, I recommend you join the #dev channel on Presto Community slack.

gRPC + SSL + uber jar + Linux = Failed to load netty-tcnative

Thanks to #nmittler on gRPC + SSL = UnsatisfiedLinkError I've got gRPC + SSL working on my Windows PC and on the target Linux platform.
But only when I specify a <classifier> for the io.netty/netty-tcnative-boringssl-static/1.1.33.Fork17 dependency. That can be:
hard-coded (e.g. to windows-x86_64)
injected using os-maven-plugin and ${os.detected.classifier}
But that means I can only run on:
Windows (or whichever platform I hard-code)
the platform I used to compile
But what I'd really like to be able to do is compile on Windows but run on Linux. So, in theory, I can just leave off the <classifier> to bring in the uber-jar (as specified in the docs).
But this doesn't work: when I step through io.netty.util.internal.NativeLibraryLoader.load() I find a call to System.mapLibraryName().
On Windows this correctly returns netty-tcnative.dll.
But on Linux (RHEL 7) it returns libnetty-tcnative.so ... which isn't in the uber-jar (jar tf netty-tcnative-boringssl-static-1.1.33.Fork17.jar returns, among others, META-INF/native/libnetty-tcnative-linux-x86_64.so).
Looking at the classified linux version of the jar I can see it contains META-INF/native/libnetty-tcnative.so ... which implies either the uber jar needs to be built differently (to rename libnetty-tcnative-linux-x86_64.so to libnetty-tcnative.so) or NativeLibraryLoader somewhere needs to take account of the different naming...
Am I on the right track? Can someone help fix this?
You're right, the uber jar on Maven Central does not contain the shared libraries. It's not yet clear whether the issue is building or deploying the jar. I've raised https://github.com/netty/netty-tcnative/issues/145 to track the fix.
Upgrading to io.grpc/grpc-all/0.14.0 (from 0.13.2) cured my problem because it brings in a newer version of io.netty/netty-handler (4.1.0.CR7 vs. 4.1.0.CR3).

Unable to load Oracle JDBC driver in JSF application on Tomcat 7

I wrote a JSF application that uses a connection to an Oracle database. I verified on my local Tomcat (version 7.0) that everything works well. Then when being deployed to a server with a Tomcat 7 that I don't administrate, I get the following error thrown:
Caused by:
java.lang.NoClassDefFoundError - Could not initialize class oracle.jdbc.driver.OracleDriver
On my local system I have the Oracle JDBC Driver (version 11.2.0.4) in CATANIA_HOME/lib. According to the information I have of my deployment server, they use the exact same driver.
At the moment I am using a very basic JSF software that does nothing else than execute
Class.forName("oracle.jdbc.driver.OracleDriver");
on page load. Again, works fine on my local system. Fails on the deployment server. I figured that maybe they missed to include the driver, although they wrote they put it in. So I added the ojdbc5.jar to WEB-INF/lib. However then I get a SealingViolation thrown, which seems to indicate that the class loader found TWO resources containing the oracle driver.
If would be very happy if you were to give me some hints as to how I might solve this problem.
Thanks
Just put the driver jars in your WEB-INF/lib folder, in my case, I put ojdbc6.jar, you must have one ojdbc6.jar in your project, hope this help

OpenJPA 2.1.1 enhancement problem on Glassfish 3.1.1

My problem is this exception:
Caused by: <openjpa-2.1.1-r422266:1148538 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
I'm trying to get an very simple java application with jsf and jpa running, but there seems to be a problem with the enhancement of my entities. As far as I know, tries OpenJPA to enhance my entities at runtime, which are listet in the persistence.xml, however there is no agent to do this. The keyword for this is: Enhancing at Runtime, right?
I thought the enhancement will automatically done by the application server at deployment? How can I configure this?
My exactly environment:
Glassfish 3.1.1
Derby, which is integrated in Glassfish
OpenJPA 2.1.1
Mojarra JSF 2.1.3
Update #1:
After some comments I've added the following lines to my persistence.xml:
<property name="openjpa.DynamicEnhancementAgent" value="false"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
It works now, but OpenJPA throw this warning:
SEVERE: 52 myApp WARN [http-thread-pool-8080(5)] openjpa.Enhance - Creating subclass for "[class myApp.model.entities.AbstractEntity, class myApp.model.entities.Post]".
This means that your application will be less efficient and will consume more memory than it would if you ran the OpenJPA enhancer. Additionally, lazy loading will not be available for one-to-one and many-to-one persistent attributes in types using field access; they will be loaded eagerly instead.
I think this can't be the solution.
Update #2:
Refer to fvu's answer, I've tried to define the -javaagent jvm parameter in the domain.xml and over the web admin console. After a restart appeared the problem again.
Update #3:
Refer to update #2, I've played a bit around. There must be thrown an error, when the -javaagent parameter is used, but the file is missing, right?. Yes, there it is:
Waiting for domain1 to start .Command start-domain failed.
Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:
Error occurred during initialization of VM
agent library failed to init: instrument
Error opening zip file or JAR manifest missing : /tmp/openjpa.jar
If I copying the agent to this location, this error doesn't appear, but openjpa could still not enhance my entities!
If you're still having issues... I'd highly recommend biting the bullet and setting up build time enhancement. You'll be much happier in the long run if you get that going.
A couple of ideas:
add the Java agent for enhancement to GF's JVM option, see this link for an example of how to install a javaagent and OpenJPA's doc 5.2.3, enhancing at runtime. That emulates enhancer activation in desktop apps as closely as possible IMO.
However, when I read chapter 5.2.4 of the OpenJPA docs it might be capable of picking up the correct enhancer automatically. Try copying openjpa.jar to the domain's library directory, and check what happens after a server restart.

Xerces error: org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl

I'm developing a web application using JSF 2.0, NetBeans 6.9.1, GlassFish Server 3.1, mojarra 2.0.3, and JasperReports 3.7.6. Included in my project library is the jar file "xerces-2.8.0.jar". This file was imported as part of the JasperReports jar file library. Whenever I try to deploy, run, or debug my project through NetBeans, I receive this error:
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
After any change in my project my build fails, and I receive the above error, when I try to deploy, run, or debug it. I have to restart the server and run/debug a second time. I've searched the internet and cannot find a solution to this problem. I've looked at the jar file in question, and and DTDDVFactoryImpl does indeed extend from DTDDVFactory - I don't know why I'm receiving this error. While I can eventually get my project running, it would be much nicer if I wasn't receiving this error.
Can anyone please tell me how I can fix this? Do I need to remove this file from my project library? Do I need to update this file with a newer version/older version?
If you provide your own xerces.jar, you have to do that through the Endorsed Standards Override Mechanism (java -Djava.endorsed.dirs=/path/to/xerces.jar), you are not allowed to just add it on the classpath (and will sooner or later run into trouble if you do). Let me explain.
JAXP is the Java API for XML Processing. The creation of JAXP objects (like parsers, XSLT transfomers, DOM Documents) is done through the factory/factory-method pattern so you can plugin a new JAXP implementation (it has to be newer than the one provided in your JRE). Xerces provides (part of) a JAXP implementation and contains endorsed standards (an endorsed standard is a Java API defined through a standards process other than the Java Community Process, see the Endorsed Standards Override Mechanism). You'll run in all kinds of troubles if you don't use the ESOM.
I got this error when using Selenium with Glassfish. I got around it by copying XML jars (xerces-*, xalan-*, xml-apis*, serialize*) from selenium/libs/ to $AS_HOME/lib/endorsed (for Glassfish 2) or to $AS_HOME/glassfish/lib/endorsed for Glassfish 4.

Resources