Axis: classpath requires class path specification - java

NOVICE HERE - I am trying to Execute a WSDL file in a remote ubuntu terminal. I have installed Java, Axis, and ant. I also specified the classpath and CLASSPATH (wasn't sure if case was a thing). But when I run it using this command:
$AXIS2_HOME/bin/wsdl2java.sh -uri ShippingService.wsdl -p pws.client.ShippingService.wsdl -d adb -s
I get this error:
Using AXIS2_HOME: /opt/axis2
Using JAVA_HOME: /usr/lib/jvm/jdk-13.0.1
Error: -classpath requires class path specification
AXIS2_HOME=/opt/axis2 is defined in the /etc/environment; as is JAVA_HOME.
The instructions specify to use axis2-1.4.1 I am using axis2-1.7.9 which is the latest version. The older one has this file in its classpath specification annogen-0.1.0.jar the newer axis2 doesn't. Is this a possible issue?
Here is the Readme.txt (only available for Windows XP):
Requires:
Basic understanding of Web Services with Java
Valid Development/Production Key and Password
Java SE Development Kit (JDK 6 Update 16)
AXIS2 from Apache
Ant from Apache
This example covers the creation of a proper SOAP Client to communicate with the Shipping Web Services. The solution file was built on a Windows XP system using the Java Development Kit and AXIS2. The generated sample stub files are located in folder ShippingServiceStub based on this system that generated them. You can gather the pre-compiled stubs by making sure the Stub class files are in your classpath, or you can generate the stubs on your own following all the steps below.
To Complete:
1. Download Shipping Service 2.0 WSDL File from Eship Web Services site (Login Required)
a) https://eship.purolator.com/SITE/en/resourcecentre/samplecode.aspx
Note: In this sample the file has been unzipped to C:\EWSSample\ShippingService-Create directory. There should now be ShippingService.wsdl in the directory C:\EWSSample\ShippingService-Create\Development. This is the file we will concentrate on in the next step.
2. Execute WSDL2JAVA to build the stub files (Run this in the C:\EWSSample\ShippingService-Create\Development directory)
a) Example for all WSDLs from Eship Web Services site
%AXIS2_HOME%\bin\wsdl2java -uri WSName.wsdl -p pws.client.WSName -d adb -s
where:
WSName is the name of the web service, for example: ShippingService
AXIS2_HOME is environment variable pointing to your Axis2 installation, for example C:\axis2\axis2-1.4.1
-d adb means that provided samples use Axis Data Binding. It generates one stub class per web service which extends org.apache.axis2.client.Stub.
b) Our current example
C:\AXIS2\axis2-1.4.1\bin\wsdl2java -uri ShippingService.wsdl -p pws.client.ShippingService -d adb -s
Note: If you receive an error 'The JAVA_HOME environment variable is not defined' refer to Installation and Environment Notes file.
Note: If you receive an error 'The AXIS2_HOME environment variable is not defined' refer to Installation and Environment Notes file.
Response received:
Using AXIS2_HOME: C:\AXIS2\axis2-1.4.1
Using JAVA_HOME: C:\Program Files\Java\jdk1.6.0_16
Retrieving document at 'ShippingService.wsdl'.
What happened? build.xml was created in local directory. 'src\pws\client\ShippingService' directory created with ShippingServiceCallbackHandler.java, ShippingServiceContract_Consolidate_ValidationFaultFault_FaultMessage.java, ShippingServiceContract_CreateShipment_ValidationFaultFault_FaultMessage, ShippingServiceContract_ValidateShipment_ValidationFaultFault_FaultMessage, ShippingServiceContract_VoidShipment_ValidationFaultFault_FaultMessage and ShippingServiceStub java files created.
3. Download Shipping Service 2.0 Create java sample code and extract ShipmentClientCreate.java to C:\EWSSample\ShippingService-Create\Development\src\pws\client\ShippingService directory.
4. Edit the file and modify the following code
a) Define the Production (or development) Key and Password
b) Define your Purolator Account Number ( Note the Test Account Number is 9999999999 )
c) Define your Postal Code. Make sure the sending postal code is the one you registered with when receiving the Development Key and Password.
5. Run ant to compile.
a) Type 'C:\ANT\apache-ant-1.7.1\bin\ant' from the C:\EWSSample\ShippingService-Create\Development directory.
Response received:
Buildfile: build.xml
init:
[mkdir] Created dir: C:\EWSSample\ShippingService-Create\Development\build
[mkdir] Created dir: C:\EWSSample\ShippingService-Create\Development\build\classes
[mkdir] Created dir: C:\EWSSample\ShippingService-Create\Development\build\lib
pre.compile.test:
[echo] Stax Availability= true
[echo] Axis2 Availability= true
compile.src:
[javac] Compiling 5 source files to C:\EWSSample\ShippingService-Create\Development\build\classes
[javac] Note: C:\EWSSample\ShippingService-Create\Development\src\pws\client\ShippingService\ShippingServiceStub.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
jar.client:
[jar] Building jar: C:\EWSSample\ShippingService-Create\Development\build\lib\ShippingService-test-client.jar
BUILD SUCCESSFUL
Total time: 13 seconds
b) Type 'C:\ANT\apache-ant-1.7.1\bin\ant' from the C:\EWSSample\ShippingService-Create\Development directory.
Response received:
Buildfile: build.xml
init:
[mkdir] Created dir: C:\EWSSample\ShippingService-Create\Development\build
[mkdir] Created dir: C:\EWSSample\ShippingService-Create\Development\build\classes
[mkdir] Created dir: C:\EWSSample\ShippingService-Create\Development\build\lib
pre.compile.test:
[echo] Stax Availability= true
[echo] Axis2 Availability= true
compile.src:
[javac] Compiling 4 source files to C:\EWSSample\ShippingService-Create\Development\build\classes
[javac] C:\EWSSample\ShippingService-Create\Development\src\pws\client\ShippingService\ShippingServiceStub.java:34: error: incompatible types: java.lang.String cannot be converted to pws.client.ShippingService.ShippingServiceStub.String
[javac] return Long.toString(System.currentTimeMillis()) + "_" + counter;
[javac] ^
[javac] Note: C:\EWSSample\ShippingService-Create\Development\src\pws\client\ShippingService\ShippingServiceStub.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
BUILD FAILED
C:\EWSSample\ShippingService-Create\Development\build.xml:43: Compile failed; see the compiler error output for details.
Total time: 4 seconds
In case you see this error, update C:\EWSSample\ShippingService-Create\Development\src\pws\client\ShippingService\ShippingServiceStub.java by changing method signature of getUniqueSuffix to
private static synchronized java.lang.String getUniqueSuffix(){
6. Navigate to the C:\EWSSample\ShippingService-Create\Development\src\ directory and compile the client code by running the following
a) javac pws\client\ShippingService\ShipmentClientCreate.java
Possible Error 1: 'javac' is not recognized as an internal or external command, operable program or batch file.
Resolution 1: You need to add the Java path to the PATH Environment Variable. %JAVA_HOME%\bin. Refer to Installation and Environment Notes file for additional information.
Possible Error 2: package org.apache.axis2 does not exist throws org.apache.axis2.AxisFault
Resolution 2: Classpath variable needs to be set. Refer to Installation and Environment Notes file for additional information.
Response Received:
C:\EWSSample\ShippingService-Create\Development\src>javac pws\client\ShippingService\ShipmentClientCreate.java
Note: .\pws\client\ShippingService\ShippingServiceStub.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7. Running the code after valid compile above.
a) C:\EWSSample\ShippingService-Create\Development\src>java pws.client.ShippingService.ShipmentClientCreate
Possible Error 1:
WARNING:
log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisService).
log4j:WARN Please initialize the log4j system properly.
Resolution 1: http://logging.apache.org/log4j/1.2/manual.html. Refer to Installation and Environment Notes file for additional information.
Possible Error 2:
[main] INFO org.apache.axis2.transport.http.HTTPSender - Unable to sendViaPost to url[https://devwebservices.purolator.com/EWS/V2/Shipping/ShippingService.asmx]
org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
Resolution 2: Make sure you are using your Development key and Password when connecting to the devwebservices instance.
Possible Error 3:
[main] INFO org.apache.commons.httpclient.HttpMethodDirector - No credentials available for BASIC 'Purolator'#devwebservices.purolator.com:
Resolution 3:
Make sure code has import procedures:
import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;
Try the alternate way to send in credentials to web service. Make sure you remark the other credentials that you tried.
Options options = stub._getServiceClient().getOptions();
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername("your key here");
auth.setPassword("your password here");
options.setProperty(HTTPConstants.AUTHENTICATE,auth);
Response Received:
Here are the setup instructions (only available for Windows XP):
Applications to Install:
Java SE Development Kit (JDK 6 Update 16)
AXIS2 from Apache
Ant from Apache
This example covers the creation of a proper SOAP Client to communicate with the Shipping Web Services. The solution file was built on a Windows XP system using the Java Development Kit and AXIS2.
Installation Instructions for the Environment:
1. Download and install the Java Development Kit
a) In this document Java SE Development Kit 6 Update 16 was downloaded an installed
b) Location: http://java.sun.com/javase/downloads/index.jsp
c) run jdk-6u16-windows-i586.exe (Extracts Installation files)
d) Installed to C:\Program Files\Java\jdk1.6.0_16
2. Download and unpack AXIS 2 Standard Binary Distribution version 1.4.1
a) Location: http://ws.apache.org/axis2/download/1_4_1/download.cgi
b) Unzip to directory (C:\AXIS2\axis2-1.4.1)
Make sure you add JAVA_HOME environment variable pointing to your Java engine root folder (C:\Program Files\Java\jdk1.6.0_16).
This can be completed by right clicking My Computer. Select Properties. Select Advanced, select Environment variables. Select 'New' of JAVA_HOME is not listed under System Variables.
In our example C:\Program Files\Java\jdk1.6.0_16
Make sure you add AXIS2_HOME environment variable pointing to your Axis engine root folder (C:\AXIS2\axis2-1.4.1).
This can be completed by right clicking My Computer. Select Properties. Select Advanced, select Environment variables. Select 'New' of AXIS_HOME is not listed under System Variables.
In our example C:\AXIS2\axis2-1.4.1
Use the online tutorial from Apache for non Java programmers.
Note: Java sample code uses web service client stubs created with Wsdl2Java utility from Apache Axis2 Web services engine.
3. Download and unpack Apache Ant (1.7.1)
a) Location: http://ant.apache.org/bindownload.cgi
b) Unzip to directory (C:\Ant\apache-ant-1.7.1)
Note: Apache Ant is a Java-based build tool.
4. Set the Classpath for the jar files that are included in the AXIS directory.
a) run the following from command line
set classpath=C:\AXIS2\axis2-1.4.1\lib\activation-1.1.jar;
C:\AXIS2\axis2-1.4.1\lib\annogen-0.1.0.jar;
C:\AXIS2\axis2-1.4.1\lib\axiom-api-1.2.7.jar;
C:\AXIS2\axis2-1.4.1\lib\axiom-dom-1.2.7.jar;
C:\AXIS2\axis2-1.4.1\lib\axiom-impl-1.2.7.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-adb-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-adb-codegen-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-ant-plugin-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-clustering-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-codegen-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-corba-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-fastinfoset-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-java2wsdl-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-jaxbri-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-jaxws-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-jaxws-api-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-jibx-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-json-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-jws-api-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-kernel-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-metadata-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-mtompolicy-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-saaj-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-saaj-api-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-spring-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\axis2-xmlbeans-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\backport-util-concurrent-3.1.jar;
C:\AXIS2\axis2-1.4.1\lib\commons-codec-1.3.jar;
C:\AXIS2\axis2-1.4.1\lib\commons-fileupload-1.2.jar;
C:\AXIS2\axis2-1.4.1\lib\commons-httpclient-3.1.jar;
C:\AXIS2\axis2-1.4.1\lib\commons-io-1.4.jar;
C:\AXIS2\axis2-1.4.1\lib\commons-logging-1.1.1.jar;
C:\AXIS2\axis2-1.4.1\lib\geronimo-annotation_1.0_spec-1.1.jar;
C:\AXIS2\axis2-1.4.1\lib\geronimo-stax-api_1.0_spec-1.0.1.jar;
C:\AXIS2\axis2-1.4.1\lib\httpcore-4.0-beta1.jar;
C:\AXIS2\axis2-1.4.1\lib\httpcore-nio-4.0-beta1.jar;
C:\AXIS2\axis2-1.4.1\lib\jalopy-1.5rc3.jar;
C:\AXIS2\axis2-1.4.1\lib\jaxb-api-2.1.jar;
C:\AXIS2\axis2-1.4.1\lib\jaxb-impl-2.1.6.jar;
C:\AXIS2\axis2-1.4.1\lib\jaxb-xjc-2.1.6.jar;
C:\AXIS2\axis2-1.4.1\lib\jaxen-1.1.1.jar;
C:\AXIS2\axis2-1.4.1\lib\jettison-1.0-RC2.jar;
C:\AXIS2\axis2-1.4.1\lib\jibx-bind-1.1.5.jar;
C:\AXIS2\axis2-1.4.1\lib\jibx-run-1.1.5.jar;
C:\AXIS2\axis2-1.4.1\lib\log4j-1.2.15.jar;
C:\AXIS2\axis2-1.4.1\lib\mail-1.4.jar;
C:\AXIS2\axis2-1.4.1\lib\mex-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\neethi-2.0.4.jar;
C:\AXIS2\axis2-1.4.1\lib\soapmonitor-1.4.1.jar;
C:\AXIS2\axis2-1.4.1\lib\woden-api-1.0M8.jar;
C:\AXIS2\axis2-1.4.1\lib\woden-impl-dom-1.0M8.jar;
C:\AXIS2\axis2-1.4.1\lib\wsdl4j-1.6.2.jar;
C:\AXIS2\axis2-1.4.1\lib\wstx-asl-3.2.4.jar;
C:\AXIS2\axis2-1.4.1\lib\xalan-2.7.0.jar;
C:\AXIS2\axis2-1.4.1\lib\xercesImpl-2.8.1.jar;
C:\AXIS2\axis2-1.4.1\lib\xml-apis-1.3.04.jar;
C:\AXIS2\axis2-1.4.1\lib\xml-resolver-1.2.jar;
C:\AXIS2\axis2-1.4.1\lib\xmlbeans-2.3.0.jar;
C:\AXIS2\axis2-1.4.1\lib\XmlSchema-1.4.2.jar;
5. Set up the file log4j.properties which displays additional information when running code in command line.
a) Location of Information: http://logging.apache.org/log4j/1.2/manual.html
b) Create File named: 'log4j.properties' in C:\EWSSample\ShippingService-Create\Development\src directory with the following information.
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Please assist. Cheers!

Related

Module not found error for nodejavabridge_bindings.node when executing jest test although file exists on specified directory

I am using NCache NodeJS client package and writing tests by calling NCache API's. Package has dependency of Java. After I installed and used that package to write simple test. Test execution failed with module not Found error:
Error Message
Messgae:
The specified module could not be found.
\\D:\GitHome\Test\node_modules\java\build\Release\nodejavabridge_bindings.node
at Runtime._loadModule (node_modules/jest-runtime/build/index.js:893:29)
at Object.<anonymous> (node_modules/java/lib/nodeJavaBridge.js:21:16)
File in above mentioned directory exits.
Note: When I used that package in simple index.js file it worked fine as expected but unable to run with jest.
No major configuration done for jest in package.json file.
Java jdk-11.0.6 installed on box and JAVA_HOME is set.
Package.json
test.specs.js
Unable to identify the exact reason of failure therefore stuck on how to resolve it.
Environment:
OS: Windows
node: 14.15.3
jest: 26.6.3
C:\Program Files\OpenJDK\jdk-16.0.1\bin\server needs to be in your path. On windows can Edit the system environment > Environment Variables... > System variables and add C:\Program Files\OpenJDK\jdk-16.0.1\bin\server
Other option is to add it to your test runner. For example in WebStorm edit the Run Configurations and add Environment variables PATH=C:\Program Files\OpenJDK\jdk-16.0.1\bin\server

Debug OpenJDK14 using CLion: failed to load the CMake project

I download the source code of OpenJDK14 and put them in \home\yuanfang\jdk14 and after running bash configure --disable-warnings-as-errors and make images, I build OpenJDK14 successfully, The newly built JDK is in home\yuanfang\jdk14\build\linux-x86_64-server-release\jdk. By the way, I am using Ubuntu 20.04 LTS.
Then I want to debug OpenJDK14 using CLion IDE. I was using CLion 2020.2 and I take the following steps:
After open CLion I choose Create New CMake Project from Sources and choose the directory of \home\yuanfang\jdk14, which is the root directory of the jdk project.
I alter the Run/Debug Configurations to make it look like this:
CLion create a CMakeLists.txt automatically but the file doesn't work, so after googling I find find the correct CMakeLists.txt here at https://github.com/ojdkbuild/ojdkbuild/blob/master/src/java-14-openjdk/CMakeLists.txt. I then rewrite the old CMakeLists.txt using the correct one.
I download the whole repository(that is, github.com/ojdkbuild/ojdkbuild), unzip it and put it into \home\yuanfang\jdk14.
It looks like as follow, the ojdkbuild-master is the newly added folder.
I reload the CMake project, but some CMake error occurs(as follow), why can't CLion find those files? javaI googled but can't find any effective solution. Is there anything I can do or refer to? Thanks in advance.
CMake Error at CMakeLists.txt:19 (include):
include could not find load file:
/home/yuanfang/jdk14/../../resources/cmake/ojdkbuild_common.cmake
CMake Error at CMakeLists.txt:21 (include):
include could not find load file:
/home/yuanfang/jdk14/../../resources/cmake/version.cmake
CMake Error at CMakeLists.txt:93 (add_subdirectory):
add_subdirectory given source
"/home/yuanfang/jdk14/../../deps/rhino/scripting_tasks" which is not an
existing directory.
CMake Error at CMakeLists.txt:98 (ojdkbuild_add_subdirectory):
Unknown CMake command "ojdkbuild_add_subdirectory".
-- Configuring incomplete, errors occurred!
See also "/home/yuanfang/jdk14/cmake-build-debug/CMakeFiles/CMakeOutput.log".
Cannot get compiler information:
Compiler exited with error code 1: /usr/bin/cc -xobjective-c -I/home/yuanfang/jdk14/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles......./loading/LibraryLoader/jar_src -g -fpch-preprocess -v -dD -E
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
COLLECT_GCC_OPTIONS='-I' '/home/yuanfang/jdk14/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles' '-I' '......'-g' '-fpch-preprocess' '-v' '-dD' '-E' '-D' '___CIDR_DEFINITIONS_END' '-mtune=generic' '-march=x86-64'
cc1obj -E -quiet -v #/tmp/cci3XM6r -imultiarch x86_64-linux-gnu -D ___CIDR_DEFINITIONS_END /tmp/compiler-file5929385022787926768 -mtune=generic -march=x86-64 -fpch-preprocess -g -fworking-directory -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -dD
cc: fatal error: cannot execute 'cc1obj': execvp: No such file or directory
compilation terminated.
[Failed to reload]
step: check out this projecdt :https://github.com/ojdkbuild/ojdkbuild.git
step: put the source code of OpenJDK14 in ojdkbuild/src/
step: copy reousrces directory and CMakelists.txt to OpenJDK14
step: recomile openjdk and import project to CLin

CMake could not find JNI

I created a new Android Studio Project with C++ support and did not add anything to it. The project builds, compiles and runs with CMake. I then added the following two lines of code to CMakeLists.txt at the bottom of the file and I get a CMake build error.
find_package(Java COMPONENTS Development) # Line 47
find_package(JNI REQUIRED) # Line 48
And this is the error I get when building the project
-- Found Java: /usr/lib/jvm/java-10-oracle/bin/java (found version "10.0.1") found components: Development
-- Configuring incomplete, errors occurred!
CMake Error at /home/xxxxx/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
See also "/home/xxxxx/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/release/x86_64/CMakeFiles/CMakeOutput.log".
JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Call Stack (most recent call first):
/home/xxxxxx/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
/home/xxxxxx/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/FindJNI.cmake:314 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:48 (find_package)
External native generate JSON release: JSON generation completed with problems
CMake runs when being called form the command line, but fails inside Android Studio for some reason and I am not sure why.
EDIT 1
Here is the CMakeOutput.log file
EDIT 2
This is all that is in CMakeLists.txt file. It compiles in cmd with the command cmake.
cmake_minimum_required(VERSION 3.4.1)
find_package(Java COMPONENTS Development)
find_package(JNI REQUIRED)
This is the cmd output
E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\build>cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: E:/Users/xxxxx/AndroidStudioProjects/MyApplication/app/build
When I try to add it compile it in Android Studio using gradle I get the following error on Windows 10 pro 64 bit
Microsoft Windows [Version 10.0.17134.112]
(c) 2018 Microsoft Corporation. All rights reserved.
E:\Users\xxxxx\AndroidStudioProjects\MyApplication>gradlew build --stacktrace
> Task :app:generateJsonModelDebug
External native generate JSON debug: starting JSON generation
External native generate JSON debug: using platform version 24 for ABI ARMEABI_V7A and min SDK version 24
External native generate JSON debug: noticing that build file 'E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\CMakeLists.txt' is out of date with respect to E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\.extern
alNativeBuild\cmake\debug\armeabi-v7a\android_gradle_build.json
External native generate JSON debug: rebuilding JSON E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a\android_gradle_build.json due to:
External native generate JSON debug: - a dependent build file changed
External native generate JSON debug: keeping json folder 'E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a' but regenerating project
External native generate JSON debug: executing cmake Executable : E:\Android\SDK\cmake\3.6.4111459\bin\cmake.exe
arguments :
-HE:\Users\xxxxx\AndroidStudioProjects\MyApplication\app
-BE:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a
-DANDROID_ABI=armeabi-v7a
-DANDROID_PLATFORM=android-24
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=E:\Users\xxxxx\AndroidStudioProjects\MyApplication\app\build\intermediates\cmake\debug\obj\armeabi-v7a
-DCMAKE_BUILD_TYPE=Debug
-DANDROID_NDK=E:\Android\SDK\ndk-bundle
-DCMAKE_CXX_FLAGS=
-DCMAKE_TOOLCHAIN_FILE=E:\Android\SDK\ndk-bundle\build\cmake\android.toolchain.cmake
-DCMAKE_MAKE_PROGRAM=E:\Android\SDK\cmake\3.6.4111459\bin\ninja.exe
-GAndroid Gradle - Ninja
jvmArgs :
CMake Error at E:/Android/SDK/cmake/3.6.4111459/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Call Stack (most recent call first):
E:/Android/SDK/cmake/3.6.4111459/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
E:/Android/SDK/cmake/3.6.4111459/share/cmake-3.6/Modules/FindJNI.cmake:314 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
See also "E:/Users/xxxxx/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
Solved with
sudo apt-get install -y openjdk-8-jdk
sudo apt-get install -y default-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
As the CMake version bundled with Android tries to tell you, it can't find the JNI package because some parts were missing:
missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH
Checking the documentation for FindJNI (https://cmake.org/cmake/help/latest/module/FindJNI.html) these variables are set to the locations of libraries and headers not shipped with the Android version of JNI (to little surprise, Android does not included the AWT library for instance).
When running find_package(JNI REQUIRED), the FindJNI code checks if these variables are set and if not, issues an error.
A workaround is to set these variables yourself, before calling find_package:
# We are only interested in finding jni.h: we do not care about extended JVM
# functionality or the AWT library.
set(JAVA_AWT_LIBRARY NotNeeded)
set(JAVA_JVM_LIBRARY NotNeeded)
set(JAVA_INCLUDE_PATH2 NotNeeded)
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
find_package(JNI REQUIRED)
Be aware though, that your code will only be able to use jni.h and its functionality: if it tries to access any other part of the JNI package it will fail (probably at compile time) because essentially, you have tricked CMake into thinking that the entire package was found, when in reality only a part of it exists in the Android setup.
I found a solution that works for me:
cmake_minimum_required(VERSION 3.10)
project("ktaglib")
set(JAVA_AWT_LIBRARY "$ENV{JAVA_HOME}/lib/libjawt.so")
set(JAVA_JVM_LIBRARY "$ENV{JAVA_HOME}/lib/server/libjvm.so")
set(JAVA_INCLUDE_PATH "$ENV{JAVA_HOME}/include")
set(JAVA_INCLUDE_PATH2 "$ENV{JAVA_HOME}/include/linux")
set(JAVA_AWT_INCLUDE_PATH "$ENV{JAVA_HOME}/include")
find_package(JNI REQUIRED)
You must set the environment variable JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" beforehand.
More info: https://github.com/dockcross/dockcross/issues/576
Same on alpine:edge docker image, fixed using:
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
RUN apk add --no-cache openjdk8
ref: https://pkgs.alpinelinux.org/contents?branch=edge&name=openjdk8&arch=x86_64&repo=community

Hadoop build Failing in Windows: zconf.h is missing from native.sln?

I'm trying to build the following hadoop version on development computer with Windows 10 Home Edition
hadoop-2.7.3-src
Here are the details about my local development environment:
-Windows 10 Home Edition
-Intel Core i5-6200U CPU #2.30GHz
-RAM 16 GB
-64-bit Operating System, x64-based processor
-Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3
-Also added MSBUILD location as C:\Program Files (x86)\MSBuild\14.0\Bin\amd64 to Windows System Environment Variable Path
-.NET Framework 4.6.01586
-cmake version 3.7.2
-CYGWIN_NT-10.0 LTPBCV82DUG 2.7.0(0.306/5/3) 2017-02-12 13:18 x86_64 Cygwin
-java version "1.8.0_121"
-Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
-Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
-Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
-Google Protocol Buffers protoc --version libprotoc 2.5.0
Also, I've created and system environment variable called Platform and set it to x64
I opened up Developer Command Prompt for Visual Studio 2015 (VS2015)
c:\hadoop\hadoop-2.7.3-src> mvn package -Pdist,native-win -DskipTests -Dtar -X
Unfortunately, I'm getting the following error:
[C:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj]
ZlibDecompressor.c
c:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\src\org\apache\hadoop\io\compress\zlib\org_apache_hadoop_io_compress_zlib.h(36): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj]
Done Building Project "C:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.sln" (default targets) -- FAILED.
Build FAILED.
"C:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.sln" (default target) (1) ->
"C:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj" (default target) (2) ->
(ClCompile target) ->
c:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\src\org\apache\hadoop\io\compress\zlib\org_apache_hadoop_io_compress_zlib.h(36): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj]
c:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\src\org\apache\hadoop\io\compress\zlib\org_apache_hadoop_io_compress_zlib.h(36): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\hadoop\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:02.49
The aforementioned error has to do with zlib tool.
After researching online, someone said that the following Visual Studio solution file needs to be built successfully in Visual Studio:
....\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\native\native.sln
Using Visual Studio 2015 in Administrator mode, I opened up the native.sln file, and immediately saw an error:
enter image description here
Could someone please tell me what steps I have to take to resolve said error?
So there were quite a few steps I had to take in order to resolve the problems.
Within the ....\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\winutils directory, I opened up the following solution in Visual Studio 2015:
winutils.sln
Within .....\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src\main\winutils\libwinutils.c , I commented out the following line of code, and made a modified copy of it as shown below:
//const WCHAR* wsceConfigRelativePath = WIDEN_STRING(STRINGIFY(WSCE_CONFIG_DIR)) L"\\" WIDEN_STRING(STRINGIFY(WSCE_CONFIG_FILE));
const WCHAR* wsceConfigRelativePath = WIDEN_STRING("../etc/hadoop") L"\\" WIDEN_STRING("wsce-site.xml");
Also, In the winutils solution's property window, I had to set the platform value to x64 as the screenshot below shows:
Next, I opened Dos command prompt, and checked the exact version of my Windows OS:
ver
Microsoft Windows [Version 10.0.14393]
Also, I opened up the property window of the libwinutils project, and ensured that properties that are marked in the following snapshot had the proper values:
Also, I took the same steps for the properties of the winutils project:
(Sorry, stackoverflow would not allow me to place another picture snapshot, but all you basically have to do is make sure the the winutils project's property are set properly )
I downloaded zlib version 1.2.11 source code. Using Developer Command Prompt for VS2015 ( Visual Studio 2015 ) I built zlib from zlib version 1.2.11 source code using cmake
c:\zlib\zlib-1.2.11>cmake -G "Visual Studio 14 2015" -A x64 c:\zlib\zlib-1.2.11\
-- The C compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for fseeko
-- Looking for fseeko - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: C:/zlib/zlib-1.2.11
Finally, run the build with cmake
c:\zlib\zlib-1.2.11>cmake --build .
In Windows System Variables I have the following variable defined:
ZLIB_HOME is set to C:\zlib\zlib-1.2.11

Bug in debugging Red5 server as Java Application inside eclipse

I am following
Red5 Media Server - Workspace Setup Guide - r4737!
I am able to build Red5 distribution and rename distribution jar files i.e completed upto step 6.But when I followed step 7 - Run inside of eclipse failed to debug it as java application -
Red5 root: /home/yuvraj/Documents/RED5/red5 java code all/java/server/trunk
Configuation root: /home/yuvraj/Documents/RED5/red5 java code all/java/server/trunk/conf
Red5 server jar was not found, using fallback.
URL list: [file:/home/yuvraj/Documents/RED5/red5%20java%20code%20all/java/server/trunk/red5.jar]
Bootstrap exception: null
Bootstrap exit
java.lang.NullPointerException
at org.red5.classloading.ClassLoaderBuilder.build(ClassLoaderBuilder.java:172)
at org.red5.classloading.ClassLoaderBuilder.build(ClassLoaderBuilder.java:96)
at org.red5.server.Bootstrap.bootStrap(Bootstrap.java:117)
at org.red5.server.Bootstrap.main(Bootstrap.java:48)
I couldn't find conf directory neither in /home/yuvraj/Documents/RED5/red5 java code all/java/server/trunk/ nor in /Red5_server/bin while setting classpath in java debug.
If you followed step by step the guide, you are probably using the 1.0.2 RC4.
Try this now:
Extract the red5-server-1.0.2-RC4.zip from the target folder to a custom folder
(I have it in c:\red5-server-1.0.2-RC4 )
Copy red5.jar and bootstrap.jar in the place you extracted red5. (In my case c:\red5-server-1.0.2-RC4\ )
Repeat the step 7 in the Guide and be carefull at point L.
conf directory is in \red5-server-1.0.2-RC4\
From the output you've shown, I'd assume you're missing the lib directory and its contents. This wiki link should help: https://code.google.com/p/red5/wiki/ServerWontStart#Bootstrap_exception

Categories

Resources