Friday, September 14, 2012
Glassfish reminder
./asadmin start-domain domain1
./asadmin list-jndi-entries
./asadmin stop-domain
crash Could not start CRaSSHD Failed to register BouncyCastle as the defaut JCE provider
Problem:
I deployed crash.war in JBoss and I’ve the following error : Could not start CRaSSHD
10:22:31,335 INFO [SSHPlugin] Booting SSHD
10:22:32,826 INFO [SecurityUtils] Trying to register BouncyCastle as a JCE provider
10:22:36,861 SEVERE [SecurityUtils] Failed to register BouncyCastle as the defaut JCE provider
10:22:36,862 SEVERE [SSHLifeCycle] Could not start CRaSSHD
java.lang.RuntimeException: Failed to register BouncyCastle as the defaut JCE provider
…
Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC
at javax.crypto.SunJCE_b.a(DashoA13*..)
at javax.crypto.KeyAgreement.getInstance(DashoA13*..)
at org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration.run(SecurityUtils.java:97)
at org.apache.sshd.common.util.SecurityUtils.register(SecurityUtils.java:77)
... 79 more
Caused by: java.util.jar.JarException: Cannot parse jar:file:/opt/jboss/jboss-eap-5.1/jboss-as/server/all/deploy/crash.war!/WEB-INF/lib/bcprov-jdk16-1.46.jar
Solution :
- Download bouncycastle library at http://www.bouncycastle.org/latest_releases.html (For me its bcprov-jdk15on-147.jar and bcprov-ext-jdk15on-147.jar).
- Copy theses files (eg: bcprov-jdk15on-147.jar and bcprov-ext-jdk15on-147.jar) in /path_to_your_jvm/jre/lib/ext. (e.g: /opt/jdk/jdk1.6.0_18/jre/lib/ext)
- vi /path_to_your_jvm/jre/lib/security/java.security and add the following line : security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider
java.security
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.8=sun.security.smartcardio.SunPCSC
security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider
- Restart jboss.
http://www.randombugs.com/java/javalangsecurityexception-jce-authenticate-provider-bc.html
http://nyal.developpez.com/tutoriel/java/bouncycastle/#L1
http://julienviet.com/crash/
I deployed crash.war in JBoss and I’ve the following error : Could not start CRaSSHD
10:22:31,335 INFO [SSHPlugin] Booting SSHD
10:22:32,826 INFO [SecurityUtils] Trying to register BouncyCastle as a JCE provider
10:22:36,861 SEVERE [SecurityUtils] Failed to register BouncyCastle as the defaut JCE provider
10:22:36,862 SEVERE [SSHLifeCycle] Could not start CRaSSHD
java.lang.RuntimeException: Failed to register BouncyCastle as the defaut JCE provider
…
Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC
at javax.crypto.SunJCE_b.a(DashoA13*..)
at javax.crypto.KeyAgreement.getInstance(DashoA13*..)
at org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration.run(SecurityUtils.java:97)
at org.apache.sshd.common.util.SecurityUtils.register(SecurityUtils.java:77)
... 79 more
Caused by: java.util.jar.JarException: Cannot parse jar:file:/opt/jboss/jboss-eap-5.1/jboss-as/server/all/deploy/crash.war!/WEB-INF/lib/bcprov-jdk16-1.46.jar
Solution :
- Download bouncycastle library at http://www.bouncycastle.org/latest_releases.html (For me its bcprov-jdk15on-147.jar and bcprov-ext-jdk15on-147.jar).
- Copy theses files (eg: bcprov-jdk15on-147.jar and bcprov-ext-jdk15on-147.jar) in /path_to_your_jvm/jre/lib/ext. (e.g: /opt/jdk/jdk1.6.0_18/jre/lib/ext)
- vi /path_to_your_jvm/jre/lib/security/java.security and add the following line : security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider
java.security
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.8=sun.security.smartcardio.SunPCSC
security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider
- Restart jboss.
http://www.randombugs.com/java/javalangsecurityexception-jce-authenticate-provider-bc.html
http://nyal.developpez.com/tutoriel/java/bouncycastle/#L1
http://julienviet.com/crash/
Friday, September 7, 2012
Java Puzzle
If you search exercises about JAVA which make think, go on http://wouter.coekaerts.be/2012/puzzle-dreams-solution
There are not easy and interesting exercises.
There are not easy and interesting exercises.
Monday, April 23, 2012
How to apply Checkstyle format automaticaly ?
Problem :
You want to format your code with checkstyle rule with CTRL-ALT-F.
Solution :
Right clic on the project -> Checkstyle -> Create a Formatter
Then go Windows -> Preferences -> Code Style -> Formatter
Next, you just have to select the formatter you have created.
After that, you can make CTRL - ALT - F to format you code
Saturday, April 21, 2012
java 1.8 lambda example
I saw at Devoxx France, a conference about java 1.8 and the use of lambdas by Guillaume Tardif. (http://www.devoxx.com/display/FR12/JDK+8+demo++lambdas+in+Action)
In this article, I will show you an example.You can dowload the jdk here : http://jdk8.java.net/lambda/
To install jdk1.8 on Ubunutu, you can do :
sudo mv ./jdk1.8.0 /usr/lib/jvm/
sudo update-alternatives --install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.8/bin/java” 1
sudo update-alternatives --install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.8/bin/javac” 1
sudo update-alternatives --config java
Then, you just have to choose the jdk.
Note : I have a bug when I use javac because javac -version show me always 1.6 and not 1.8
So to compile, I've done the following :
/usr/lib/jvm/jdk1.8.0/bin/javac Main.java
java Main
Here is my file Main.java:
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
List names = new ArrayList();
names.add("superman");
names.add("batman");
names.forEach( (String s) -> { System.out.println(s);} );
}
}
Then we show on the screen :
superman
batman
An other important point, Java 1.8 should support multiple inheritance !
If you have comment, post it !
Tuesday, April 17, 2012
Devoxx FRANCE
Tomorrow it's the beginning of a great conference.
During 3 days, there will be technical session on JAVA, HTML5, NOSQL, CASSANDRA ... et all new technologies !
Go to the web site to see trend of the moment devoxx
Subscribe to:
Posts (Atom)