Quantcast
Channel: Java mon amour
Viewing all 1124 articles
Browse latest View live

Singleton Timer in WebLogic


Referencing a WorkManager (ExecutorService) in a Web module or EJB module or at App level

$
0
0

No shared spaces configured

$
0
0


Heap
garbage-first heap total 6291456K, used 1368757K [0x0000000640000000, 0x00000007c0000000, 0x00000007c0000000)
region size 2048K, 97 young (198656K), 9 survivors (18432K)
compacting perm gen total 1048576K, used 230859K [0x00000007c0000000, 0x0000000800000000, 0x0000000800000000)
the space 1048576K, 22% used [0x00000007c0000000, 0x00000007ce172e10, 0x00000007ce173000, 0x0000000800000000)
No shared spaces configured.



this was seen in a

java/jdk170_91-64b/bin/java -XX:-UseBiasedLocking -XX:SurvivorRatio=10 -verbose:gc -XX:+PrintGCTimeStamps -Xms6144m -Xmx6144m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=1024m -XX:MaxPermSize=1024m -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=60


I am not really sure what this "No shared spaces configured" would mean - I could not find any decent documentation on this message. And it doesn't seem to be really an error message, nor something related to G1GC...

Apache http-client, customizing SSLSocketFactory

$
0
0
Here the general documentation on Apache HTTP client https://hc.apache.org/httpcomponents-client-ga/

https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/conn/scheme/SchemeSocketFactory.html


HttpContext context...
SchemeRegistry registry = getSchemeRegistry(context);
Scheme schm = registry.getScheme(target.getSchemeName());
SchemeSocketFactory sf = schm.getSchemeSocketFactory();


This example https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientCustomSSL.java shows

Specifically, it's interesting to look at their default implementation of https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/HostnameVerifier.html which is the org.apache.http.conn.ssl.BrowserCompatHostnameVerifier ( extends org.apache.http.conn.ssl.AbstractVerifier implements org.apache.http.conn.ssl.X509HostnameVerifier extends javax.net.ssl.HostnameVerifier )

The extra methods added by org.apache.http.conn.ssl.X509HostnameVerifier are:


public abstract void verify(String host, SSLSocket ssl)
throws IOException;

public abstract void verify(String host, X509Certificate cert)
throws SSLException;

public abstract void verify(String host, String[] cns, String[] subjectAlts)
throws SSLException;

while the basic javax.net.ssl.HostnameVerifier contains only

verify(String hostname, SSLSession session)


Remember! javax.net.ssl.SSLSocketFactory is an ABSTRACT class.

For use within WebLogic, see http://docs.oracle.com/cd/E12839_01/core.1111/e10043/ohttps.htm#JISEC2046, but the property HTTPClient.defaultHostnameVerifier doesn't seem to work with Apache HTTPClient.

Also another interface exists weblogic.security.SSL.HostnameVerifier

WebLogic network-access-point

$
0
0
If you need to invoke operations (EJB, WS...) on a specific IP different from the main listen address / port of WLS, you can create inside config.xml a network-access-point and give it a mnemonic name like "INT-Channel" :

<network-access-point>
<name>INT-Channel</name>
<protocol>t3s</protocol>
<listen-address>1.2.3.4</listen-address>
<enabled>true</enabled>
<two-way-ssl-enabled>true</two-way-ssl-enabled>
<client-certificate-enforced>true</client-certificate-enforced>
</network-access-point>


and configure your component in your weblogic-ejb-jar.xml with a clause:

<weblogic-enterprise-bean>
<network-access-point>INT-Channel</network-access-point>
</weblogic-enterprise-bean>

see https://docs.oracle.com/cd/E11035_01/wls100/ejb/DDreference-ejb-jar.html#network-access-point

Hacking users in WebLogic

$
0
0
vi $DOMAIN_HOME/security/DefaultAuthenticatorInit.ldift
insert this:


dn: uid=PIPPO,ou=people,ou=@realm@, dc=@domain@
description: Test generated user
objectclass: inetOrgPerson
objectclass: organizationalPerson
objectclass: person
objectclass: top
cn: S107077
sn: S107077
userpassword: {ssha}blablabla
uid: PIPPO
objectclass: wlsUser
wlsMemberOf: cn=Administrators,ou=groups,ou=@realm@,dc=@domain@



PIPPO should become an Administrative user

ssha passwords (ssha being a variant of SHA1) can be generated with openssh http://www.openldap.org/faq/data/cache/347.html or with Python/WLST

BEA-090171 and BEA-090169

$
0
0
in WebLogic there are 2 messages helping us identify the identity and trust store used :
BEA-090171 Loading the identity certificate and private key stored under the alias client ....

BEA-090169 Loading trusted certificates from the JKS file store

This flag is useful to trace: -Dweblogic.security.SSL.verbose=true -Djavax.net.debug=all
Check also the "ssl" element in config.xml:
<ssl>
<use-java>true</use-java>
<enabled>true</enabled>
<ciphersuite>TLS_RSA_WITH_AES_256_CBC_SHA</ciphersuite>
<ciphersuite>TLS_RSA_WITH_AES_128_CBC_SHA</ciphersuite>
<ciphersuite>TLS_RSA_WITH_RC4_128_SHA</ciphersuite>
<ciphersuite>TLS_RSA_WITH_3DES_EDE_CBC_SHA</ciphersuite>
<hostname-verifier>com.pierre.HostNameVerifier</hostname-verifier>
<hostname-verification-ignored>false</hostname-verification-ignored>
<export-key-lifespan>500</export-key-lifespan>
<client-certificate-enforced>true</client-certificate-enforced>
<listen-port>33641</listen-port>
<two-way-ssl-enabled>true</two-way-ssl-enabled>
<server-private-key-alias>some.certificate.alias</server-private-key-alias>
<server-private-key-pass-phrase-encrypted>{AES}blablabla=</server-private-key-pass-phrase-encrypted>
<ssl-rejection-logging-enabled>true</ssl-rejection-logging-enabled>
<inbound-certificate-validation>BuiltinSSLValidationAndCertPathValidators</inbound-certificate-validation>
<outbound-certificate-validation>BuiltinSSLValidationOnly</outbound-certificate-validation>
<jsse-enabled>true</jsse-enabled>
</ssl>




SSLMBean.ServerPrivateKeyAlias https://docs.oracle.com/cd/E13222_01/wls/docs100/schemaref/security/http.www.bea.com.ns.weblogic.920.domain/types/ssltype.server-private-key-alias.html

ORA-01031: insufficient privileges creating a JDBCStore

$
0
0


<Jun 8, 2016 9:12:41 AM CEST> <Error> <Store> <BEA-280072> <JDBC store "PIPPOJDBCStore" failed to open table "PIPPO_myhostname_WLStore".
weblogic.store.io.jdbc.JDBCStoreException: [Store:280065][Store:280068]JDBC store failed to initialize. It did not find its database table and failed trying to create a new empty table using the commands in file "/weblogic/store/io/jdbc/ddl/oracle.ddl". (server="PIPPO_myhostname" store="PIPPOJDBCStore" table="PIPPO_myhostname_WLStore"):(Linked Cause, "java.sql.SQLSyntaxErrorException: ORA-01031: insufficient privileges
")
at weblogic.store.io.jdbc.JDBCStoreIO.createTable(JDBCStoreIO.java:881)
at weblogic.store.io.jdbc.JDBCStoreIO.open(JDBCStoreIO.java:538)
at weblogic.store.internal.PersistentStoreImpl.recoverStoreConnections(PersistentStoreImpl.java:476)
at weblogic.store.internal.PersistentStoreImpl.open(PersistentStoreImpl.java:453)
at weblogic.store.admin.AdminHandler.activate(AdminHandler.java:129)
at weblogic.store.admin.JDBCAdminHandler.activate(JDBCAdminHandler.java:73)
at weblogic.management.utils.GenericManagedDeployment.activate(GenericManagedDeployment.java:158)
at weblogic.management.utils.GenericDeploymentManager.activate(GenericDeploymentManager.java:184)
at weblogic.management.utils.GenericManagedService.activateDeployment(GenericManagedService.java:211)
at weblogic.management.utils.GenericServiceManager.activateDeployment(GenericServiceManager.java:131)
at weblogic.management.internal.DeploymentHandlerHome.invokeHandlers(DeploymentHandlerHome.java:823)
at weblogic.management.internal.DeploymentHandlerHome.activateInitialDeployments(DeploymentHandlerHome.java:666)
at weblogic.management.internal.DeploymentHandlerHome.activateInitialDeployments(DeploymentHandlerHome.java:627)
at weblogic.management.deploy.internal.DeploymentAdapter$2.doPrepare(DeploymentAdapter.java:101)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:211)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:119)
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

Caused By: java.sql.SQLSyntaxErrorException: ORA-01031: insufficient privileges

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1059)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:30)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:931)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1150)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1792)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1745)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:334)
at weblogic.jdbc.wrapper.Statement.execute(Statement.java:490)
at weblogic.store.io.jdbc.ReservedConnection.executeDDLString(ReservedConnection.java:1169)
at weblogic.store.io.jdbc.ReservedConnection.executeDDLStream(ReservedConnection.java:1141)
at weblogic.store.io.jdbc.JDBCStoreIO.createTable(JDBCStoreIO.java:870)
at weblogic.store.io.jdbc.JDBCStoreIO.open(JDBCStoreIO.java:538)
at weblogic.store.internal.PersistentStoreImpl.recoverStoreConnections(PersistentStoreImpl.java:476)
at weblogic.store.internal.PersistentStoreImpl.open(PersistentStoreImpl.java:453)
at weblogic.store.admin.AdminHandler.activate(AdminHandler.java:129)
at weblogic.store.admin.JDBCAdminHandler.activate(JDBCAdminHandler.java:73)
at weblogic.management.utils.GenericManagedDeployment.activate(GenericManagedDeployment.java:158)
at weblogic.management.utils.GenericDeploymentManager.activate(GenericDeploymentManager.java:184)
at weblogic.management.utils.GenericManagedService.activateDeployment(GenericManagedService.java:211)
at weblogic.management.utils.GenericServiceManager.activateDeployment(GenericServiceManager.java:131)
at weblogic.management.internal.DeploymentHandlerHome.invokeHandlers(DeploymentHandlerHome.java:823)
at weblogic.management.internal.DeploymentHandlerHome.activateInitialDeployments(DeploymentHandlerHome.java:666)
at weblogic.management.internal.DeploymentHandlerHome.activateInitialDeployments(DeploymentHandlerHome.java:627)
at weblogic.management.deploy.internal.DeploymentAdapter$2.doPrepare(DeploymentAdapter.java:101)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:211)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:119)
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
>




in com.bea.core.store.jdbc_4.0.0.0.jar you find the \weblogic\store\io\jdbc\ddl\oracle.ddl file


# WebLogic JDBC Store DDL for Oracle
# Copyright (c) 2003 by BEA, Inc., All Rights Reserved

CREATE TABLE $TABLE (
id int not null primary key,
type int not null,
handle int not null,
record long raw not null
);



The configuration in config.xml is:



<jms-server>
<name>puppo_PlatformJMSserver</name>
<target>pippo_myhostname</target>
<persistent-store>PUPPOJDBCStore</persistent-store>
<temporary-template-resource xsi:nil="true"></temporary-template-resource>
<temporary-template-name xsi:nil="true"></temporary-template-name>
</jms-server>


<jms-system-resource>
<name>PUPPOqueue</name>
<target>pippo_myhostname</target>
<sub-deployment>
<name>PUPPOqueuesubdeployment</name>
<target>puppo_PlatformJMSserver</target>
</sub-deployment>
<descriptor-file-name>jms/PUPPOqueue-jms.xml</descriptor-file-name>
</jms-system-resource>

<jdbc-store>
<name>PUPPOJDBCStore</name>
<prefix-name>PIPPO_myhostname_</prefix-name>
<data-source>JDBCStoreDS</data-source>
<target>pippo_myhostname</target>
</jdbc-store>




The whole JDBCStore story is documented here http://docs.oracle.com/cd/E12840_01/wls/docs103/config_wls/store.html#wp1143086

So the solution is that either the DBA grant the user associated to the JDBCStoreDS the right to create tables, or they create the table themselves using the DDL above...

XAER_NOTA : The XID is not valid

$
0
0
If you get this error, most likely you need to tune your transaction timeoutS (there are many!)

Look for Oracle Support documents "Recommended Timeout Configuration When Using an External Transaction Processing Monitor and XA with Oracle (Doc ID 338880.1)" and for "WebLogic Server: Getting "XAER_NOTA : The XID is not valid" Exception with XA Datasource (Doc ID 1352715.1)"

The golden rule is "global transaction timeout < session timeout < distributed_lock_timeout", so check the value of the DB "distributed_lock_timeout" value.

See also http://www.javamonamour.org/2011/09/pending-xa-transactions-on-oracle-db.html and http://www.javamonamour.org/2015/10/ora-24756-transaction-does-not-exist.html

java.lang.OutOfMemoryError: GC overhead limit exceeded at java.lang.Class.getDeclaredMethods0

$
0
0

Root cause of ServletException.
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2532)
at java.lang.Class.getDeclaredMethod(Class.java:1975)
at java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1437)
at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:51)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:450)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.(ObjectStreamClass.java:425)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:322)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1115)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1535)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1413)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1159)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:329)
at weblogic.jms.common.ObjectMessageImpl.setObject(ObjectMessageImpl.java:158)
at weblogic.jms.common.ObjectMessageImpl.setObject(ObjectMessageImpl.java:133)


"From your write-up, it appears you've set up a use case where the application attempts to operate on multiple large objects in parallel. The JVM is simply running out of heap. It looks the same thing would regardless of whether the large objects were JMS messages, or some other type of object... Some ideas: (A) free up JVM memory - possibly by tuning paging (see the JMS chapter of the Performance and Tuning Guide), (B) reduce the size of the async message pipe-line (search for "MessagesMaximum") in the same guide, (C) increase JVM memory, (D) see if its possible to break each large object up into multiple smaller objects/messages, but perhaps mostly (E) don't expect to be able to have multiple threads each operate on a seperate very large object concurrently - each object necessarily consumes memory while it is being accessed - strongly consider reducing the number of concurrent threads as per the MDB chapter of the Performance and Tuning guide. Tom "
(great Tom, Tom for president)
https://community.oracle.com/thread/1774008?tstart=0
http://docs.oracle.com/cd/E15523_01/web.1111/e13814/jmstuning.htm#CHDHIHGH
How to override serialization mechanisms http://www.oracle.com/technetwork/articles/java/javaserial-1536170.html

BUT: there could be an issue in the JDK ( see OpenJDK story here https://bugs.openjdk.java.net/browse/JDK-8065563 ) so you might just add more heap and restart and ignore the issue.

really cool way to determine which Threads are consuming more CPU

How to educate yourself to be a Java Performance Engineer

$
0
0

Learning Java Security and JCA

$
0
0

JVM Parameters made easy

$
0
0
I have dreaming for many years of setting up such a tool:
http://jvmmemory.com/
to provide a guided wizard to configure all aspects of JVM.... good to see that it's already there! Great job!

EJB Timer stops working in WLS 12.1.3 after an exception occurs

$
0
0
On Version: WebLogic Server 12.1.3.0.0, Java 1.7.0_51


package com.pierre.timertest;

import javax.ejb.Schedule;
import javax.ejb.Stateless;
import javax.ejb.Timer;

@Stateless
public class TimerTestEJB {
public static int count = 0;

/**
* Default constructor.
*/
public TimerTestEJB() {
// TODO Auto-generated constructor stub
}

@SuppressWarnings("unused")
@Schedule(second="*/10", minute="*", hour="*", dayOfWeek="*",
dayOfMonth="*", month="*", year="*", info="MyTimer")
private void scheduledTimeout(final Timer t) {
count++;
System.out.println("@Schedule called at: " + new java.util.Date() + " count=" + count);
if (count == 5) {
System.out.println("@Schedule count = 5, throwing Exception");
throw new Error("@Schedule count = 5");
}
}
}



This funnily will still work for count=6, then stop.

Luckily the bug has been fixed (god bless oracle engineers), see

Oracle WebLogic Server Patch Set Update 12.1.3.0.160719 Fixed Bugs List (Doc ID 2162294.1)

19689036 12.1.3.0.160719 Timer EJB will stop when timer expiration is success and previous timer expiration is failed.

Patch 19689036: NON-PERSISTENT CALENDAR-BASED TIMER IS CANCELED IF CALLBACK METHOD THROWS SYSTEM

In reality even PERSISTENT timers fail...in fact by default @Schedule creates a persistent timer, and also adding persistent=true doesn't fix the issue.
I download p19689036_121300_Generic.zip, extract the weblogic\ejb\container\timer\TimerImpl.class, put in a JAR that I prepend to the WLS classpath, and now the timer keeps working even after the Error occurs.... awesome ! (PS I am too lazy to properly apply the patch with opatch...)


Here http://docs.oracle.com/cd/E14571_01/web.1111/e13719/implementing.htm#EJBPG213 they mention: weblogic.ejb.WLTimerInfo (there is a maxRetryAttempts) and "Configuring Automatic Retry of Container-Managed Transactions" ... this could keep you going even without applying the patch...


SSL TLS renegotiation, RFC 5746

which Cipher Suites your JVM supports

$
0
0
"SunJSSE supports a large number of ciphersuites" http://docs.oracle.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJSSEProvider
1) WLS 11g (WLS 10.3.6) uses JSSE and runs on Java SE 6
2) JSSE java 6  http://docs.oracle.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJSSEProvider
3) WLS 10.3.6 ciphers: http://docs.oracle.com/cd/E28280_01/web.1111/e13707/ssl.htm#BABBDACC

The classification of the different bits (TLS_DHE_RSA_WITH_AES_128_CBC_SHA) is as follows:
TLS vs SSL
RSA vs ECDH vs ECDHE vs DHE vs KRB5
ECDSA vs RSA
RC4 vs 3DES vs DES vs AES
EDE vs CBC
SHA vs MD5

Set "-Dssl.debug=true -Djavax.net.debug=ssl -Dweblogic.log.StdoutSeverity=Debug" then search for the statement
SSLEngine.setEnabledCipherSuites
to see which Ciphers are actually ENABLED (not only supported).
See also http://stackoverflow.com/questions/10487962/java-cipher-suites
There is a property https.cipherSuites , and a SSLSocket.setEnabledCipherSuites()/SSLEngine.setEnabledCipherSuites() method.

TLS v1.2 support in Java 6

$
0
0
According to Oracle Doc:
JDK 6 release supports TLS v1. See:
http://docs.oracle.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJSSEProvider
JDK 6 supports TLS 1.1 as well since JDK 6u111.
http://www.oracle.com/technetwork/java/javase/overview-156328.html#R160_111
JDK 7 release supports TLS v1, TLS v1.1 and TLS v1.2. See:
https://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.html#SunJSSEProvider

In fact, TLS 1.2 is available in Java 6: "TLS v1.2 is now a TLS protocol option with the release of JDK 6u121" or maybe even in 6u115 b32 (copy and paste issue?)
http://www.oracle.com/technetwork/java/javase/overview-156328.html
enabled with -Djdk.tls.client.protocols="TLSv1.2"

To test if you have TLSv1.2 support:

public class TLSTest {
public static void main(String[] args) throws Exception {
System.out.println("before TLSv1.1");
SSLContext ctx = SSLContext.getInstance("TLSv1.1");
System.out.println("before TLSv1.2");
ctx = SSLContext.getInstance("TLSv1.2");
System.out.println("after");
}

}

and run with
java -Djdk.tls.client.protocols="TLSv1.1,TLSv1.2" TLSTest

if you get "Exception in thread "main" java.security.NoSuchAlgorithmException: TLSv1.2 SSLContext not available" then you are screwed.

How to view your JVM default settings

$
0
0


cat Test.java

public class Test {
public static void main(String[] args) {
for (;;) {
}

}

}


javac Test.java
java -XX:+PrintCommandLineFlags Test
you should get something like this:
-XX:InitialHeapSize=67108864 -XX:MaxHeapSize=1073741824 -XX:+PrintCommandLineFlags -XX:+UseParallelGC

WindowBuilder to build Swing client in Java

$
0
0
If you think Swing is bad, what about the endless mess that is Web UI development.... so we chose the lesser evil.... anyway UI technologies are one of the most Epic Failures in IT history, for they all lack a really stable mathematical model behind them.
Installation instructions: http://download.eclipse.org/windowbuilder/WB/integration/4.4/
In fact it took me a while to discover that the "update site URL" is the same http://download.eclipse.org/windowbuilder/WB/integration/4.4/ (sorry Eclipse for being so dumb... if I were smart I would not be using Eclipse in the first place)
After you install, you discover that now you have 2 new Perspectives, WindowBuilder Palette and Structure. You can live without them.
After a LOT of clicks I discover that the latest doc is here . I love Eclipse, it turns life in a treasure hunt game.
Anyway using the WindowBuilder is relatively simple and it seems to fulfill its promise of two-way engineering (edit the code, and see the result in the design view).
Viewing all 1124 articles
Browse latest View live