Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 654181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:27:59+00:00 2026-05-13T22:27:59+00:00

Flat-file JMS authentication is easy to set up on Glassfish (see http://docs.sun.com/app/docs/doc/821-0027/aeofg?a=view ). The

  • 0

Flat-file JMS authentication is easy to set up on Glassfish (see http://docs.sun.com/app/docs/doc/821-0027/aeofg?a=view).

The problem is the client part. I am writing a standalone Java client to access my JMS ressources (ConnectionFactory and Destination) via JNDI.

How to pass a username and a password to JMS from that client ?

I already tried several things such as:

1) Adding those credentials in the InitialContext

 context.addToEnvironment(InitialContext.SECURITY_PRINCIPAL, "username");
 context.addToEnvironment(InitialContext.SECURITY_CREDENTIALS, "password");

2) Using JMS username and password parameters in the connection factory

 connectionFactory.createConnection();

However, none of those methods is working.

When I run the program, I just get:

com.sun.messaging.jms.JMSSecurityException: [C4084]: Échec de 
l'authentification de l'utilisateur :  user=guest, broker=localhost:7676(34576) 
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.authenticate
(ProtocolHandler.java:1084)

So it keeps trying to authenticate with the “guest” user.

For this test, I used connection.NORMAL.deny.user=* as permission rule (accesscontrol.properties).

The interesting part is that this exception is thrown even before the connection factore is obtained:

 InitialContext context = new InitialContext();

 ConnectionFactory connectionFactory = 
 (ConnectionFactory)context.lookup("jms/middleware/factory"); 
 /* The exception is thrown here, so authentication MUST have happened 
    before already (i.e. NOT in the createConnection(username, password) method) */

Hope someone knows the answer.

Many thanks in advance

Regards,

Dinesh

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:27:59+00:00Added an answer on May 13, 2026 at 10:27 pm

    OK I found a workaround, which is to not use JNDI, but to use vendor-specific JMS API instead, as described on http://weblogs.java.net/blog/kalali/archive/2010/03/02/open-mq-open-source-message-queuing-beginners-and-professionals-0

    The final code is:

    com.sun.messaging.ConnectionFactory connectionFactory = new com.sun.messaging.ConnectionFactory();
    QueueConnection queueConnection = connectionFactory.createQueueConnection("user01", "password01");
    

    Which this time leads to the error

    Error: [C4060]: Login failed:  user=user01, broker=localhost:7676(53445)
    

    Which is great 😉

    So, workaround is working. However if someone does know how to achive this also with JNDI it would be even better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to see some examples of simple flat file databases and how
I am processing a flat file, with data in line by line format, like
I am writing a flat file parser that reads token/value pairs using a Scanner.
I need to sort a flat file by third column leaving first column intact
I am loading data from table to flat file destination, where my flat file
I'm using bcp to import a flat file into an SQL Server 2005 database.
How do you deal with a flat file footer in SSIS? There is an
I try to transform a hierarchical XML file to a flat file schema using
Suppose I'm given a large dictionary in flat file with 200 million words and
I have simple SSIS package which reads data from flat file and insert into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.