I try to send a push notification from a java application to an iphone. there is the source code :
PayLoad payLoad = new PayLoad();
payLoad.addAlert("My alert message");
payLoad.addBadge(45);
payLoad.addSound("default");
PushNotificationManager pushManager = PushNotificationManager.getInstance();
pushManager.addDevice("iPhone", "f4201f5d8278fe39545349d0868a24a3b60ed732");
log.warn("Initializing connectiong with APNS...");
// Connect to APNs
pushManager.initializeConnection(HOST, PORT,
"/etc/Certificates.p12", "password",
SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
Device client = pushManager.getDevice("iPhone");
// Send Push
log.warn("Sending push notification...");
PushNotificationManager.getInstance().sendNotification(client, payLoad);
I receive an exception in the line :
pushManager.initializeConnection(HOST, PORT,
"/etc/Certificates.p12", "password",
SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
Here is the exception :
java.io.IOException: failed to decrypt safe contents entry: java.io.IOException: getSecretKey failed: PBE SecretKeyFactory not available
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(Unknown Source)
at java.security.KeyStore.load(Unknown Source)
at com.anthil.apns.service.ExtractFile.main(ExtractFile.java)
Caused by: java.io.IOException: getSecretKey failed: PBE SecretKeyFactory not available
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.getPBEKey(Unknown Source)
... 3 more
Caused by: java.security.NoSuchAlgorithmException: PBE SecretKeyFactory not available
at javax.crypto.SecretKeyFactory.(DashoA13*..)
at javax.crypto.SecretKeyFactory.getInstance(DashoA13*..)
... 4 more
can any one help me with this ?
I have recently encountered the same exception. It turned out to occur only when I ran my code through Eclipse (version 3.7.0 Indigo), using the new Sun JDK 1.7.0. Running the code either outside of Eclipse, or using a JDK 1.6.x fixed the problem for me.
I had a similar problem that was resolved by removing the '-Djava.ext.dirs' flag from my java command. See: http://www.scottmcmaster365.com/2009/03/perils-of-abusing-javaextdirs-property.html
Btw, from the code you provided, you seem to be using an old version of JavaPNS (1.6?). You might want to upgrade to the latest version (2.0 public, or even the latest 2.1-level build) from http://code.google.com/p/javapns/, as you will get MANY reliability improvements and you will be able to push notifications with a single line of code instead of all these "complicated" steps.
Related
After upgrading to JDK 11 from JDK 8 and MQ 9.2.0.5 (from 9.2.0.4), i'm getting the below error when trying to open JMS connection.
I'm running on WLS 14.
I also upgraded allclient.jar to 9.2.0.5.
I tried running it with previous MQ (9.2.0.4) which worked fine with java 8, i get the same issue.
Same code works fine with MQ 9.2.0.4, JDK 8 and WLS 12.
I verified that method exists in jar and verified no other versions of allclient jars exists.
com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9546: Error return code
received.
[1=java.lang.NoSuchMethodException[com.ibm.mq.jmqi.remote.api.RemoteFAP.(com.ibm.mq.jmqi.JmqiEnvironment,
int)],3=Class.getConstructor0]
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:857)
at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:702)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8437)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7815)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:322)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:242)
at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6026)
at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6086)
at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.doCreateConnection(UserCredentialsConnectionFactoryAdapter.java:188)
at . Caused by: java.lang.NoSuchMethodException: com.ibm.mq.jmqi.remote.api.RemoteFAP.(com.ibm.mq.jmqi.JmqiEnvironment,
int)
at java.base/java.lang.Class.getConstructor0(Class.java:3349)
at java.base/java.lang.Class.getConstructor(Class.java:2151)
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:764)
Remove if you have com.ibm.* related packages in prefer-application-packages section in weblogic.xml.
I just ran a couple of Java/JMS applications using OpenJDK 11 and they ran fine. I agree with Doug Grove that you probably have a mismatch of MQ JAR files.
Add the following line to your code and then update your question with the output:
System.out.println("java.class.path="+System.getProperty("java.class.path"));
If you want to get fancy then you can do:
if (null != System.getProperty("java.class.path"))
{
if (System.getProperty("os.name").startsWith("Windows"))
System.out.println("java.class.path=\n"+(System.getProperty("java.class.path")).replace(';', '\n'));
else
System.out.println("java.class.path\n="+(System.getProperty("java.class.path")).replace(':', '\n'));
}
I am following CodenameOne Hello World Tutorial.
My setup is Windows 10, Oracle JDK 11 and Netbeans 12.2.
I have registered in CodenameOne to get an account. I can run the app in simulator, however when I send a an Android or Windows UWP build to cloud I get a SSL Handshake Exception.
I have reinstalled Netbeans and CodenameOne but the issue still persists. I noticed this line in the trace:
Sending build to account: null
I can login successfully from CodenameOne plugin but account value is always null.
Trace log below.
Any idea what could be wrong?
Thanks
build-for-windows-device:
Your build size is: 2kb
Sending build request to the server, notice that the build might take a while to complete!
Sending build to account: null
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:128)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:279)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:181)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1356)
at java.base/sun.net.www.protocol.http.HttpURLConnection$8.run(HttpURLConnection.java:1323)
at java.base/sun.net.www.protocol.http.HttpURLConnection$8.run(HttpURLConnection.java:1321)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:793)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1320)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:241)
at com.codename1.build.client.BuildProcess.sendS3Build(BuildProcess.java:460)
at com.codename1.build.client.BuildProcess.sendRequestToServer(BuildProcess.java:491)
at com.codename1.build.client.CodeNameOneBuildTask.execute(CodeNameOneBuildTask.java:550)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1254)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:261)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:574)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:123)
C:\Projects\NetBeans\CN1\CodenameOne\build.xml:617: Error in server build process
BUILD FAILED (total time: 4 seconds)
I was running Netbeans with Java11, seems that CodenameOne works with Java 8.
I changed the netbeans_jdkhome variable from netbeans.conf file to jdk8 and now works fine.
Problem solved.
we are having an issue in one of our corda nodes, everytime we try to restart we see following error:
[1;31mE 08:18:33-0400 [Node thread-1] spi.SqlExceptionHelper.logExceptions - General error: "java.lang.IllegalStateException: This store is closed
Additinoally if I tried to access to node H2 DB in Internet Explorer I get this error message: 90047BVersion mismatch, driver version is "0" but server version is "16"ÿÿÿÿ_¿\org.h2.jdbc.JdbcSQLException: Version mismatch, driver version is "0" but server version is "16" [90047-194] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.server.TcpServerThread.run(TcpServerThread.java:89) at java.lang.Thread.run(Unknown Source)
Any idea about rca of this issue?
Thanks!!
Javier
I just tried to run this queryableState CorDapp samples. The H2 database seems working fine.
I would suggest you check your log to see if there is any error message during the deployNodes process. Just in case, there is something wrong with the java environment.
We are currently using the 2.0.0-M06 snapshot version of the neo4j jdbc driver and are trying to use the latest version available. We found the 2.1.4 version on the maven repository below,
https://m2.neo4j.org/content/repositories/releases/org/neo4j/neo4j-jdbc/
However, while trying to use this we see the below error..
Caused by: java.lang.IllegalStateException: Error during parsing
at org.neo4j.jdbc.rest.StreamingParser$ParserState.nextToken(StreamingParser.java:71)
at org.neo4j.jdbc.rest.StreamingParser.skipTo(StreamingParser.java:313)
at org.neo4j.jdbc.rest.StreamingParser.nextResult(StreamingParser.java:130)
at org.neo4j.jdbc.rest.StreamingParser$2.hasNext(StreamingParser.java:265)
at org.neo4j.jdbc.rest.StreamingParser$2$1.endReached(StreamingParser.java:269)
at org.neo4j.jdbc.rest.StreamingParser$1.hasNext(StreamingParser.java:201)
at org.neo4j.jdbc.IteratorResultSet.hasNext(IteratorResultSet.java:98)
at org.neo4j.jdbc.IteratorResultSet.next(IteratorResultSet.java:63)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.next(NewProxyResultSet.java:2859)
... 92 more
Caused by: java.io.IOException: Stream closed
at sun.nio.cs.StreamDecoder.ensureOpen(StreamDecoder.java:46)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:148)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at org.codehaus.jackson.impl.ReaderBasedParser.loadMore(ReaderBasedParser.java:117)
at org.codehaus.jackson.impl.ReaderBasedParser._skipWSOrEnd(ReaderBasedParser.java:1476)
at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:368)
at org.neo4j.jdbc.rest.StreamingParser$ParserState.nextToken(StreamingParser.java:67)
... 100 more
We found a reference that this is addressed in the 2.2 version of the driver and are therefore trying to download that. Can someone please point us in the right direction in getting this 2.2 binary for the neo4j-jdbc driver? Also, we currently use the neo4j 2.2 version for our db server.
Thx,
NN
I think version 2.2 is not released yet.
You can try to build your own binaries from the source code - https://github.com/neo4j-contrib/neo4j-jdbc
I'm using WSO2 ESB 4.8.1 with JDK 1.7.0_67 x64 on windows 7 x64.
I'm deploying carbon application(.car) using any method:
maven car deploy plugin
web admin console
CarbonAppUploader web service
First deployment succeeds but log file contains:
CarbonAppUploader temp file: C:\Java\WSO2ES~1.1\bin\..\tmp\carbonappsuploads\first-esb_1.0.0.car deletion failed, scheduled deletion on server exit.
Second deployment of same car (name and version) fails with exception in logs (see below)
I Apologize for localized error message but generally it says cant overwrite this file.
If you check, it's actually locked for deletion. Looks like CarbonAppUploader class didn't properly close InputStream.
Strangely enough this bug is not reproducible in unix (centos)
Question to WSO2: do you plan to fix that?
Question to all: Did you meet such bug and how did you solve it?
exception stack trace (partially)
TID: [0] [ESB] [2014-08-18 22:04:58,254] ERROR {org.wso2.carbon.application.upload.CarbonAppUploader} - Error occurred while uploading Carbon App artifacts {org.wso2.carbon.application.upload.CarbonAppUploader}
java.io.FileNotFoundException: C:\Java\WSO2ES~1.1\bin\..\tmp\carbonappsuploads\first-esb_1.0.0.car (Запрошенную операцию нельзя выполнить для файла с открытой пользователем сопоставленной секцией)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
at org.wso2.carbon.application.upload.CarbonAppUploader.writeResource(CarbonAppUploader.java:78)
at org.wso2.carbon.application.upload.CarbonAppUploader.uploadApp(CarbonAppUploader.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
I checked out source code from svn, fixed bug myself. If anybody experiencing same issue, you may download sources and compiled jar from https://wso2.org/jira/browse/ESBJAVA-3272
Hopefully this bug fix will be included in next releases