Showing posts with label JBoss Migration. Show all posts
Showing posts with label JBoss Migration. Show all posts

Monday, January 26, 2015

JBoss AS 7.1.1 - Crypto Libreary Not Found Issue When Migration from JBoss 4.2.3

JBoss 7.1.1 Crypto Library Not Found Issue

When I was migrating an application from JBoss 4 (4.2.3) to JBoss 7 (7.1.1), I encountered an issue:

java.lang.ClassNotFoundException: com.sun.crypto.provider.SunJCE

JBoss 7.1.1 Crypto Library Not Found Solution

After some search on the Internet, I managed to find a solution. Steps:
  1. Create a directory modules/sun/jdk/main;
  2. Under 'main', create a file module.xml;
  3. Add the following content to the file.
<module xmlns="urn:jboss:module:1.1" name="sun.jdk">
<resources>
    <resource-root path="service-loader-resources"/>
</resources>
<dependencies>
    <system export="true">
        <paths>
            <path name="com/sun/crypto/provider"/>
            <path name="com/sun/script/javascript"/>
            <path name="com/sun/jndi/dns"/>
            <path name="com/sun/jndi/ldap"/>
            <path name="com/sun/jndi/url"/>
            <path name="com/sun/jndi/url/dns"/>
            <path name="com/sun/security/auth"/>
            <path name="com/sun/security/auth/login"/>
            <path name="com/sun/security/auth/module"/>
            <path name="sun/misc"/>
            <path name="sun/io"/>
            <path name="sun/nio"/>
            <path name="sun/nio/ch"/>
            <path name="sun/security"/>
            <path name="sun/security/krb5"/>
            <path name="sun/util"/>
            <path name="sun/util/calendar"/>
            <path name="sun/util/locale"/>
            <path name="sun/security/provider"/>
            <path name="META-INF/services"/>
        </paths>
        <exports>
            <include-set>
                <path name="META-INF/services"/>
            </include-set>
        </exports>
    </system>
</dependencies>

The tricky part is path name="com/sun/crypto/provider"/>, which instructs JBoss to load necessary crypto lib for you.



Create a Successful Online Store at Bigcommerce! Try it Free Now!

Saturday, January 24, 2015

JBoss7.1.1 JMS | JBoss AS 7.1.1 - JMS Configuration

This article summarizes the issues I encountered during migration of a JMS application
from JBoss 4.2.3 to 7.1.1.

Configure Messaging and Remoting Modules

Refer to this article: http://blog.avisi.nl/2012/10/10/configuring-camel-to-use-hornetq-in-jboss-as-7.

RMI Port

if you previously used something like jnp://localhost:1099/, you need change it to remote://localhost:4447.

Handle Exception: javax.security.sasl.SaslException: 

Authentication failed: all available authentication mechanisms failed.
You need to add a user under Application Realm or remove the authentication by removing security-realm="ApplicationRealm" from
<subsystem xmlns="urn:jboss:domain:remoting:1.1">
           <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/>
</subsystem>
in your standalone.xml.

Handle Exception: javax.jms.JMSSecurityException

Unable to validate user: null
You need to set "security-enabled" to false in the standalone.xml.
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
     <hornetq-server>
         <security-enabled>false</security-enabled>
         ......
     </hornetq-server>
</subsystem>

Add System Properties

System properties can be added into standalone.xml.
<server>
<extensions>
</extensions>
<system-properties>
     <property name="propertyName" value="property value"/>
</system-properties>
</server>

Then, in your program, you can retrieve them using System.getProperty("propertyName").

Create JmsTemplate for Topics

<bean id="jmsTopicTemplate" class="org.springframework.jms.core.JmsTemplate">
   <constructor-arg ref="connectionFactory" />
   <property name="pubSubDomain" value="true"/>
</bean>

Summary of Dependent Libs

hornetq-core-2.2.13.Final.jar
hornetq-jms-2.2.13.Final.jar
jboss-remote-naming-1.0.2.Final.jar
netty-3.2.6.Final.jar
spreing-jms-3.2.5.RELEASE.jar

Check more details here.


Create a Successful Online Store at Bigcommerce! Try it Free Now!