1 Reply Latest reply on Jan 15, 2016 10:27 AM by Justin Bertram

    Getting jmsCrypto: Not able to decrypt the password and (MSC service thread 1-3) Error while getting Jms username/password in the context: javax.crypto.BadPaddingException: Given final block not properly padded with Jboss-as-7.1.1.final cluster setup

    Nag K Newbie

      Hi Team,

       

      We're in the process of implementing the cluster setup with jboss -7.1.1.final to one of our application. while implementing the cluster setup we're getting the below exception.without cluster setup our application works well. while running the application we're getting the below application and it's not able to create jms connections. I have done all the necessary configurations to standalone-full-ha.xml file for cluster setup and I have observed the corresponding jar files and class files but still no luck .Still I am getting the below exception.

       

      (MSC service thread 1-3) jmsCrypto: Not able to decrypt the password.

      00:18:38,980 ERROR [stderr] (MSC service thread 1-3) javax.crypto.BadPaddingException: Given final block not properly padded

      00:18:38,981 ERROR [stderr] (MSC service thread 1-3) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:811)

      00:18:38,982 ERROR [stderr] (MSC service thread 1-3) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676)

      00:18:38,983 ERROR [stderr] (MSC service thread 1-3) at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:313)

      00:18:38,983 ERROR [stderr] (MSC service thread 1-3) at javax.crypto.Cipher.doFinal(Cipher.java:2087)

      .

      .

      .

      .

      .

      00:18:38,993 ERROR [stderr] (MSC service thread 1-3) at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392)

      00:18:38,993 ERROR [stderr] (MSC service thread 1-3) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850)

      00:18:38,993 ERROR [stderr] (MSC service thread 1-3) at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90)

      00:18:38,994 ERROR [stderr] (MSC service thread 1-3) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

      00:18:38,996 ERROR [stderr] (MSC service thread 1-3) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

      00:18:38,996 ERROR [stderr] (MSC service thread 1-3) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

      00:18:38,996 ERROR [stderr] (MSC service thread 1-3) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

      00:18:38,996 ERROR [stderr] (MSC service thread 1-3) at java.lang.Thread.run(Thread.java:745)

      00:18:38,997 ERROR  (MSC service thread 1-3) Error while getting Jms username/password in the context: javax.crypto.BadPaddingException: Given final block not properly padded

        at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:811) [sunjce_provider.jar:1.7.0_85]

        at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676) [sunjce_provider.jar:1.7.0_85]

        at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:313) [sunjce_provider.jar:1.7.0_85]

        at javax.crypto.Cipher.doFinal(Cipher.java:2087) [jce.jar:1.7.0_71]

       

       

       

      Is there any necessary configurations needs to be done in other files for cluster setup in jboss-as-7.1.1.final other than standalone-full-ha.xml... I have used the below standalone-full-ha.xml file

       

      <subsystem xmlns="urn:jboss:domain:messaging:1.1">

                  <hornetq-server>

                      <clustered>true</clustered>

                      <persistence-enabled>true</persistence-enabled>

                      <security-enabled>false</security-enabled>

                      <cluster-user>xxxxx</cluster-user>

                      <cluster-password>xxxxx</cluster-password>

                      <journal-file-size>102400</journal-file-size>

                      <journal-min-files>2</journal-min-files>

       

       

      <connectors>

                          <netty-connector name="netty" socket-binding="messaging"/>

                          <netty-connector name="netty-throughput" socket-binding="messaging-throughput">

                              <param key="batch-delay" value="50"/>

                          </netty-connector>

                          <in-vm-connector name="in-vm" server-id="0"/>

                      </connectors>

                      <acceptors>

                          <netty-acceptor name="netty" socket-binding="messaging"/>

                          <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">

                              <param key="batch-delay" value="50"/>

                              <param key="direct-deliver" value="false"/>

                          </netty-acceptor>

                          <in-vm-acceptor name="in-vm" server-id="0"/>

                      </acceptors>

                      <broadcast-groups>

                          <broadcast-group name="bg-group1">

                              <group-address>231.7.7.7</group-address>

                              <group-port>9876</group-port>

                              <broadcast-period>5000</broadcast-period>

                              <connector-ref>netty</connector-ref>

                          </broadcast-group>

                      </broadcast-groups>

                      <discovery-groups>

                          <discovery-group name="dg-group1">

                              <group-address>231.7.7.7</group-address>

                              <group-port>9876</group-port>

                              <refresh-timeout>10000</refresh-timeout>

                          </discovery-group>

                      </discovery-groups>

                      <cluster-connections>

                          <cluster-connection name="my-cluster">

                              <address>jms</address>

                              <connector-ref>netty</connector-ref>

                              <discovery-group-ref discovery-group-name="dg-group1"/>

                          </cluster-connection>

                      </cluster-connections>

                      <security-settings>

                          <security-setting match="#">

                              <permission type="send" roles="guest"/>

                              <permission type="consume" roles="guest"/>

                              <permission type="createNonDurableQueue" roles="guest"/>

                              <permission type="deleteNonDurableQueue" roles="guest"/>

                          </security-setting>

                      </security-settings>

                      <address-settings>

                          <!--default for catch all-->

                          <address-setting match="#">

                              <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                              <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                              <redelivery-delay>0</redelivery-delay>

                              <redistribution-delay>1000</redistribution-delay>

                              <max-size-bytes>10485760</max-size-bytes>

                              <address-full-policy>BLOCK</address-full-policy>

                              <message-counter-history-day-limit>10</message-counter-history-day-limit>

                          </address-setting>

                      </address-settings>

                      <jms-connection-factories>

                          <connection-factory name="InVmConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/ConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <connection-factory name="RemoteConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="netty"/>

                              </connectors>

                              <entries>

                                  <entry name="RemoteConnectionFactory"/>

                                  <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <pooled-connection-factory name="hornetq-ra">

                              <transaction mode="xa"/>

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/JmsXA"/>

                              </entries>

                          </pooled-connection-factory>

                      </jms-connection-factories>

                      <jms-destinations>

                          <jms-queue name="testQueue">

                              <entry name="queue/test"/>

                              <entry name="java:jboss/exported/jms/queue/test"/>

                          </jms-queue>

                          <jms-topic name="testTopic">

                              <entry name="topic/test"/>

                              <entry name="java:jboss/exported/jms/topic/test"/>

                          </jms-topic>

                      </jms-destinations>

                  </hornetq-server>

              </subsystem>

       

      Also I have used corresponding datasource for this applications.. the entries are

       

      <datasource jndi-name="java:/XXXXXDS" pool-name="XXXXXXDS" enabled="true">

                          <connection-url>XXXXXX</connection-url>

                          <driver-class>oracle.jdbc.OracleDriver</driver-class>

                          <driver>oracle-thin</driver>

                          <new-connection-sql>SELECT 1 FROM DUAL</new-connection-sql>

                          <pool>

                              <min-pool-size>20</min-pool-size>

                              <max-pool-size>80</max-pool-size>

                          </pool>

                          <security>

                              <security-domain>xxxxxxxDataSource</security-domain>

                          </security>

       

                  <security-domain name="xxxxxxxDataSource" cache-type="default">

                          <authentication>

                              <login-module code="org.picketbox.datasource.security.SecureIdentityLoginModule" flag="required">

                                  <module-option name="username" value="testcuser"/>

                                  <module-option name="password" value="encrypted password here "/>

                                  <module-option name="managedConnectionFactoryName" value="jboss.jca:service=LocalTxCM,name=XXXXXXXDS"/>

                              </login-module>

                          </authentication>

                      </security-domain>

       

      with the above configuration setup the application is not deployed properly and the required  spring beans are not created properly

       

      ERROR...... (MSC service thread 1-3) Problems during xxxx Server Startup initialization!: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [config/spring/CamelContext.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException..

       

       

      I have tried several solutions for the above problem... but none of them worked. Looking for the quick resolution on this issue and appreciate your quick response on this..

       

      Thanks