Posts Tagged ‘Jonathan Lalou’
Disable “Pointsec Protector Client”
Pointsec Protector Client is an application that blocks USB ports on a PC. This has an interest, especially for lamers who introduce viruses to great companies networks because of their contamined USB keys. But for developpers it’s very painful (unused resources and… other stuff 😉 ). Pointsec Protector Client is installed as “super admin” process: impossible to kill.
Here is the description of this application on its editor website:
Check Point Media Encryption secures sensitive corporate data and blocks incoming malware by encrypting removable media such as USB storage devices, CDs and DVDs and controlling activity (read, write and execute) on ports and devices. All device content is automatically encrypted in the background for a transparent end-user experience. Unique to Check Point, users can access encrypted media securely on unmanaged computers with no client installation. As the only device and port control solution integrated with a single endpoint security agent, Check Point Media Encryption simplifies compliance and reduces administrative overhead. Now supports Windows 7.
To get through Pointsec Protector Client, here is the way:
- you need be admin in your local computer
Start>Control Panel>Administrative tools>Services> Select"Pointsec Protector Client"> stop the service- open Windows Explorer, go to
C:\Program Files, renameCheckPointfolder asXXXCheckPoint - reboot your computer
You should have get rid of Pointsec Protector Client. I think this method should work on most applications started as service by a “super admin”, yet I have not tested.
“Select for update” in Hibernate
Case:
You have to use an equivalent to “select for update” in Hibernate, for instance when you migrate en EJB entity to Hibernate.
Fix:
In your query, use the option LockMode.UPGRADE. For instance, you will have:
[java]sessionFactory.getCurrentSession().load(MyMappedClass.class, myPk, LockMode.UPGRADE);[/java]
Fermeture du proxy de Free.fr
Free.fr a ferme depuis hier son proxy. Jusque la accessible a l’adresse proxy.free.fr:3128, ce proxy etait bien pratique, pour sa disponibilite, sa robustesse, et sa vitesse pour les abonnes de Free.fr, surtout a la “vieille” de l’internet sur modems 56kbps.
Jusqu’a present, aucune explication n’a ete fournie quant a la raison de cette fermeture.
Difference entre Physique et Chimie
Question interessante d’un eleve il y a quelques semaines: quelle est la difference entre la Physique et la Chimie?
Reponse courte: la Chimie etudie les transformations de la matiere elle-meme au niveau de sa composition en especes chimiques, alors que la Physique etudie la matiere sans rapport avec les especes la composant: position, mouvement, temperature, charge, etc.
Plus precisement, en se basant sur un modele satellitaire de Bohr, la Chimie etudie les transformations de la matiere mettant en jeu des modifications sur les couches electroniques externes: reactions chimiques (oxydo-reduction, acido-basiques, etc.), ionisation, etc. On exclut le parametre temperature qui, bien que donnant une mesure du mouvement des electrons des couches externes, concerne en fait tous les electrons, quelle que soit leur couche.
La Physique etudie les autres modifications: deplacement, vitesse, temperature, forme, masse, electricite, fission, etc.: ces dernieres notions ne se limitent pas aux couches electroniques externes mais concernent l’atome, la molecule, ou bien au contraire le noyau.
Neanmoins, plus on s’approche de l'”infiniment petit”, plus les distinctions s’estompent.
java.io.StreamCorruptedException: invalid type code: 31
Context:
Client-server communication over JMS.
Stacktrace:
[java]Caused by: java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is:
java.io.StreamCorruptedException: invalid type code: 31
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:203)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224)
at weblogic.common.internal.RMIBootServiceImpl_921_WLStub.authenticate(Unknown Source)
at weblogic.security.acl.internal.Security$1.run(Security.java:185)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.security.acl.internal.Security.authenticate(Security.java:181)
at weblogic.jndi.WLInitialContextFactoryDelegate.authenticateRemotely(WLInitialContextFactoryDelegate.java:726)
at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:659)[/java]
Explanation – Fix
The client JVM was in version 1.6, the server was in 1.5.
To fix the issue, the client must be run with Java 1.5.
Possibly, the client may laucnh the JVM with the option -Dsun.lang.ClassLoader.allowArraySyntax=true.
javax.naming.ConfigurationException / java.net.MalformedURLException
Context
I have to send JMS messages on queues on clustered servers: t3://firstServer:1234 and t3://secondServer:5678.
The destination queues are retrieved in Spring, thanks to a property like:
[xml]<property name="providerURL" value="t3://firstServer:1234,t3://secondServer:5678"/>[/xml]
Error:
I receive the following error:
[java]javax.naming.ConfigurationException [Root exception is java.net.MalformedURLException: port expected: t3://firstServer:1234,t3://secondServer:5678][/java]
Explanation and fix:
When you send messages on many queues, you must not repeat the protocol (here: t3://)! Fixing the issue is very simple: you have to remove the second t3:// in Spring property:
[xml]<property name="providerURL" value="t3://firstServer:1234,secondServer:5678"/>[/xml]
Spring using multi instances of JndiTemplate
Case
Spring application context file:
[xml]
<bean id="jmsQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jonathan.jms-connection-factory.external"/>
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
<prop key="java.naming.provider.url">
t3://anOtherServer:8521
</prop>
<prop key="java.naming.security.principal">jonathan</prop>
<prop key="java.naming.security.credentials">jonathan</prop>
<prop key="weblogic.jndi.enableDefaultUser">true</prop>
</props>
</property>
</bean>
<bean id="mainJndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
<prop key="java.naming.provider.url">t3://mainServer:1234</prop>
<prop key="java.naming.security.principal">myPrincipal</prop>
<prop key="java.naming.security.credentials">myPassword</prop>
<prop key="weblogic.jndi.enableDefaultUser">false</prop>
</props>
</property>
</bean>
[/xml]
Description
I use two instances of JndiTemplate to send JMS messages on two different queues, on two different Weblogic domains, using two different Ldap directories. When I try to send messages on the second server, it does not work: I get an error because the second server receives credentials that should be sent to the first server.
[Security:090398]Invalid Subject: principals=[...]
Quick fix
Remove the properties weblogic.jndi.enableDefaultUser from within the XML.
Short Tutorial: Migration from EJB Entity to Hibernate
Case
- let’s consider an EJB Bean AnimalBean, linked to a table JL_Animal
- let’s have a human understandable name for the Pojo, let’s say: Animal
- let an EJB entity have following finders:
[java]
* @ejb.finder
* signature = "Collection findByBirthDate(java.lang.Integer birthDate)"
* query = "SELECT OBJECT(o) FROM AnimalBean AS o WHERE o.birthDate = ?1"
*
* @ejb.finder
* signature = "Collection findByCountryAndBirthDate(java.lang.String from,java.lang.Integer birthDate)"
* query = "SELECT OBJECT(o) FROM AnimalBean AS o WHERE o.country = ?1 AND o.birthDate = ?2"[/java]
Read the rest of this entry »
Fake SMTP server in Java
Abstract
You need a fake SMTP server, for any reason: either your application does not deploy without an SMTP, or you need see what mails are sent and their attached files, etc.
Read the rest of this entry »
Default method on interface implementing
Abstract:
Developpers happen to forget to implement concrete classes on creating new implementations. Indeed, IDEs fill methods content with canonical return values, (null for object, 0 for numerics, etc.). Consequently, errors appear only on deployment stage, when it is not on running.
To avoid this, here is the tip I use: raising a default exception. If unit tests are generated, then the exception is raised on development stage, which is better than after one hour compiling / deployment / execution ;-).
Process:
On IntelliJ IDEA, open:
- Project Settings
- File Templates
- Code
- Implemented Method Body
- write:
throw new UnsupportedOperationException("Class Name : ${CLASS_NAME} - Method Name : ${METHOD_NAME}");
- Code
- File Templates