pki-bot / pki-issues-final

0 stars 0 forks source link

PKCS10Client tool throws java exception NoClassDefFoundError #547

Closed pki-bot closed 4 years ago

pki-bot commented 4 years ago

This issue was migrated from Pagure Issue #549. Originally filed by aakkiang (@aakkiang) on 2013-03-15 18:40:33:


Trying to create a PKCS10 certificate request using PKCS10Client tool, throws java exception.

rpm -q pki-tools

pki-tools-10.0.1-3.20130307T0640zgit0a9dc32.fc18.x86_64

PKCS10Client -p Password -d /tmp/tmp.IXGjjHQwaD/nssdb -a rsa -l 1024 -o /tmp/tmp.IXGjjHQwaD/req1.out -n "CN=test.example.com"

PKCS10Client: token NSS Certificate DB logged in... PKCS10Client: key pair generated. PKCS10Client: pair.getPublic() called. PKCS10Client: CertificationRequestInfo() created. PKCS10Client: CertificationRequest created. PKCS10Client: certRequest not null. PKCS10Client: calling BtoA(). Exception in thread "main" java.lang.NoClassDefFoundError: com/netscape/certsrv/apps/CMS at com.netscape.cmstools.PKCS10Client.main(PKCS10Client.java:291) Caused by: java.lang.ClassNotFoundException: com.netscape.certsrv.apps.CMS at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more

alee suggested a workaround to add the tool path ( CP=/usr/share/java/${PRODUCT}/pki-certsrv.jar:${CP} ) to /usr/bin/PKCS10Client since jars were re-arranged recently.

cat /usr/bin/PKCS10Client | tail -5

############################################################################### CP=/usr/share/java/${PRODUCT}/pki-certsrv.jar:${CP} ${JAVA} ${JAVA_OPTIONS} -cp ${CP} com.netscape.cmstools.${COMMAND} "$@" exit $?

PKCS10Client request throws NullPointerException.

[root@hp-dl shared]# PKCS10Client -p Password -d /tmp/tmp.IXGjjHQwaD/nssdb -a rsa -l 1024 -o /tmp/tmp.IXGjjHQwaD/req1.out -n "CN=test.example.com" PKCS10Client: token NSS Certificate DB logged in... PKCS10Client: key pair generated. PKCS10Client: pair.getPublic() called. PKCS10Client: CertificationRequestInfo() created. PKCS10Client: CertificationRequest created. PKCS10Client: certRequest not null. PKCS10Client: calling BtoA(). PKCS10Client: Exception caught: java.lang.NullPointerException

pki-bot commented 4 years ago

Comment from edewata (@edewata) at 2013-03-15 18:48:03

Recently the CRMFPopClient and PKCS10Client were changed to use CMS.BtoA() or CMS.AtoB(). These methods actually are server-side method because it depends on CMSEngine which doesn't exist on the client side, so the client would fail. They should be replaced with Utils.base64encode() and Utils.base64decode(), respectively.

pki-bot commented 4 years ago

Comment from kaskahn at 2013-03-28 15:36:20

Fixed and pushed to master in 632aa9a012839bde3253ff7a6698797ba83d4658

pki-bot commented 4 years ago

Comment from aakkiang (@aakkiang) at 2017-02-27 14:12:14

Metadata Update from @aakkiang: