You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by j0llyr0g3r <ti...@wincor-nixdorf.com> on 2008/04/19 02:29:18 UTC

Simple authentication not working: Unrecognized xbean element mapping: authenticationUser

Hey folks, 

i am using AMQ 4.1.2 and even the most simple authentication won't work.
(same error with AMQ 5.* by the way)

I am following exactly the documentation here:
http://activemq.apache.org/security.html

Documentation seems to be incomplete or for JAAS experts only.

But one after the other:

Authentication Example

Here is an example login.config which then points to these files

    * users.properties
    * groups.properties

Ok, so followed the links and created

-> login.config under $AMQ_HOME/conf:

activemq-domain {
    org.apache.activemq.jaas.PropertiesLoginModule required
        debug=true
       
org.apache.activemq.jaas.properties.user="org/apache/activemq/security/users.properties"
       
org.apache.activemq.jaas.properties.group="org/apache/activemq/security/groups.properties";
};

-> users.properties under $AMQ_HOME/conf:

system=manager
user=password
guest=password

-> groups.properties under $AMQ_HOME/conf:

admins=system
tempDestinationAdmins=system,user
users=system,user
guests=guest

via copy & paste from the documentation.

Then the documentation gets fuzzy and i don't know what the hell to do next.

I inserted this section into my activemq.xml

<plugins>
<simpleAuthenticationPlugin>
	<users>
		<authenticationUser username="system" password="manager"
			groups="users,admins"/>
		<authenticationUser username="user" password="password"
			groups="users"/>
		<authenticationUser username="guest" password="password" groups="guests"/>
	</users>
</simpleAuthenticationPlugin>

</plugins>


like in the documentation example.

But when i start up the broker it gives me the error:

ACTIVEMQ_HOME: /opt/activemq_4
ACTIVEMQ_BASE: /opt/activemq_4
Loading message broker from: xbean:activemq.xml
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized
xbean element mapping: authenticationUser in namespace
http://activemq.org/config/1.0
java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized
xbean element mapping: authenticationUser in namespace
http://activemq.org/config/1.0
        at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:70)
        at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:50)
        at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:82)
        at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:50)
        at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:202)
        at org.apache.activemq.console.Main.main(Main.java:91)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
Unrecognized xbean element mapping: authenticationUser in namespace
http://activemq.org/config/1.0
        at
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:264)


So, i am lost.

I know there is a more complicated example below in the documentation, but
as far as i understood, the above steps are all that are necessary, to set
up a simple, but working authentication?

Could somebody please give me a push in the right direction and tell me what
i am doing wrong?

Thx in advance guys.......
-- 
View this message in context: http://www.nabble.com/Simple-authentication-not-working%3A-Unrecognized-xbean-element-mapping%3A-authenticationUser-tp16765832s2354p16765832.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Simple authentication not working: Unrecognized xbean element mapping: authenticationUser

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hi Joe,

i figured this 

If you've got security enabled, then I'm afraid you're going to have to
comment out the commandAgent and most probably the camelContext elements.

out by coincidence yesterday evening.
I had to comment out the camel context and the command agent to get it
working (just as you also mentioned)

Ok, 

now i know this is not a bug or something, but i definitely think the error
message must be more clear about the real cause of the problem, because i
thought that i had made an error in this section:

    <plugins>
        <simpleAuthenticationPlugin>
                <users>
                        <authenticationUser username="system"
password="manager"
                                                groups="admins"/>
                </users>
        </simpleAuthenticationPlugin>
    </plugins> 

Furthermore, i think something like must be mentioned in the documentation.

Since i have an Confluence account, i will try to add this information to
the documentation.

Thank you very much for your reply, no i know why i didn't work.......
-- 
View this message in context: http://www.nabble.com/Simple-authentication-not-working%3A-Unrecognized-xbean-element-mapping%3A-authenticationUser-tp16765832s2354p16823503.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Simple authentication not working: Unrecognized xbean element mapping: authenticationUser

Posted by ttmdev <jo...@ttmsolutions.com>.
If you've got security enabled, then I'm afraid you're going to have to
comment out the commandAgent and most probably the camelContext elements.
These components try and connect to the broker, but AFAIK there's no way to
assign them a valid user name and password via their respective elements in
the broker XML configuration file. If you figure it out, a posting
describing the solution would be greatly appreciated.   

Joe 
Goto www.ttmsolutions.com for a free ActiveMQ user guide


j0llyr0g3r wrote:
> 
> Hi,
> 
> sorry, i forgot something:
> 
> If i get the documentation right, the most simple setup would to just
> insert:
> 
>     <plugins>
> 	<simpleAuthenticationPlugin>
> 		<users>
> 			<authenticationUser username="system" password="manager"
> 						groups="admins"/>
> 		</users>
> 	</simpleAuthenticationPlugin>
>     </plugins> 
> 
> in the activemq.xml, thereby defining users and passwords.
> 
> So, no -Djava....., no login.conf, no users.properties, no realm......
> 
> But even that does not work:
> 
> ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'org.apache.activemq.broker.util.CommandAgent' defined in
> class path resource [activemq.xml]: Invocation of init method failed;
> nested exception is javax.jms.JMSException: User name or password is
> invalid.
> java.lang.RuntimeException: Failed to execute start task. Reason:
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'org.apache.activemq.broker.util.CommandAgent' defined in
> class path resource [activemq.xml]: Invocation of init method failed;
> nested exception is javax.jms.JMSException: User name or password is
> invalid.
>         at
> org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:99)
>         at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
>         at
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:104)
>         at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
>         at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:76)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.activemq.console.Main.runTaskClass(Main.java:222)
>         at org.apache.activemq.console.Main.main(Main.java:106)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'org.apache.activemq.broker.util.CommandAgent'
> defined in class path resource [activemq.xml]: Invocation of init method
> failed; nested exception is javax.jms.JMSException: User name or password
> is invalid.
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1174)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
>         at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
>         at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284)
>         at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
>         at
> org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
>         at
> org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
>         at
> org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:91)
>         at
> org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:51)
>         at
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
>         at
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
>         at
> org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:112)
>         at
> org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
>         ... 10 more
> Caused by: javax.jms.JMSException: User name or password is invalid.
>         at
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49)
>         at
> org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1178)
>         at
> org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1262)
>         at
> org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:453)
>         at
> org.apache.activemq.broker.util.CommandAgent.getConnection(CommandAgent.java:140)
>         at
> org.apache.activemq.broker.util.CommandAgent.start(CommandAgent.java:54)
>         at
> org.apache.activemq.broker.util.CommandAgent.afterPropertiesSet(CommandAgent.java:97)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
>         ... 25 more                                                                                                                                                                                                  
> 
> I mean, there must be a simple, working example, right?
> 
> 

-- 
View this message in context: http://www.nabble.com/Simple-authentication-not-working%3A-Unrecognized-xbean-element-mapping%3A-authenticationUser-tp16765832s2354p16815510.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Simple authentication not working: Unrecognized xbean element mapping: authenticationUser

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hi,

sorry, i forgot something:

If i get the documentation right, the most simple setup would to just
insert:

    <plugins>
	<simpleAuthenticationPlugin>
		<users>
			<authenticationUser username="system" password="manager"
						groups="admins"/>
		</users>
	</simpleAuthenticationPlugin>
    </plugins> 

in the activemq.xml, thereby defining users and passwords.

So, no -Djava....., no login.conf, no users.properties, no realm......

But even that does not work:

ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.activemq.broker.util.CommandAgent' defined in class
path resource [activemq.xml]: Invocation of init method failed; nested
exception is javax.jms.JMSException: User name or password is invalid.
java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.activemq.broker.util.CommandAgent' defined in class
path resource [activemq.xml]: Invocation of init method failed; nested
exception is javax.jms.JMSException: User name or password is invalid.
        at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:99)
        at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
        at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:104)
        at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
        at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:76)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:222)
        at org.apache.activemq.console.Main.main(Main.java:106)
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'org.apache.activemq.broker.util.CommandAgent'
defined in class path resource [activemq.xml]: Invocation of init method
failed; nested exception is javax.jms.JMSException: User name or password is
invalid.
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1174)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
        at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
        at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
        at
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:91)
        at
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:51)
        at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
        at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
        at
org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:112)
        at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
        ... 10 more
Caused by: javax.jms.JMSException: User name or password is invalid.
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1178)
        at
org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1262)
        at
org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:453)
        at
org.apache.activemq.broker.util.CommandAgent.getConnection(CommandAgent.java:140)
        at
org.apache.activemq.broker.util.CommandAgent.start(CommandAgent.java:54)
        at
org.apache.activemq.broker.util.CommandAgent.afterPropertiesSet(CommandAgent.java:97)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
        ... 25 more                                                                                                                                                                                                  

I mean, there must be a simple, working example, right?

-- 
View this message in context: http://www.nabble.com/Simple-authentication-not-working%3A-Unrecognized-xbean-element-mapping%3A-authenticationUser-tp16765832s2354p16809864.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Simple authentication not working: Unrecognized xbean element mapping: authenticationUser

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hi and thx for your reply.....

Maybe i didn't make myself clear enough.....:-)

I follow exactly the documentation example from here:
http://activemq.apache.org/security.html

This means:

-> I create a login.conf:

activemq-domain {
    org.apache.activemq.jaas.PropertiesLoginModule required
        debug=true
       
org.apache.activemq.jaas.properties.user="/opt/activemq/conf/users.properties"
       
org.apache.activemq.jaas.properties.group="/opt/activemq/conf/groups.properties";
};

-> I create a users.properties:

system=manager

-> I create a groups.properties:

admins=system

-> I make the following entry in activemq.xml:

    <plugins>
      <jaasAuthenticationPlugin configuration="activemq-domain" />

	<simpleAuthenticationPlugin>
		<users>
			<authenticationUser username="system" password="manager"
						groups="admins"/>
		</users>
	</simpleAuthenticationPlugin>
    </plugins> 



-> I modify the activemq-start-script by adding:

-Djava.security.auth.login.config="/opt/activemq/conf/login.conf"

According to the documentation, this should be it(?).

But now, on start-up, the broker gives me the error:

ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.activemq.broker.util.CommandAgent' defined in class
path resource [activemq.xml]: Invocation of init method failed; nested
exception is javax.jms.JMSException: User name or password is invalid.
java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.activemq.broker.util.CommandAgent' defined in class
path resource [activemq.xml]: Invocation of init method failed; nested
exception is javax.jms.JMSException: User name or password is invalid.
        at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:99)
        at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
        at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:104)
        at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
        at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:76)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:222)
        at org.apache.activemq.console.Main.main(Main.java:106)
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'org.apache.activemq.broker.util.CommandAgent'
defined in class path resource [activemq.xml]: Invocation of init method
failed; nested exception is javax.jms.JMSException: User name or password is
invalid.
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1174)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
        at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
        at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
        at
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:91)
        at
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:51)
        at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
        at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
        at
org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:112)
        at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
        ... 10 more
Caused by: javax.jms.JMSException: User name or password is invalid.
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49)                                                                                                                                                                                                                                                                               

Interesting line:

Caused by: javax.jms.JMSException: User name or password is invalid.

Ehm, 

how can this be invalid?

Ok, 

then i tried the advanced example below, meaning that i substituted

    <plugins>
      <jaasAuthenticationPlugin configuration="activemq-domain" />

	<simpleAuthenticationPlugin>
		<users>
			<authenticationUser username="system" password="manager"
						groups="admins"/>
		</users>
	</simpleAuthenticationPlugin>
    </plugins> 

with:

    <plugins>
	    <!--  use JAAS to authenticate using the login.config file on the
classpath to configure JAAS -->
	    <jaasAuthenticationPlugin configuration="activemq-domain" />
	    
	    <!--  lets configure a destination based authorization mechanism -->
	    <authorizationPlugin>
		    <map>
			    <authorizationMap>
				    <authorizationEntries>
					    <authorizationEntry queue=">" read="admins" write="admins"
admin="admins" />
				    </authorizationEntries>

			    </authorizationMap>
		    </map>
	    </authorizationPlugin>
    </plugins>

(login.conf, users.properties and groups.properties remain the same)

Then the broker fails on me with:

Caused by: java.lang.SecurityException: User name or password is invalid.
        at
org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:83)
        at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:81)
        at
org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:91)
        at
org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:657)
        at
org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:125)
        at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:281)
        at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
        at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:100)
        at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:67)
        at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:202)
        at
org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:98)
        at
org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:36)
Caused by: javax.security.auth.login.LoginException: Unable to load user
properties file /opt/activemq/conf/opt/activemq/conf/users.properties


Interesting line:

Caused by: javax.security.auth.login.LoginException: Unable to load user
properties file /opt/activemq/conf/opt/activemq/conf/users.properties


Ok, so all of a sudden he doesn't like absolute paths anymore.

So i changed 

activemq-domain {
    org.apache.activemq.jaas.PropertiesLoginModule required
        debug=true
       
org.apache.activemq.jaas.properties.user="/opt/activemq/conf/users.properties"
       
org.apache.activemq.jaas.properties.group="/opt/activemq/conf/groups.properties";
};

to

activemq-domain {
    org.apache.activemq.jaas.PropertiesLoginModule required
        debug=true
        org.apache.activemq.jaas.properties.user="users.properties"
        org.apache.activemq.jaas.properties.group="groups.properties";
};

but now the broker gives me:

WARN  TransportConnection            - Failed to add Connection
java.lang.SecurityException: User name or password is invalid.
        at
org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:83)
        at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:81)
        at
org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:91)
        at
org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:657)
        at
org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:125)
        at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:281)
        at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
        at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:100)
        at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:67)
        at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:202)
        at
org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:98)
        at
org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:36)
Caused by: javax.security.auth.login.LoginException:
java.lang.NullPointerException
        at java.util.Hashtable.get(Hashtable.java:334)
        at java.util.Properties.getProperty(Properties.java:932)
        at
org.apache.activemq.jaas.PropertiesLoginModule.login(PropertiesLoginModule.java:116)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
        at
javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
        at
javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
        at java.security.AccessController.doPrivileged(Native Method)
        at
javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
        at
javax.security.auth.login.LoginContext.login(LoginContext.java:579)
        at
org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:76)
        at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:81)
        at
org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:91)
        at
org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:657)
        at
org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:125)
        at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:281)
        at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
        at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:100)
        at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:67)
        at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:202)
        at
org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:98)
        at
org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:36)

        at
javax.security.auth.login.LoginContext.invoke(LoginContext.java:872)
        at
javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
        at
javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
        at java.security.AccessController.doPrivileged(Native Method)
        at
javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
        at
javax.security.auth.login.LoginContext.login(LoginContext.java:579)
        at
org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:76)
        ... 11 more


What am i doing wrong here?

P.S. I use the latest amq stable release 5, xbean-spring lies under
/lib/optional
-- 
View this message in context: http://www.nabble.com/Simple-authentication-not-working%3A-Unrecognized-xbean-element-mapping%3A-authenticationUser-tp16765832s2354p16809859.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Simple authentication not working: Unrecognized xbean element mapping: authenticationUser

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,

xbean support for simple authentication plugin is available since 5.0 and is
working fine. You can find an example configuration in unit test resources

https://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/security/simple-auth-broker.xml

In the 4.*, the plugin is not so Spring-friendly. You can set some things
manually, such as

 <bean class="org.apache.activemq.security.SimpleAuthenticationPlugin"
id="simpleAuthentication">
     <property name="userPasswords">
         <map>
             <entry>
                 <key>
                     <value>system</value>
                 </key>
                 <value>manager</value>
             </entry>
         </map>
     </property>
</bean>

and then install it with

<broker plugins="#simpleAuthentication"></broker>

Cheers
-- 
Dejan Bosanac
www.scriptinginjava.net

Re: Simple authentication not working: Unrecognized xbean element mapping: authenticationUser

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Ok,

i dug a little deeper, but now i am totally confused:

I mean obviously this line:

java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized
xbean element mapping: authenticationUser in namespace
http://activemq.org/config/1.0


tells me, that something is wrong with my xml-configuration.

So i took at the scheme-definition here 

-> http://activemq.org/config/1.0 

and here respectively:

-> http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd

There is a element authenticationUser in the scheme?

What am i doing wrong here?




j0llyr0g3r wrote:
> 
> Hey folks, 
> 
> i am using AMQ 4.1.2 and even the most simple authentication won't work.
> (same error with AMQ 5.* by the way)
> 
> I am following exactly the documentation here:
> http://activemq.apache.org/security.html
> 
> Documentation seems to be incomplete or for JAAS experts only.
> 
> But one after the other:
> 
> Authentication Example
> 
> Here is an example login.config which then points to these files
> 
>     * users.properties
>     * groups.properties
> 
> Ok, so followed the links and created
> 
> -> login.config under $AMQ_HOME/conf:
> 
> activemq-domain {
>     org.apache.activemq.jaas.PropertiesLoginModule required
>         debug=true
>        
> org.apache.activemq.jaas.properties.user="org/apache/activemq/security/users.properties"
>        
> org.apache.activemq.jaas.properties.group="org/apache/activemq/security/groups.properties";
> };
> 
> -> users.properties under $AMQ_HOME/conf:
> 
> system=manager
> user=password
> guest=password
> 
> -> groups.properties under $AMQ_HOME/conf:
> 
> admins=system
> tempDestinationAdmins=system,user
> users=system,user
> guests=guest
> 
> via copy & paste from the documentation.
> 
> Then the documentation gets fuzzy and i don't know what the hell to do
> next.
> 
> I inserted this section into my activemq.xml
> 
> <plugins>
> <simpleAuthenticationPlugin>
> 	<users>
> 		<authenticationUser username="system" password="manager"
> 			groups="users,admins"/>
> 		<authenticationUser username="user" password="password"
> 			groups="users"/>
> 		<authenticationUser username="guest" password="password"
> groups="guests"/>
> 	</users>
> </simpleAuthenticationPlugin>
> 
> </plugins>
> 
> 
> like in the documentation example.
> 
> But when i start up the broker it gives me the error:
> 
> ACTIVEMQ_HOME: /opt/activemq_4
> ACTIVEMQ_BASE: /opt/activemq_4
> Loading message broker from: xbean:activemq.xml
> ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
> org.springframework.beans.factory.BeanDefinitionStoreException:
> Unrecognized xbean element mapping: authenticationUser in namespace
> http://activemq.org/config/1.0
> java.lang.RuntimeException: Failed to execute start task. Reason:
> org.springframework.beans.factory.BeanDefinitionStoreException:
> Unrecognized xbean element mapping: authenticationUser in namespace
> http://activemq.org/config/1.0
>         at
> org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:70)
>         at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:50)
>         at
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:82)
>         at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:50)
>         at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:46)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.activemq.console.Main.runTaskClass(Main.java:202)
>         at org.apache.activemq.console.Main.main(Main.java:91)
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
> Unrecognized xbean element mapping: authenticationUser in namespace
> http://activemq.org/config/1.0
>         at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:264)
> 
> 
> So, i am lost.
> 
> I know there is a more complicated example below in the documentation, but
> as far as i understood, the above steps are all that are necessary, to set
> up a simple, but working authentication?
> 
> Could somebody please give me a push in the right direction and tell me
> what i am doing wrong?
> 
> Thx in advance guys.......
> 

-- 
View this message in context: http://www.nabble.com/Simple-authentication-not-working%3A-Unrecognized-xbean-element-mapping%3A-authenticationUser-tp16765832s2354p16783334.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.