Issue in using rsa bsafe 6.1.2 with jmx management on UBuntu - rsa

We have a java application which needs to use RSA BSAFE v6.1.2 as security provider and use jmx to expose few management API. Our application is not able to start, it just hangs, control never comes to Main class containing main(String[] args) method.
On the other hand, if we do not try to use jmx management, then it works fine.
In summary:
Following command just hangs:
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar -server -Dcom.sun.management.jmxremote.port=9003 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false appname.jar
But, following command works fine:
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar -server appname.jar
Do we need any setting changes in java.security file or some where else to ensure that jmx works fine?
thank you for help.
Following is part of output of jstack -l PID. By looking at the stack trace: It seems that following is the rsa related thread that is running for long time.
"main" prio=10 tid=0x00007f64c400a000 nid=0x6d42 runnable [0x00007f64cb18e000]
java.lang.Thread.State: RUNNABLE
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:272)
at sun.security.provider.SeedGenerator$URLSeedGenerator.getSeedBytes(SeedGenerator.java:551)
at sun.security.provider.SeedGenerator.generateSeed(SeedGenerator.java:139)
at sun.security.provider.SecureRandom.engineGenerateSeed(SecureRandom.java:125)
at java.security.SecureRandom.generateSeed(SecureRandom.java:517)
at com.rsa.cryptoj.o.bs.generateSeed(Unknown Source)
at com.rsa.jcm.f.ae.c(Unknown Source)
at com.rsa.jcm.f.ae.b(Unknown Source)
at com.rsa.jcm.f.ae.a(Unknown Source)
at com.rsa.jcm.f.ae.a(Unknown Source)
- locked <0x00000000f6d8fd20> (a com.rsa.jcm.f.ae)
at com.rsa.jcm.f.ho.generateSeed(Unknown Source)
at com.rsa.jcm.f.ko.getSeed(Unknown Source)
- locked <0x00000000f604c1f8> (a java.lang.Class for com.rsa.jcm.f.ko)
at com.rsa.jcm.f.cu.f(Unknown Source)
at com.rsa.jcm.f.cu.m(Unknown Source)
at com.rsa.jcm.f.cu.setAlgorithmParams(Unknown Source)
- locked <0x00000000f6e6c258> (a com.rsa.jcm.f.cu)
at com.rsa.cryptoj.o.cw$b.setAlgorithmParams(Unknown Source)
at com.rsa.cryptoj.o.nt$a.b(Unknown Source)
at com.rsa.cryptoj.o.nt$a.<init>(Unknown Source)
at com.rsa.cryptoj.o.nt$i.<init>(Unknown Source)
at com.rsa.cryptoj.o.ke$152.a(Unknown Source)
at com.rsa.cryptoj.o.kc.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at java.security.SecureRandom.getInstance(SecureRandom.java:276)
at java.security.SecureRandom.getDefaultPRNG(SecureRandom.java:198)
at java.security.SecureRandom.<init>(SecureRandom.java:155)
at java.rmi.server.ObjID.<clinit>(ObjID.java:89)
at sun.rmi.transport.LiveRef.<init>(LiveRef.java:74)
at sun.rmi.server.UnicastServerRef.<init>(UnicastServerRef.java:139)
at sun.management.jmxremote.ConnectorBootstrap$PermanentExporter.exportObject(ConnectorBootstrap.java:187)
at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:116)
at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:95)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:403)
- locked <0x00000000f571e000> (a javax.management.remote.rmi.RMIConnectorServer)
at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:778)
at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:457)
- locked <0x00000000f554b420> (a java.lang.Class for sun.management.jmxremote.ConnectorBootstrap)
at sun.management.Agent.startAgent(Agent.java:260)
at sun.management.Agent.startAgent(Agent.java:456)

I am pretty sure that has nothing to do with JMX. Its about the way the SeedGenerator works under some system (ubuntu) configuration. I am also fighting this issue with a current Droplet (Ubuntu 14_04 with Java 8 and Tomcat 8).
Right now i dont know why we have this issue on this specific DigitalOcean droplet, where other droplets (older ubuntu, older Java) have no problems.
BTW, your package using the SeedGenerator (com.rsa.cryptoj) is causing this. In my situation its a Tomcat SessionIdGenerator which uses the SeedGenerator. And it doesnt hang, it just takes an unbelivable amount of time to create the Seed. At least in my situation. 5 mins and more.
Unfortunately i cant present a solution but people tend to play with java.security file in lib folder of JVM. In detail the paramter "securerandom.source=file:/dev/random"

Related

How to use Charles proxy web interface?

In Charles proxy unable to start/stop recording using web interface. I have enabled the web interface and transparent ssl proxy option. I am able to navigate one level from the home page http://control.charles/ like http://control.charles/recording/ . However, I'm not able to access anything further like http://control.charles/recording/start
It is giving HTTP 404 error message in the browser response. Same thing I tried using curl and found that Charles proxy is throwing out of memory error. I have increased the -Xmx to 2GB in info.plist file and still facing the same.
Exception in thread "com.xk72.proxy.ssl.vTMQ.LajB" java.lang.OutOfMemoryError:
unable to create new native thread at java.lang.Thread.start0(Native Method) at
java.lang.Thread.start(Thread.java:717) at
java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:957) at
java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1378) at
com.xk72.proxy.sJmZ.wIxc.run(Unknown Source) at
java.lang.Thread.run(Thread.java:748) SEVERE
com.xk72.proxy.server.SocketProxyServer SocketProxyServer.run
java.lang.OutOfMemoryError: unable to create new native thread at
java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:717)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:957)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1378) at
com.xk72.util.LajB.DdNM(Unknown Source) at com.xk72.throttle.AqRW.(Unknown Source)
at com.xk72.throttle.WSQr.getInputStream(Unknown Source) at
com.xk72.proxy.http.wDPH.DdNM(Unknown Source) at
com.xk72.proxy.http.CLFr.twLa(Unknown Source) at
com.xk72.proxy.http.CLFr.DdNM(Unknown Source) at
com.xk72.proxy.http.CLFr.DdNM(Unknown Source) at
com.xk72.proxy.sJmZ.wDPH.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at
java.lang.Thread.run(Thread.java:748)
Details: Mac High Sierra - 10.13.6 Jre - 1.8.163 Charles - 4.2.8

Cannot open local storage nexus3/db/config with mode=rw DB name="config"

I am trying to run nexus oss on my windows machine, I tried running nexus service as described here. But I am getting this error, i do not install orientdb i suppose it will come bundle with the nexus package.
Cannot open local storage 'C:/nexus/sonatype-work/nexus3/db/config' with mode=rw
Here is complete log trace of error for reference.
2018-10-27 14:56:48,677+0300 ERROR [FelixStartLevel] *SYSTEM com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage - Exception `12B058F9` in storage `plocal:C:/nexus/sonatype-work/nexus3/db/config`: 2.2.36 (build d3beb772c02098ceaea89779a7afd4b7305d3788, branch 2.2.x)
com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage 'C:/nexus/sonatype-work/nexus3/db/config' with mode=rw
DB name="config"
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:323)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:259)
at org.sonatype.nexus.orient.DatabaseManagerSupport.connect(DatabaseManagerSupport.java:174)
at org.sonatype.nexus.orient.DatabaseInstanceImpl.doStart(DatabaseInstanceImpl.java:56)
at org.sonatype.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:104)
at org.sonatype.goodies.lifecycle.Lifecycles.start(Lifecycles.java:44)
at org.sonatype.nexus.orient.DatabaseManagerSupport.createInstance(DatabaseManagerSupport.java:306)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
at org.sonatype.nexus.orient.DatabaseManagerSupport.instance(DatabaseManagerSupport.java:285)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
at java.util.concurrent.CountedCompleter.exec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doInvoke(Unknown Source)
at java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.forEach(Unknown Source)
at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
at org.sonatype.nexus.orient.restore.RestoreServiceImpl.doStart(RestoreServiceImpl.java:76)
at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:67)
at org.sonatype.nexus.orient.restore.RestoreServiceImpl$$EnhancerByGuice$$2c1dbe4.CGLIB$start$1(<generated>)
at org.sonatype.nexus.orient.restore.RestoreServiceImpl$$EnhancerByGuice$$2c1dbe4$$FastClassByGuice$$23df1cd1.invoke(<generated>)
at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:76)
at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
at org.sonatype.nexus.common.stateguard.StateGuard$TransitionImpl.run(StateGuard.java:193)
at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:56)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:77)
at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:55)
at org.sonatype.nexus.orient.restore.RestoreServiceImpl$$EnhancerByGuice$$2c1dbe4.start(<generated>)
at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:157)
at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:95)
at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:195)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1429)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
at java.lang.Thread.run(Unknown Source)
Caused by: com.orientechnologies.orient.core.exception.OStorageException: File with name 'upgrade_model_versions.pcl' does not exist in storage 'config'
DB name="config"
at com.orientechnologies.orient.core.storage.cache.local.OWOWCache.loadFile(OWOWCache.java:475)
Thanks in advance.
The error means that a "plocal" database can't be opened by multiple JVM at the same time. To fix:
check if there's no process using OrientDB (most of the times a
OrientDB Server is running in the background). Just shutdown that
server and retry
if you need multiple access to the same database, don't use "plocal"
directly, but rather start a server and access to the database by
using "remote" protocol. In this way the server is able to share the
same database with multiple clients.
For more information: https://orientdb.com/docs/last/Troubleshooting.html#error-comorientechnologiesorientcoreexceptionostorageexception-cannot-open-local-storage-tmpdatabasesdemo-with-moderw
Hope it helps
Regards
I had exactly the same issue when I upgraded Nexus from 3.7 to Nexus 3.20. The problem was that I executed the command nexus.exe / before this command nexus.exe /run. This is how I solved the issue:
First uninstalled Nexus 3.20 and installed it again
Executed nexus.exe /run
Created the service nexus.exe
Checked localhost:8081 and the Nexus interface appeared

My Android Thing Raspberry Pi is throwing a javax.net.ssl.SSLException when sending request to Firebase Storage

I'm trying to connect my Raspberry Pi using Android Thing to Firebase Storage. I keep getting the attached exception. The Storage Rules are completely public no auth needed. Has anyone else received this error and found a workaround?
javax.net.ssl.SSLException: Write error: ssl=0x95683f00: I/O error during system call, Broken pipe
at com.android.org.conscrypt.NativeCrypto.SSL_write(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:824)
at com.android.okhttp.okio.Okio$1.write(Okio.java:76)
at com.android.okhttp.okio.AsyncTimeout$1.write(AsyncTimeout.java:155)
at com.android.okhttp.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:176)
at com.android.okhttp.okio.RealBufferedSink.writeUtf8(RealBufferedSink.java:58)
at com.android.okhttp.internal.http.HttpConnection.writeRequest(HttpConnection.java:172)
at com.android.okhttp.internal.http.HttpTransport.writeRequestHeaders(HttpTransport.java:76)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:265)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:457)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:405)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:521)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)
at brv.b(:com.google.android.gms.DynamiteModulesC:1386)
at brv.a(:com.google.android.gms.DynamiteModulesC:269)
at brp.onTransact(:com.google.android.gms.DynamiteModulesC:53)
at android.os.Binder.transact(Binder.java:499)
at com.google.android.gms.internal.zzbrc$zza$zza.zzjN(Unknown Source)
at com.google.android.gms.internal.zzbrf.zza(Unknown Source)
at com.google.android.gms.internal.zzbqw.zza(Unknown Source)
at com.google.android.gms.internal.zzbqw.zzd(Unknown Source)
at com.google.firebase.storage.UploadTask.zzb(Unknown Source)
at com.google.firebase.storage.UploadTask.zzaba(Unknown Source)
at com.google.firebase.storage.UploadTask.run(Unknown Source)
at com.google.firebase.storage.StorageTask$8.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
A few things to check:
1) Make sure that you have network (you likely already do since you're trying to reach Firebase) e.g. 'ifconfig'
2) Make sure that DNS is working e.g. 'ping ...' something
3) Check system time to see if it's synced to current rather than 1970 e.g. 'date'; you can manually set it current as a workaround
If for any of the above reasons that time is not set properly, your SSL cert probably won't work.
See working code in the Doorbell sample here: https://github.com/androidthings/doorbell

MongoDB java driver - massive number of parked threads

In a long run I am seeing massive number of threads getting piled up by MongoDB Java driver (v3.0.3). All these threads are server monitoring threads, all parked waiting:
cluster-ClusterId{value='562233d1b26c940820028340', description='null'}-192.168.0.2:27017
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source)
com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.waitForSignalOrTimeout(DefaultServerMonitor.java:237)
com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.waitForNext(DefaultServerMonitor.java:218)
com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:167)
java.lang.Thread.run(Unknown Source)
Right now there are about 250 of them. I don't think that many threads are needed to monitor a connection to a single database host. I am obviously doing something wrong.., but as far as I can tell we didn't do any setting changes when moved from driver v2 to v3. Could be a bug in driver? Any ideas?
This issue has been fixed in 3.2.2.
https://jira.mongodb.org/browse/JAVA-2074

Play framework 2: Error when trying to start application in production mode

OS: Windows 7 64bit
java version: 1.7.0_17
javac Version: 1.7.0_17
I'm new to Play Framework, basically wanted to get a feel of everything.
There's a sample application called java/helloworld. Haven't changed anything and went on using the "start" command.
[helloworld] $ start
(Starting server. Type Ctrl+D to exit logs, the server will remain in background
)
Error occurred during initialization of VM
java.lang.ExceptionInInitializerError
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at java.lang.System.initializeSystemClass(Unknown Source)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range:
0
at java.lang.String.charAt(Unknown Source)
at java.io.Win32FileSystem.<init>(Unknown Source)
at java.io.WinNTFileSystem.<init>(Unknown Source)
at java.io.FileSystem.getFileSystem(Native Method)
at java.io.File.<clinit>(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at java.lang.System.initializeSystemClass(Unknown Source)
I don't think this is anything to do with Play. It seems like you have encountered this issue, which looks to be a JVM bug on your flavour of Windows.
To run the sample applications in production mode, you may have to proceed as follows:
Run the play stage command (outside the Play console, just on the command line). The stage task is described here
Add this JVM argument to the target\start script generated by the stage task, before then starting the application.
As a workaround add
-Dfile.separator=\/
parameter to play.bat and build.bat.