Duplicate instance of Bayeux Server created - cometd

I'm having a problem with my CometD Application. It looks like its creating multiple instances of the Bayeux Server. My configuration Files look like the following and i'm using Web Sockets as Transport/GigaSpaces to deploy the Application (which uses its own embedded jetty Server). Just wondering if I've misconfigured something in the following setup?
WEB.XML:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>CometDApplication</display-name>
<servlet>
<servlet-name>cometd</servlet-name>
<servlet-class>org.cometd.server.CometdServlet</servlet-class>
<init-param>
<param-name>jsonContext</param-name>
<param-value>org.cometd.server.JacksonJSONContextServer</param-value>
</init-param>
<init-param>
<param-name>transports</param-name>
<param-value>org.cometd.websocket.server.WebSocketTransport</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cometd</servlet-name>
<url-pattern>/cometd/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.openspaces.pu.container.jee.context.ProcessingUnitContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/META-INF/spring/pu.xml</param-value>
</context-param>
</web-app>
POM.XML:
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>bayeux-api</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>cometd-java-server</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>cometd-java-annotations</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>cometd-websocket-jetty</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>7.6.8.v20121106</version>
</dependency>
My Applcation Context File (pu.XML):
<bean id="Bayeux" class="org.cometd.server.BayeuxServerImpl" init-method="start" destroy-method="stop">
<property name="options">
<map>
<entry key="logLevel" value="0" />
<entry key="timeout" value="15000" />
</map>
</property>
<property name="transports">
<list>
<bean id="websocketTransport" class="org.cometd.websocket.server.WebSocketTransport">
<constructor-arg ref="Bayeux" />
</bean>
<bean id="jsonTransport" class="org.cometd.server.transport.JSONTransport">
<constructor-arg ref="Bayeux" />
</bean>
<bean id="jsonpTransport" class="org.cometd.server.transport.JSONPTransport">
<constructor-arg ref="Bayeux" />
</bean>
</list>
</property>
</bean>
<bean id="ContextExporter" class="org.springframework.web.context.support.ServletContextAttributeExporter">
<property name="attributes">
<map>
<entry key="org.cometd.bayeux">
<ref local="Bayeux" />
</entry>
</map>
</property>
</bean>

You are indeed creating two instances of BayeuxServer, one created by the CometdServlet you define in web.xml and one created by Spring.
Like stated in the CometD and Spring integration documentation, if you use Spring to initialize CometD, then your whole BayeuxServer configuration must be in Spring.
Don't duplicate it in web.xml.
Furthermore, since you define a <load-on-startup> element, the CometdServlet is initialized before Spring's ContextLoaderListener, creating a BayeuxServer instance before Spring gets the chance to create its own and export it.
Remove all <init-param> from web.xml, remove <load-on-startup> and you should be good: the servlet will be lazily initialized and will find the Spring-created BayeuxServer exported correctly, without creating an additional instance.

Related

How to generate WSDL file for SOAP Based web Service?

I have been recently working on a java project using spring to create few additional API's. The original web service already exist and so its wsdl file. Now i am suppose to add more features.
For this project, first .xsd request and response files are created and then from X2J xml files are auto generated to java files. Using these files as fields i also create the new API. Now i need to add these new API in exisiting wsdl. The existing wsdl is too long and so is there any way i can generate wsdl for new and old API .
web.xml file
<!-- Servlet to expose webservices -->
<servlet>
<servlet-name>messageDispatcher</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>messageDispatcher</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>messageDispatcher</servlet-name>
<url-pattern>*.wsdl</url-pattern>
</servlet-mapping>
messageDispatcher-servlet.xml file
<!-- Add supported requests here to define them in the WSDL -->
<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="xsds">
<list>
<value>classpath:xmlbind/zzzzRQ.xsd</value>
<value>classpath:xmlbind/zzzzRS.xsd</value>
<value>classpath:xmlbind/yyyyRQ.xsd</value>
<value>classpath:xmlbind/yyyyRS.xsd</value>
<!-- CONFIGURE WSDL -->
<bean id="XXXX" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schemaCollection" ref="schemaCollection"/>
<property name="portTypeName" value="ACVWS_"/>
<property name="locationUri" value="/services"/>
<property name="requestSuffix" value="RQ"/>
<property name="responseSuffix" value="RS"/>
</bean>
</bean>
<bean id="xxxx_v1_0" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
<property name="wsdl" value="classpath:/wsdl/xxxx_v1_0.wsdl"></property>
</bean>
<bean id="xxxx_v2_0" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
<property name="wsdl" value="classpath:/wsdl/xxxx_v2_0.wsdl"></property>
</bean>

Fetching data from facebook by Spring social

i am using Spring social for fetching the data from facebook but encountering a weird error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeController': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.social.facebook.api.Facebook
org.springframework.social.quickstart.HomeController.facebook; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type
[org.springframework.social.facebook.api.Facebook] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
I believe facebook object will come from the api. I don't have to define it manually.
my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
<display-name>Spring Social Facebook</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/forms/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
rootcontext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<!-- Enable #Annotation-drive bean configuration -->
<context:annotation-config />
<context:component-scan base-package="org" />
<!-- Configures External Property Resolution -->
<import resource="properties.xml" />
<!-- Configures Shared Data Access Resources -->
<!-- <import resource="data.xml" /> -->
<!-- Configures Spring Social -->
<bean class="org.springframework.social.quickstart.config.SocialConfig" />
</beans>
servlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC #Controller programming model -->
<annotation-driven />
<!-- Resolves views selected for rendering by #Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
</beans:beans>
In my controller I am autowiring my Facebook obj.
#Controller
public class HomeController {
#Autowired
private Facebook facebook;
/*
#Inject
public HomeController(Facebook facebook) {
this.facebook = facebook;
}*/
#RequestMapping(value = "/fb", method = RequestMethod.GET)
public String home(Model model) {
System.out.println("Inside home method");
List<Reference> friends = facebook.friendOperations().getFriends();
model.addAttribute("friends", friends);
return "home";
}
}
taken from spring social quickstart example. Probably you cant inject it by yourself, instead you have to use factory-like method:
#Bean
#Scope(value="request", proxyMode=ScopedProxyMode.INTERFACES)
public Facebook facebook() {
return connectionRepository().getPrimaryConnection(Facebook.class).getApi();
}
it needs other dependencies, no point to copy-paste them all here. Take a look at:
https://github.com/spring-projects/spring-social-samples/blob/master/spring-social-quickstart/src/main/java/org/springframework/social/quickstart/config/SocialConfig.java

Module declares a servlet class ....... , but the web.xml has no corresponding mapping

I have commited the maven project to svn its working on my machine but when other's import that maven project they get exception :
Module declares a servlet class ....... , but the web.xml has no
corresponding mapping; please add the following lines to your web.xml
and this class belongs to the library my project using. I dont understand what is the problem. Please help me.
module.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='engile'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name="com.google.gwt.inject.Inject" />
<inherits name="com.appops.ui.basic.Fields" />
<inherits name='com.mvp4g.Mvp4gModule' />
<inherits name="gwtupload.GWTUpload"/>
<inherits name='com.google.api.gwt.oauth2.OAuth2'/>
<inherits name="com.google.gwt.xml.XML"/>
<inherits name="org.atmosphere.gwt.Client"/>
<!-- Logger at client side -->
<inherits name = "com.google.gwt.logging.Logging"/>
<set-property name="gwt.logging.enabled" value="TRUE"/>
<set-property name="gwt.logging.logLevel" value="INFO"/>
<set-property name="gwt.logging.popupHandler" value="DISABLED" />
<set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />
<!-- Specify the app entry point class. -->
<entry-point class='com.engile.client.Engile'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- <set-property name="user.agent" value="safari"/>
<set-property name="user.agent" value="gecko1_8"/> -->
</module>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<filter>
<filter-name>guiceFilter</filter-name>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>guiceFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>com.engile.server.guice.BootstrapListener</listener-class>
</listener>
<servlet>
<description>AtmosphereServlet</description>
<servlet-name>AtmosphereServlet</servlet-name>
<servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.disableOnStateEvent</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.AtmosphereHandler</param-name>
<param-value>com.engile.server.services.AtmosphereHandler</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AtmosphereServlet</servlet-name>
<url-pattern>/engile/gwtComet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>remoteLoggingService</servlet-name>
<servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>remoteLoggingService</servlet-name>
<url-pattern>/engile/remote_logging</url-pattern>
</servlet-mapping>
<!-- <servlet>
<servlet-name>testImpl</servlet-name>
<servlet-class>com.appops.server.TestImpl</servlet-class> </servlet>
<servlet-mapping> <servlet-name>testImpl</servlet-name>
<url-pattern>/engile/test</url-pattern>
</servlet-mapping> -->
<welcome-file-list>
<welcome-file>Engile.html</welcome-file>
</welcome-file-list>
</web-app>
You need to check all your interfaces which extends RemoteService and have declared a RemoteServiceRelativePath annotation, ensure that all such relative paths get mapped in web.xml
Example - in https://developers.google.com/web-toolkit/doc/latest/tutorial/RPC
#RemoteServiceRelativePath("stockPrices")
public interface StockPriceService extends RemoteService {
}
gets mapped to
<!-- Servlets -->
<servlet>
<servlet-name>stockPriceServiceImpl</servlet-name>
<servlet-class>com.google.gwt.sample.stockwatcher.server.StockPriceServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>stockPriceServiceImpl</servlet-name>
<url-pattern>/stockwatcher/stockPrices</url-pattern>
</servlet-mapping>

How to use spring form taglib in conjunction with maven?

I added spring-webmvc to my maven dependencies.
According to some page I found I need to use this:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
It works fine and I can see the jar file in my m2 local repository.
But my problem is that I'm getting an error in my JSP file that says "The tag handler class for "form:form" (org.springframework.web.servlet.tags.form.FormTag) was not found on the Java Build Path".
It obviously is looking for org.springframework.web.servlet BUT I thought adding spring-webmvc would fix it as mentioned is several search results I've read. Plus I've used "org.springframework.web.servlet.view.UrlBasedViewResolver" in my spring bean configuration XML so I know it's loading parts of the spring-webmvc.
I've looked at repo1.maven.org and mvnrepository.com and I never saw them mentioned org.springframework.web.servlet.
I then decided to add web.servlet according to the springsource page (http://ebr.springsource.com/repository/app/bundle/version/detail?name=org.springframework.web.servlet&version=3.1.3.RELEASE)
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web.servlet</artifactId>
<version>${org.springframework.version}</version>
</dependency>
But I then get this error "Missing artifact org.springframework:org.springframework.web.servlet:jar:3.1.3.RELEASE".
I added springsource own repo (http://ebr.springsource.com/repository/app/faq) to my pom.xml but I get the same "missing artifact" message.
I guess I'm stuck and need your help. thanks :)
Not sure if this is relevant but I've included 3 XML config files. :)
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Spring3MVC</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>
spring-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="org.flinders.staffdirectory.controllers" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" >
<value>org.springframework.web.servlet.view.tiles2.TilesView</value>
</property>
</bean>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
</beans>
pom.xml
<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>org.flinders.staff.directory</groupId>
<artifactId>directory-maven</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>directory-maven Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<org.springframework.version>3.1.3.RELEASE</org.springframework.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.2.2</version>
</dependency>
</dependencies>
<build>
<finalName>directory-maven</finalName>
</build>
</project>
I normally put this page directive at the top of the file:
<%# taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
Which should make sure that the form taglib is being loaded in the JSP.
Seems like I forgot to pass a modelAttribute to my form:
return new ModelAndView("search/SearchForm", "search", new Search());
I was able to resolve the issue by adding the taglib directive as the first line in the file.

Spring Security method authorization not working

here is the description of problem. I am develepping a web application with GWT. I have successfullly integrate spring security with gwt for the authentication feature with the following code. Now I want to use the spring "method security" in my web application. So I did what it says in http://static.springsource.org/spring-security/site/docs/3.1.x/reference/ns-config.html,
just adding <global-method-security secured-annotations="enabled"/> in the above mentionned application context file.
<http>
<http-basic/>
<intercept-url pattern="/**" access=""/>
<form-login />
<logout />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="jimis" password="jimispassword" authorities="ROLE_USER,ROLE_ADMIN" />
<user name="bob" password="bobspassword" authorities="ROLE_ADMIN" />
</user-service>
</authentication-provider>
</authentication-manager>
**<global-method-security secured-annotations="enabled"/>**
then adding the annotation #Secured("ROLE_ADMIN") above the function that I what to controle the access
Then I add the declaration of application context in the web.xml as following:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>App.html</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>10</session-timeout> <!-- in minutes -->
</session-config>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext-security.xml
</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appService</servlet-name>
<servlet-class>com.google.gwt.app.example.server.AppServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>appService</servlet-name>
<url-pattern>/app/appService.rpc</url-pattern>
</servlet-mapping>
</web-app>
Note that I've just declared the gwt-servlet not the spring dispatcher servlet.
However it seems that this configuration doesn't work. In fact, whatever role can have the authority to access the function.
Very Strange.
Hope your answers!
Use a single global-method-security element containing both attributes.
Also read the relevant section of the Spring Security FAQ on issues with using method security and web controllers, if that's what you are doing (you will also find the same issue discussed here).
The log message you report is not an error and is unimportant unless you are using hasPermission() within your expressions.