Cannot access to service on the server

75 views
Skip to first unread message

iva...@gmail.com

unread,
Feb 18, 2013, 12:24:47 PM2/18/13
to gwt...@googlegroups.com
Hi there,

I'm using

Spring 3.1
GWT 2.5
GWT SL 1.1

When I try to make RPC call (eg /SmbApp/service/authenticate), I get the error as follows:

[ERROR] 500 - GET /SmbApp/service/authenticate (127.0.0.1) 57 bytes
The call failed on the server; see server log for details

Please help

Ivan

---------------------------------------------------------------------------------------------------------------------------------------------------------
web.xml

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml </param-value>
    </context-param>
   
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

<servlet>
        <servlet-name>handler</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
   
    <servlet-mapping>
        <servlet-name>handler</servlet-name>
        <url-pattern>/SmbApp/service/*</url-pattern>
    </servlet-mapping>
   
    <servlet>
        <servlet-name>ResultDownloadServlet</servlet-name>
        <servlet-class>com.smb.app.gwt.server.ServiceImpl.ResultDownloadServlet</servlet-class>
    </servlet>
   
    <servlet-mapping>
        <servlet-name>ResultDownloadServlet</servlet-name>
        <url-pattern>/SmbApp/service/resultDownload</url-pattern>
    </servlet-mapping>

---------------------------------------------------------------------------------------------------------------------------------------------------------

handler-servlet.xml

<bean id="accountService" class="com.smb.app.gwt.server.ServiceImpl.AccountServiceImpl" />
   
    <bean id="authenticationService" class="com.smb.app.gwt.server.ServiceImpl.AuthenticationServiceImpl" >
        <property name="userRoleProperty" ref="userRoleProperty" />
    </bean>
   
    <bean id="contactService" class="com.smb.app.gwt.server.ServiceImpl.ContactServiceImpl" />
   
    <bean id="productionService" class="com.smb.app.gwt.server.ServiceImpl.ProductionServiceImpl" />   
   
    <bean id="payrollService" class="com.smb.app.gwt.server.ServiceImpl.PayrollServiceImpl" />

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <map>
                <entry key="/account" value-ref="accountService" />
                <entry key="/authenticate" value-ref="authenticationService" />
                <entry key="/contact" value-ref="contactService" />
                <entry key="/production" value-ref="productionService" />
                <entry key="/payroll" value-ref="payrollService" />
            </map>
        </property>
    </bean>

---------------------------------------------------------------------------------------------------------------------------------------------------------

applicationContext.xml

<context:annotation-config />
   
    <tx:annotation-driven />
   
    <context:component-scan base-package="com.smb.app.gwt.server" />
   
    <util:properties id="configurationProperty" location="classpath:com/smb/app/gwt/server/resource/configurationProperty.properties" />

    <util:properties id="userRoleProperty" location="classpath:com/smb/app/gwt/server/resource/userRole.properties" />
   
---------------------------------------------------------------------------------------------------------------------------------------------------------

com.smb.app.gwt.server.ServiceImpl.AuthenticationServiceImpl

public class AuthenticationServiceImpl extends GWTSpringController implements AuthenticationService {

---------------------------------------------------------------------------------------------------------------------------------------------------------
com.smb.app.gwt.client.service.security.AuthenticationService

@RemoteServiceRelativePath("service/authenticate")
public interface AuthenticationService extends RemoteService {





George Georgovassilis

unread,
Feb 18, 2013, 3:13:06 PM2/18/13
to gwt...@googlegroups.com
Hello Ivan,

The configuration you posted looks ok. The error code 500 means that the
RPC request is probably handled, a mistake in URL mappings would result
in a 404. There should be some logs on the server, i.e. the server
console. If you don't see them, check any messages during the
application start about log4j or similar not being configured and
resolve them, then you would get a meaningful stacktrace which might
point out were the real problem lies.
> --
> You received this message because you are subscribed to the Google
> Groups "gwt-sl" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to gwt-sl+un...@googlegroups.com.
> To post to this group, send an email to gwt...@googlegroups.com.
> Visit this group at http://groups.google.com/group/gwt-sl?hl=en-GB.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

iva...@gmail.com

unread,
Feb 18, 2013, 9:49:08 PM2/18/13
to gwt...@googlegroups.com
Hi George,

Yes, the RPC is able to send the call to the server but somehow the server doesn't work as it should. I have pasted the error from Jetty (GWT Dev Mode) and info from my terminal console. Please have a look and see if you can spot any error.

Thanks.

Regards,
Ivan

Here is the error message from Jetty

00:00:18.875 [WARN] Exception while dispatching incoming RPC call
javax.servlet.ServletException: Content-Type must be 'text/plain' with 'charset=utf-8' (or unspecified charset)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.readPayloadAsUtf8(RemoteServiceServlet.java:119)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:178)
at org.gwtwidgets.server.spring.GWTSpringController.handleRequest(GWTSpringController.java:88)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

------------------------------------------------------------------------------------------------------------------------------------------------------------------
Here is the information from the terminal

[INFO] Building GWT Maven Archetype 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> gwt-maven-plugin:2.5.0:run (default-cli) @ smb >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ smb ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ smb ---
[INFO] Compiling 2 source files to /Users/ivan/Documents/workspace/smb/target/smb-1.0-SNAPSHOT/WEB-INF/classes
[INFO]
[INFO] --- maven-war-plugin:2.1.1:exploded (default) @ smb ---
[INFO] Exploding webapp
[INFO] Assembling webapp [smb] in [/Users/ivan/Documents/workspace/smb/target/smb-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/ivan/Documents/workspace/smb/src/main/webapp]
[INFO] Webapp assembled in [1799 msecs]
[INFO]
[INFO] <<< gwt-maven-plugin:2.5.0:run (default-cli) @ smb <<<
[INFO]
[INFO] --- gwt-maven-plugin:2.5.0:run (default-cli) @ smb ---
[WARNING] Don't declare gwt-dev as a project dependency. This may introduce complex dependency conflicts
[INFO] create exploded Jetty webapp in /Users/ivan/Documents/workspace/smb/target/smb-1.0-SNAPSHOT
[INFO] auto discovered modules [com.smb.app.gwt.SmbApp]
[ERROR] Feb 19, 2013 12:34:36 PM org.springframework.web.context.ContextLoader initWebApplicationContext
[ERROR] INFO: Root WebApplicationContext: initialization started
[ERROR] Feb 19, 2013 12:34:36 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
[ERROR] INFO: Refreshing Root WebApplicationContext: startup date [Tue Feb 19 12:34:36 CST 2013]; root of context hierarchy
[ERROR] Feb 19, 2013 12:34:36 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
[ERROR] INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
[ERROR] Feb 19, 2013 12:34:37 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
[ERROR] INFO: Overriding bean definition for bean 'userAccountDao': replacing [Generic bean: class [com.smb.app.gwt.server.dao.UserAccountDao]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [/Users/ivan/Documents/workspace/smb/target/smb-1.0-SNAPSHOT/WEB-INF/classes/com/smb/app/gwt/server/dao/UserAccountDao.class]] with [Generic bean: class [com.smb.app.gwt.server.dao.UserAccountDao]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]]

[ERROR] Feb 19, 2013 12:34:37 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
[ERROR] INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3e66fac4: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,customerDao,accountDao,administrationDao,contactDao,payrollDao,productionDao,userAccountDao,configurationProperty,userRoleProperty,messageSource,dataSource,jpaVendorAdapter,emf,transactionManager,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
[ERROR] Feb 19, 2013 12:34:38 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
[ERROR] INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
[ERROR] Feb 19, 2013 12:34:38 PM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory
[ERROR] INFO: Building JPA container EntityManagerFactory for persistence unit 'SmbPU'
[ERROR] Feb 19, 2013 12:34:40 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
[ERROR] INFO: Loading properties file from class path resource [com/smb/app/gwt/server/resource/configurationProperty.properties]
[ERROR] Feb 19, 2013 12:34:40 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
[ERROR] INFO: Loading properties file from class path resource [com/smb/app/gwt/server/resource/userRole.properties]
[ERROR] Feb 19, 2013 12:34:40 PM org.springframework.web.context.ContextLoader initWebApplicationContext
[ERROR] INFO: Root WebApplicationContext: initialization completed in 4528 ms
[ERROR] Feb 19, 2013 12:34:40 PM org.springframework.web.servlet.FrameworkServlet initServletBean
[ERROR] INFO: FrameworkServlet 'handler': initialization started
[ERROR] Feb 19, 2013 12:34:40 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
[ERROR] INFO: Refreshing WebApplicationContext for namespace 'handler-servlet': startup date [Tue Feb 19 12:34:40 CST 2013]; parent: Root WebApplicationContext
[ERROR] Feb 19, 2013 12:34:40 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
[ERROR] INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/handler-servlet.xml]
[ERROR] Feb 19, 2013 12:34:41 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
[ERROR] INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3cc54b88: defining beans [accountService,authenticationService,contactService,productionService,payrollService,urlMapping]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@3e66fac4
[INFO] User role
[ERROR] Feb 19, 2013 12:34:41 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
[ERROR] INFO: Mapped URL path [/authenticate] onto handler of type [class com.smb.app.gwt.server.ServiceImpl.AuthenticationServiceImpl]
[ERROR] Feb 19, 2013 12:34:41 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
[ERROR] INFO: Mapped URL path [/account] onto handler of type [class com.smb.app.gwt.server.ServiceImpl.AccountServiceImpl]
[ERROR] Feb 19, 2013 12:34:41 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
[ERROR] INFO: Mapped URL path [/contact] onto handler of type [class com.smb.app.gwt.server.ServiceImpl.ContactServiceImpl]
[ERROR] Feb 19, 2013 12:34:41 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
[ERROR] INFO: Mapped URL path [/production] onto handler of type [class com.smb.app.gwt.server.ServiceImpl.ProductionServiceImpl]
[ERROR] Feb 19, 2013 12:34:41 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
[ERROR] INFO: Mapped URL path [/payroll] onto handler of type [class com.smb.app.gwt.server.ServiceImpl.PayrollServiceImpl]
[ERROR] Feb 19, 2013 12:34:41 PM org.springframework.web.servlet.FrameworkServlet initServletBean
[ERROR] INFO: FrameworkServlet 'handler': initialization completed in 688 ms

George Georgovassilis

unread,
Feb 19, 2013, 2:52:13 AM2/19/13
to gwt...@googlegroups.com
Hello Ivan,

The exception points towards a bad RPC communication where the browser submits an incorrect request to the RPC url.

A couple of things to check:

1. Make sure you are not typing the RPC URL into the browser address field but the one for your GWT application (the HTML stuff)
2. Get firebug (or equivalent) and check that the browser is invoking the correct RPC URL. Also check that the request Content-Type is correct
3. And 'correct' brings me to the main point: since you are using GWT-2.5 that RPC request Content-Type should be 'text/x-gwt-rpc; charset=utf-8', but the exception displays a different message. Since the SL-1.1 which you are using is not exactly the freshest one I suspect that your maven dependencies got mingled: the client part is compiled with GWT-2.5 but the server part is deployed with an earlier version of GWT. Please note that despite a few efforts, the SL is not mavenised, you need to store the correct SL jar in a private repository and specify the dependencies yourself.
Reply all
Reply to author
Forward
0 new messages