Recent Posts
Archives

Archive for the ‘en-US’ Category

PostHeaderIcon Deploy a JMS destination queue with Spring

Abstract

Case: we have to send JMS messages to a third-party server, using Spring. Of course, we have to discriminate production, UAT and developments environments. We can decide to use one Spring configuration file per environment, but it is complex to maintain.

Here is the way I proceded:

Declare the factory

[xml]<bean id="myJmsQueueConnectionFactory">
<property name="jndiName" value="my.jms.QueueConnectionFactory"/>
<property name="jndiTemplate" ref="myJmsJndiTemplate"/>
</bean>[/xml]

Declare a Jndi Template

[xml]<bean id="myJmsJndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
<prop key="java.naming.provider.url"><strong>${my.jms.host}</strong></prop>
</props>
</property>
</bean>[/xml]
The variable ${my.jms.host} is used to indicate the actual destination host. The value is given in a property file myConfig.properties, for instance:

my.jms.host=t3://127.0.0.1:1234

Obviously, each environnement needs its ad hoc property file!

Declare a JMS Template

It gathers the factory and the queue name.
[xml]<bean id="myJmsTemplate">
<property name="connectionFactory" ref="myJmsQueueConnectionFactory"/>
<property name="defaultDestination" ref="myJmsQueue"/>
</bean>[/xml]

Declare the destination queue

[xml]<bean id="myJmsQueue">
<property name="jndiName" value="my.jms.destination.queue.name"/>
</bean>[/xml]

Ensure the property file is in classpath

[xml]<bean id="conf">
<property name="locations">
<list>
<value>classpath*:myConfig.properties</value>
</list>
</property>
</bean>[/xml]
Restart WebLogic, deploy your EAR. Now it should work!

Notice: in case you’re not sure the distant host is up or not, you may add this attribute to your beans: lazy-init="true"

PostHeaderIcon weblogic.jms.common.MessageFormatException: JMSClientExceptions: Invalid property name, “my-personnal-id”

Error:

weblogic.jms.common.MessageFormatException: JMSClientExceptions: Invalid property name, "my-personnal-id"

Fix:

Rename the property as myPersonalId for instance. Indeed, owing to JMS specification, properties on JMS messages must be written in alphanumeric characters. Therefore, hyphen '-' and periods '.' are forbidden.

PostHeaderIcon IDEA: “Debug info unavailable”

Error: IntelliJ IDEA does not allow to see the values of local variables. The error message displayed is:  Debug info unavailable.

Fix:

  • open the settings
  • open Compiler tab
  • check Generate debugging info

PostHeaderIcon java.lang.ClassNotFoundException: net.sf.cglib.transform.impl.InterceptFieldEnabled

Error:

 java.lang.ClassNotFoundException: net.sf.cglib.transform.impl.InterceptFieldEnabled  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)  at java.security.AccessController.doPrivileged(Native Method)  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)  at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 

Fix: add cgilib-nodep.jar to your classpath.

PostHeaderIcon LDIFReader: modify record not ends with ‘-‘ in the record starting on line

Error:

Error: LDAPLocalException: com.novell.ldap.ldif_dsml.LDIFReader: modify record not ends with '-' in the record starting on line 38 of the file. (82) Local Error

Fix:

  • go to the line hinted in the error (here: 38)
  • get the block of the entry which is modified, for instance:
dn: cn=foo,ou=OUfoos,ou=Groups, dc=DCfoos
changetype: modify
add: uniqueMember
uniqueMember: cn=myFoo, ou=OUfoos, ou=Groups, dc=DCfoos
  • then add a character '-' at the end of this block, you get:
dn: cn=foo,ou=OUfoos,ou=Groups, dc=DCfoos
changetype: modify
add: uniqueMember
uniqueMember: cn=myFoo, ou=OUfoos, ou=Groups, dc=DCfoos
-

PostHeaderIcon com.novell.ldap.ldif_dsml.LDIFReader: Version line must be the first meaningful line

Error:

 LDAPLocalException: com.novell.ldap.ldif_dsml.LDIFReader: Version line must be the first meaningful line(on line 1 of the file) (82) Local Error 

Fix: add this line at the bottom of your Ldif file:

 version: 1 

PostHeaderIcon DiskDigger

Catastrophe! J’ai efface mon rapport de stage de ma clef USB! Je suis fichu, ma soutenance c’est demain matin a 5h! Mais non, tout n’est pas perdu.

DiskDigger est un logiciel freeware qui permet de recuperer des fichiers effaces, volontairement ou non, sous Windows. En effet, contrairement a Unix, la suppression d’un fichier sous Windows n’efface pas physiquement le fichier de la surface du disque, mais se contente de retirer son adresse logique sur la table de partition.

DiskDigger propose de scanner un disque physique ou logique, NTFS ou FAT, les memoire flash et meme les clefs USB… Tres pratique pour quiconque a deja perdu des photos de vacances lors d’une mauvaise manipulation.

DiskDigger est disponible a ce lien. DiskDigger a ete cree par Dmitry Brant.

PostHeaderIcon net/sf/ezmorph/Morpher

Error:

nested exception is java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:899) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:793) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)

Fix: add ezmorph.jar to your classpath.

PostHeaderIcon net.sf.cglib.transform.impl.InterceptFieldEnabled

Error:

 java.lang.ClassNotFoundException: net.sf.cglib.transform.impl.InterceptFieldEnabled  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)  at java.security.AccessController.doPrivileged(Native Method)  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)  at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 

Fix: add ehcache.jar in your classpath.

PostHeaderIcon Java 7: Strings in Switch

Dolphin extends the switch operator to String

Read the rest of this entry »