Cannot link tomcat-native library with Tomcat 9 - java

I am trying to link tomcat native libraries with my tomcat 9 server in a CentOS machine. In order to do so, I have installed APR version v1.6.5, openssl v1.1.1 and then installed tomcat-native v1.2.19 with apr and openssl. I am passing the library path of libtomcatnative-1.so to tomcat through command line option -Djava.library.path=LIB_PATH_OF_TOMCAT_NATIVE. The library got loaded but when i use the native method SSL.version(), its throwing the following exception. What could be the reason?
""com.test.myservice.boot.ObjectStoreService"" ""start"" ""WARNING"" ""06-01-2019 10:55:33:108"" ""62"" ""Cannot load library"" ""java.lang.UnsatisfiedLinkError: org.apache.tomcat.jni.SSL.version()I
at org.apache.tomcat.jni.SSL.version(Native Method)
at org.apache.tomcat.jni.SSL.<clinit>(SSL.java:80)
at com.test.myservice.boot.ObjectStoreService.start(ObjectStoreService.java:59)

Related

Unable to install TomCat on Eclipse

Started using Eclipse a week ago and today while i was creating a new server i got this error
Tomcat Installation Error
Error occurred installing server: https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.20/bin/apache-tomcat-10.0.20.zip
https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.20/bin/apache-tomcat-10.0.20.zip
This is bug 580174, which is using a download URL for 10.0.20 that expired once Apache released Tomcat 10.0.21. You can manually download and unzip https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.22/bin/apache-tomcat-10.0.22.zip and use the directory it creates as the installation's location.
This will be fixed in the 2022-09 release.

Deployment issue with IntelliJ when moved to open-jdk 8u212

We recently migrated our systems to open-jdk from oracle jdk. When I tried deploying my war application, Facing some issues with the same.
C:\Softwares\apache-tomcat-8.0.24\bin\catalina.bat run
[2019-06-14 05:19:12,449] Artifact expresso:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\Rohit.Bansal.IntelliJIdea2019.1\system\tomcat\Unnamed_expresso_3"
Using CATALINA_HOME: "C:\Softwares\apache-tomcat-8.0.24"
Using CATALINA_TMPDIR: "C:\Users\Rohit.Bansal.IntelliJIdea2019.1\system\tomcat\Unnamed_expresso_3\temp"
Using JRE_HOME: "C:\Program Files\AdoptOpenJDK\jdk-8.0.212.04-openj9"
Using CLASSPATH: "C:\Softwares\apache-tomcat-8.0.24\bin\bootstrap.jar;C:\Softwares\apache-tomcat-8.0.24\bin\tomcat-juli.jar"
port = 81
Error: Password file read access must be restricted:
C:\Users\Rohit.Bansal\.IntelliJIdea2019.1\system\tomcat\Unnamed_expresso_3\jmxremote.password
sun.management.AgentConfigurationError
at sun.management.jmxremote.ConnectorBootstrap.checkPasswordFile(ConnectorBootstrap.java:577)
at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:426)
at sun.management.Agent.startAgent(Agent.java:262)
at sun.management.Agent.startAgent(Agent.java:452)
at java.lang.System.startSNMPAgent(Native Method)
at java.lang.Thread.completeInitialization(Thread.java:168)
at java.lang.J9VMInternals.completeInitialization(J9VMInternals.java:74)
Exception in thread "main" java/lang/RuntimeException: sun.management.AgentConfigurationError
at sun/management/Agent.error (Agent.java:526)
at sun/management/Agent.startAgent (Agent.java:269)
at sun/management/Agent.startAgent (Agent.java:452)
at java/lang/System.startSNMPAgent (NativeMethod:4294967295)
at java/lang/Thread.completeInitialization (Thread.java:168)
at java/lang/J9VMInternals.completeInitialization (J9VMInternals.java:74)
Disconnected from server
I encountered the same issue here: debug a Webapp in Tomcat from IntelliJ, after updating AdoptOpenJDK to jdk-8.0.212.04-openj9 under Windows (in my case Windows 7).
My solution was to add the following parameter to the VM Options of my run config:
-Dcom.sun.management.jmxremote.authenticate=false
Now it works as before.
It was somewhat difficult for me to find references to the problem, as in my case the error message was in German (cited here to augment the chances to get a result for other people searching for the German version):
Fehler: Lesezugriff auf Kennwortdatei muss eingeschränkt werden
Obviously, the chances to get meaningful results are somewhat lower. I have then changed the language to en by setting the VM Option -Duser.language=en.
I haven't found a central location to set these parameters, but what probably comes closest is to set the parameters in the template of the local tomcat run configuration.

JDBC with MSSQL on tomcat7 catalina

I am trying to configure activiti to communicate ms-sql 2014 with windows authentication instead of with username/password in connection url.
What i have done ?
downloaded JDBC Driver, put sqljdbc4-3-0.jar in JAVA_HOME and in the web-info\lib
put sqljdbc_auth.dll (64bit) in C:\Windows\System32
set integrated security in db.properties as following:
db.properties (C:\Workflow\apache-tomcat-7.0.62\webapps\activiti-explorer\WEB-INF\classes):
db=mssql
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://127.0.0.1:1433;databaseName=activiti;integratedSecurity=true;
When using regular authentication (I remove the integratedSecurity=true and add user=XXX and password=XXX it works!)
When I open log the last line is:
DEBUG org.springframework.jdbc.datasource.SimpleDriverDataSource: Creating new JDBC Driver Connection to [jdbc:sqlserver://localhost;databaseName=activiti;integratedSecurity=true;]
Then the java application shutsdown and i see hs_err_pid4232.log as attached with exception:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000061a3cf13, pid=4232, tid=8080
What can cause this not to work ?
I want thinking maybe it did not load the DLL/JARS it should be in order to use JDBC driver ? the sql server config looks like this:
The log of process crush is at: http://pastebin.com/xpW5yvEP
This error screams "trouble with the authentication dll". Try these steps:
Download latest sqljdbc, unzip it locally from here: https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
put the .jar in your classpath and the .dll in your library path. Try using a "real" path by adding -Djava.library.path=PATH/TO/DLL into your startup.
run java -fullversion to make sure you have the right .dll (32 bit vs 64 bit) installed there.
run program again.

Weblogic upgrade wizard - security provider

I am upgrading weblogic 10.3.5 to 12.1.1, and to d so, I am using weblogic upgrade wizard.
I started with upgrading security providers using command - java -classpath /localdata/weblogic/server/lib/weblogic.jar weblogic.Upgrade -type securityproviders
But it displays "Upgrading old security providers to new 10.3 providers", while I am running it from weblogic 12.1.1 and want to upgrade to this version.
Logs printed are :
Calling Wizard framework for upgrade: args2: [-mode=gui, -file=wcf/plugin_gui_wizard.xml, -log=stdout, -p:plugin:plugin.executionPlan.file=weblogic/upgrade/upgradesecurityproviders/execplan.xml, -p:plugin:I18N_PLUGIN=weblogic/upgrade/i18n_upgrade, -p:plugin:TARGET_VERSION=12.1.1.0]
I cross verified, on which version I am running upgrade wizard using java -classpath /localdata/weblogic/server/lib/weblogic.jar weblogic.version and it shows,
WebLogic Server 12.1.1.0 Wed Dec 7 08:40:57 PST 2011 1445491
Snapshot is :
And snapshot from doc provided by Oracle (where it shows 12.1 wizard) is :
Note : If I proceed and select source directory as 10.3 mbeantypes and destination directory as 12.1 mbeantypes, wizard shows error as below for all jars (not showing all line) :
Not upgrading commo.dtd because either this is an out-of-the-box Oracle security provider JAR or this security provider JAR is already upgraded or this is not a valid archive file (may not be a .jar).
No security provider JARs have been upgraded.
and similar for other jars too.
Any idea what I would have missed? Am i following wrong approach?

Weird problem using sun.security.pkcs11.SunPKCS11: The specified procedure could not be found?

I'm developing this application to be used speceifically with Firefox (it's for internal use). Basically, we're using the sun.security stuff to read Firefox's KeyStore and sign data with the certs we get.
I've tested this on several machines and the results are varying, I can't seem to pinpoint the reason.
I've tested it on the latest ubuntu release, Firefox 3.6.13, using Java version 1.6.0_22, it works there. I also have a Windows XP laptop with the same Firefox version using Java version 1.6.0_17, where it works as well.
There are 2 other Windows XP laptops that it will not work on, giving the same error. They're running the same version of Firefox and using java version 1.6.0_17.
The error is:
java.security.ProviderException: Could not initialize NSS
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:183)
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:86)
at SignedMessage.SigningApplet.initializeCrypto(SigningApplet.java:327)
at SignedMessage.SigningApplet.init(SigningApplet.java:84)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: The specified procedure could not be found.
at sun.security.pkcs11.Secmod.nssLoadLibrary(Native Method)
at sun.security.pkcs11.Secmod.initialize(Secmod.java:186)
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:179)
... 5 more
Exception: java.security.ProviderException: Could not initialize NSS
From what I can tell it can't find the native nssLoadLibrary routine? The configuration file is pointing it to the Firefox install directory (where it can grab the nss3.dll or libnss3.so file). It does this across all pc's and all the paths in the configuration seem to be valid.
A sample config file, for what it's worth:
name=NSS
nssDbMode=readOnly
nssModule=keystore
nssSecmodDirectory="C:\\Documents and Settings\\user\\Application Data\\Mozilla\\firefox\\Profiles/8bzd2qqm.default"
nssLibraryDirectory=C:\Program Files\Mozilla Firefox
I was hoping someone would have a clue, or maybe some tips on getting further with debugging. I'm at a loss here.
I'm likely much too late for this to be of use to you, but I was having similar problems, and adding dist\WINXXX_DBG.OBJ\lib to my PATH resolved this issue.
Quick answer: Use the x86 jdk not the x64 jdk with NSS and JSS
Quick test against a NSS certificate database:
keytool -list -v -storetype pkcs11 -providerClass sun.security.pkcs11.SunPKCS11 -providerArg NSS_CONFIG_FIPS
where NSS_CONFIG_FIPS is the path to a config file pointing to an NSS database. This command will fail with a stack trace that matches the questioners error if it is a JDK issue and succeed if the JDK is configured properly (and if the config file is correct)
Note that my stack trace included the message:
Caused by: java.io.IOException: %1 is not a valid Win32 application.
I ran dumpbin /headers on the NSS dlls and found that the Mozilla built binaries are all 32 bit. I installed the x86 jdk and repointed JAVA_HOME. Everything began working.
To Vivek's point, NSS and the accompanying executables are very sensitive to the presence of the libraries. Be sure all of the .dll, .lib, and .chk files are present on the path. In particular, modutil.exe will fail certain commands without the chk files and the error messages are not helpful. Your NSS lib folder will need to include the NSS and NSPR lib folders, the jss4.dll and jss4.lib files, and the jss4.jar.
Also note that if you build NSS yourself, the libaries will not be signed with an approved code signing cert which will cause problems with JCA.

Categories

Resources