Spring Security 4.0.0 WebSocket issue adding tag <intercept-message pattern="/topic/**" access="hasRole('COORDINATOR')" /> generated exception -


i trying configure spring security websockets , getting problem when add next line <security:intercept-message pattern="/topic/**" access="hasrole('coordinator')" /> security-config.xml. exception org.springframework.beans.factory.beancreationexception: error creating bean name'org.springframework.security.messaging.access.expression.expressionbasedmessagesecuritymetadatasourcefactory#0'

i appreciate guys can give me.

i attach information below

pom-xml

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>com.prueba</groupid>     <artifactid>prueba</artifactid>     <name>prueba</name>     <packaging>war</packaging>     <version>1.0.0-build-snapshot</version>     <properties>         <java-version>1.7</java-version>         <org.springframework-version>4.1.6.release</org.springframework-version>          <org.aspectj-version>1.8.0</org.aspectj-version>         <org.slf4j-version>1.7.7</org.slf4j-version>     </properties>     <dependencies>         <!-- spring -->         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-context</artifactid>             <version>${org.springframework-version}</version>             <exclusions>                 <!-- exclude commons logging in favor of slf4j -->                 <exclusion>                     <groupid>commons-logging</groupid>                     <artifactid>commons-logging</artifactid>                  </exclusion>             </exclusions>         </dependency>           <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-webmvc</artifactid>             <version>${org.springframework-version}</version>         </dependency>          <!-- aspectj -->         <dependency>             <groupid>org.aspectj</groupid>             <artifactid>aspectjrt</artifactid>             <version>1.8.0</version>         </dependency>             <!-- logging -->         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-api</artifactid>             <version>1.7.7</version>         </dependency>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>jcl-over-slf4j</artifactid>             <version>1.7.7</version>         </dependency>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-log4j12</artifactid>             <version>1.7.7</version>         </dependency>         <dependency>             <groupid>log4j</groupid>             <artifactid>log4j</artifactid>             <version>1.2.15</version>             <exclusions>                 <exclusion>                     <groupid>javax.mail</groupid>                     <artifactid>mail</artifactid>                 </exclusion>                 <exclusion>                     <groupid>javax.jms</groupid>                     <artifactid>jms</artifactid>                 </exclusion>                 <exclusion>                     <groupid>com.sun.jdmk</groupid>                     <artifactid>jmxtools</artifactid>                 </exclusion>                 <exclusion>                     <groupid>com.sun.jmx</groupid>                     <artifactid>jmxri</artifactid>                 </exclusion>             </exclusions>         </dependency>          <!-- @inject -->         <dependency>             <groupid>javax.inject</groupid>             <artifactid>javax.inject</artifactid>             <version>1</version>         </dependency>          <!-- servlet -->         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>servlet-api</artifactid>             <version>2.5</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>javax.servlet.jsp</groupid>             <artifactid>jsp-api</artifactid>             <version>2.1</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>jstl</artifactid>             <version>1.2</version>         </dependency>          <!-- test -->         <dependency>             <groupid>junit</groupid>             <artifactid>junit</artifactid>             <version>4.7</version>             <scope>test</scope>         </dependency>         <dependency>             <groupid>org.postgresql</groupid>             <artifactid>postgresql</artifactid>             <version>9.3-1101-jdbc41</version>         </dependency>         <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-core</artifactid>             <version>4.3.5.final</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-orm</artifactid>             <version>${org.springframework-version}</version>         </dependency>         <!-- spring security -->         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-core</artifactid>             <version>4.0.0.release</version>         </dependency>         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-web</artifactid>             <version>4.0.0.release</version>         </dependency>         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-config</artifactid>             <version>4.0.0.release</version>         </dependency>         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-messaging</artifactid>             <version>4.0.0.release</version>         </dependency>         <dependency>             <groupid>org.springframework.security.oauth</groupid>             <artifactid>spring-security-oauth2</artifactid>             <version>1.0.0.release</version>         </dependency>         <!-- end spring security -->          <!-- thymeleaf -->         <dependency>             <groupid>org.thymeleaf</groupid>             <artifactid>thymeleaf-spring4</artifactid>             <version>2.1.4.release</version>         </dependency>         <dependency>             <groupid>org.thymeleaf.extras</groupid>             <artifactid>thymeleaf-extras-springsecurity4</artifactid>             <version>2.1.2-snapshot</version>             <scope>compile</scope>         </dependency>         <dependency>             <groupid>nz.net.ultraq.thymeleaf</groupid>             <artifactid>thymeleaf-layout-dialect</artifactid>             <version>1.2.7</version>         </dependency>         <dependency>             <groupid>org.apache.httpcomponents</groupid>             <artifactid>httpclient</artifactid>             <version>4.3.4</version>         </dependency>         <!--  json - jackson-->         <dependency>             <groupid>org.json</groupid>             <artifactid>json</artifactid>             <version>20140107</version>         </dependency>         <dependency>             <groupid>com.fasterxml.jackson.core</groupid>             <artifactid>jackson-databind</artifactid>             <version>2.4.3</version>         </dependency>         <dependency>             <groupid>com.fasterxml.jackson.datatype</groupid>             <artifactid>jackson-datatype-hibernate4</artifactid>             <version>2.4.3</version>         </dependency>         <dependency>             <groupid>com.fasterxml.jackson.core</groupid>             <artifactid>jackson-core</artifactid>             <version>2.4.3</version>         </dependency>         <dependency>             <groupid>com.fasterxml.jackson.core</groupid>             <artifactid>jackson-annotations</artifactid>             <version>2.4.3</version>         </dependency>         <!-- end json - jackson -->         <dependency>             <groupid>commons-fileupload</groupid>             <artifactid>commons-fileupload</artifactid>             <version>1.3.1</version>         </dependency>         <dependency>             <groupid>net.sf.supercsv</groupid>             <artifactid>super-csv</artifactid>             <version>2.2.0</version>         </dependency>         <!-- mail -->         <dependency>             <groupid>com.sun.mail</groupid>             <artifactid>javax.mail</artifactid>             <version>1.5.2</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-context-support</artifactid>             <version>${org.springframework-version}</version>         </dependency>         <!-- end mail -->         <!--  websocket-->         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-messaging</artifactid>             <version>${org.springframework-version}</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-websocket</artifactid>             <version>${org.springframework-version}</version>         </dependency>     </dependencies>     <repositories>         <repository>             <id>sonatype-nexus-snapshots</id>             <name>sonatype nexus snapshots</name>             <url>https://oss.sonatype.org/content/repositories/snapshots</url>             <snapshots>             <enabled>true</enabled>             </snapshots>         </repository>     </repositories>     <build>         <plugins>             <plugin>                 <artifactid>maven-eclipse-plugin</artifactid>                 <version>2.9</version>                 <configuration>                     <additionalprojectnatures>                         <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>                     </additionalprojectnatures>                     <additionalbuildcommands>                         <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>                     </additionalbuildcommands>                     <downloadsources>true</downloadsources>                     <downloadjavadocs>true</downloadjavadocs>                 </configuration>             </plugin>             <plugin>                 <groupid>org.apache.maven.plugins</groupid>                 <artifactid>maven-compiler-plugin</artifactid>                 <version>2.5.1</version>                 <configuration>                     <source>1.7</source>                     <target>1.7</target>                     <encoding>utf-8</encoding>                     <compilerargument>-xlint:all</compilerargument>                     <showwarnings>true</showwarnings>                     <showdeprecation>true</showdeprecation>                 </configuration>             </plugin>             <plugin>                 <groupid>org.codehaus.mojo</groupid>                 <artifactid>exec-maven-plugin</artifactid>                 <version>1.2.1</version>                 <configuration>                     <mainclass>org.test.int1.main</mainclass>                 </configuration>             </plugin>         </plugins>      </build> </project> 

servlet-context - config websocket

<websocket:message-broker application-destination-prefix="/app" >     <websocket:stomp-endpoint path="/portfolio">         <websocket:sockjs />     </websocket:stomp-endpoint>     <websocket:simple-broker prefix="/queue, /topic" />     <websocket:client-inbound-channel>         <websocket:interceptors>             <beans:bean class="com.prueba.prueba.controller.websocket.channelinterceptor"></beans:bean>         </websocket:interceptors>     </websocket:client-inbound-channel> </websocket:message-broker> 

security-context.xml

<security:websocket-message-broker>   <security:intercept-message pattern="/topic/**" access="hasrole('coordinator')" /> </security:websocket-message-broker> 

execption

org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.security.messaging.access.expression.expressionbasedmessagesecuritymetadatasourcefactory#0': cannot create inner bean '(inner bean)#5b83e49b' of type [org.springframework.security.messaging.util.matcher.simpdestinationmessagematcher] while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name '(inner bean)#5b83e49b': cannot resolve reference bean 'springsecuritymessagepathmatcher' while setting constructor argument; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'springsecuritymessagepathmatcher' defined     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolveinnerbean(beandefinitionvalueresolver.java:313)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvevalueifnecessary(beandefinitionvalueresolver.java:129)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvemanagedmap(beandefinitionvalueresolver.java:406)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvevalueifnecessary(beandefinitionvalueresolver.java:165)     @ org.springframework.beans.factory.support.constructorresolver.resolveconstructorarguments(constructorresolver.java:634)     @ org.springframework.beans.factory.support.constructorresolver.instantiateusingfactorymethod(constructorresolver.java:444)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiateusingfactorymethod(abstractautowirecapablebeanfactory.java:1119)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbeaninstance(abstractautowirecapablebeanfactory.java:1014)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:504)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:476)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:303)     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:299)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:755)     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:757)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:480)     @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:403)     @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:306)     @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:106)     @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4728)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5166)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1409)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1399)     @ java.util.concurrent.futuretask.run(unknown source)     @ java.util.concurrent.threadpoolexecutor.runworker(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)     @ java.lang.thread.run(unknown source) caused by: org.springframework.beans.factory.beancreationexception: error creating bean name '(inner bean)#5b83e49b': cannot resolve reference bean 'springsecuritymessagepathmatcher' while setting constructor argument; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'springsecuritymessagepathmatcher' defined     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvereference(beandefinitionvalueresolver.java:359)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvevalueifnecessary(beandefinitionvalueresolver.java:108)     @ org.springframework.beans.factory.support.constructorresolver.resolveconstructorarguments(constructorresolver.java:634)     @ org.springframework.beans.factory.support.constructorresolver.autowireconstructor(constructorresolver.java:140)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.autowireconstructor(abstractautowirecapablebeanfactory.java:1139)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbeaninstance(abstractautowirecapablebeanfactory.java:1042)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:504)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:476)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolveinnerbean(beandefinitionvalueresolver.java:299)     ... 28 more caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'springsecuritymessagepathmatcher' defined     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.getbeandefinition(defaultlistablebeanfactory.java:687)     @ org.springframework.beans.factory.support.abstractbeanfactory.getmergedlocalbeandefinition(abstractbeanfactory.java:1168)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:281)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194)     @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvereference(beandefinitionvalueresolver.java:351)     ... 36 more 

try add

`<beans:bean id="springsecuritymessagepathmatcher" class="org.springframework.util.antpathmatcher"/>` 

in spring-security.xml


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -