File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes javax.jms.JMSSecurityException: User null is NOT authenticated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "javax.jms.JMSSecurityException: User null is NOT authenticated" Watch "javax.jms.JMSSecurityException: User null is NOT authenticated" New topic
Author

javax.jms.JMSSecurityException: User null is NOT authenticated

Rajesh MadhanGopal
Ranch Hand

Joined: Jan 19, 2006
Posts: 69
I am getting the "User null is NOT authenticated" exception in JBoss after migrating from HSQLDB to Mysql for JBoss Messaging.


Configuration details:
JBoss Server 5.1 (4 node cluster)
Mysql 5.5

Heres what i did to migrate from HSQLDB to Mysql:

1. Copied the Mysql JDBC driver (mysql-connector-java-5.1.1.4-bin) to the lib folder of the nodes in JBoss.
2. Replacde the file hsqldb-ds.xml with mysql-ds.xml in the deploy folder in JBoss.
3. Replaced the file hsqldb-persistence-service.xml with mysqldb-persistence-service.xml in the messaging folder under deploy in JBoss.
4. Updated the file mysql-ds.xml to have the following:



5. Uncommented the "guest=guest" entry in the messaging-users file.

6. Added the following in the login-config file present in jboss/conf folder:




7. Added a reference to the MySqlDbRealm in the mysql-ds file by adding the following:

<security-domain>MySqlDbRealm</security-domain>

8. Ensured that the <type-mapping>mySQL</type-mapping> property vale present in mysql-ds.xml file is the same as the <type-mapping> property in standardjbosscmp-jdbc.xml file.


I am guessing, i am missing some configuration which is causing the issue. Could someone educate me on what needs to be updated to fix this issue. I see a few people have the same issue, but was not able to find a concrete solution or a pointer to the root cause of the issue.


Thanks<br />Rajesh
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Hi

Could you provide the contents of your standardjbosscmp-jdbc.xml file?
Rajesh MadhanGopal
Ranch Hand

Joined: Jan 19, 2006
Posts: 69
Below is my standardjbosscmp-jdbc.xml file:

James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Hi

Is the user 'uname' configured in the database with password 'pwd'?
Rajesh MadhanGopal
Ranch Hand

Joined: Jan 19, 2006
Posts: 69
yes ...thats what i have in the database.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

I believe I may have found the problem.

Assuming you are using the default server instance in JBoss, there should be a file called messaging-jboss-beans.xml under $JBOSS_HOME/server/default/deploy/messaging. In this file, there is the default configuration for messaging. Something like:



This is pointing at the default datasource which assumes to be HSQLDB but which you have now changed to point at your MySQL database. I am assuming the user 'guest' (and probably the tables JBM_USER and JBM_ROLE) cannot be found.

Try turning on debug logging and check the logs just before the exception occurs.
Rajesh MadhanGopal
Ranch Hand

Joined: Jan 19, 2006
Posts: 69
I checked the Mysql Database and saw that both the tables were present and also the user guest was present in those tables, below is the content of messaging-jboss-beans.xml related to messaging.

Rajesh MadhanGopal
Ranch Hand

Joined: Jan 19, 2006
Posts: 69
Please can someone suggest what might be wrong here?
Rajesh MadhanGopal
Ranch Hand

Joined: Jan 19, 2006
Posts: 69
Hi all,

i finally managed to fix the issue and following is what we did:

Added the below given snippet to the mysql-ds.xml file which does a background check on the connection pool and ensures that there are no stale connection objects in the pool. Apparently, it was the stale connection objects which caused the issue.

<code>
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
<background-validation-millis>100</background-validation-millis>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
</code>

Hope this helps some one who has the same issue and wants to know what could fix it.
 
Consider Paul's rocket mass heater.
 
subject: javax.jms.JMSSecurityException: User null is NOT authenticated
 
Similar Threads
problem in setting mySql as default database server
Deploying EJB using MySql as a datasource
Deploying EJB using MySql as a datasource
Jboss- DataSource Problem
JBPM Deployment on Jboss-4.0.3SP1