Announcement Announcement Module
Collapse
No announcement yet.
Spring Mobile Device Resolution Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Mobile Device Resolution

    Hi,

    I am trying to follow the Spring Mobile reference document http://static.springsource.org/sprin...ce/htmlsingle/

    I am trying to implement the Device Resolution..

    In the document it says add the follwing to your class path:

    Code:
    <dependency>
        <groupId>org.springframework.mobile</groupId>
        <artifactId>spring-mobile-device</artifactId>
        <version>${org.springframework.mobile-version}</version>
    </dependency>
    Does this mean add it to the pom.xml?

    Then it goes on to say add the following to you dispatch servlet...

    Code:
    <mvc:interceptors>
        <!-- On pre-handle, resolve the device that originated the web request -->
        <beans:bean class="org.springframework.mobile.device.DeviceResolverHandlerInterceptor" />
    </mvc:interceptors>
    I tried to add it to servlet-context.xml but I am getting a lot of errors...

    When I add the dependency to the pom.xml I get


    Description Resource Path Location Type
    Failed to read artifact descriptor for org.springframework.mobile:spring-mobile-device:jar:${org.springframework.mobile-version} pom.xml /TestApp line 1 Maven Problem

    And in the servlet-context.xml I get

    Description Resource Path Location Type
    Error occured processing XML 'The prefix "mvc" for element "mvc:interceptors" is not bound.'. See Error Log for more details servlet-context.xml /TestApp/src/main/webapp/WEB-INF/spring/appServlet Unknown Spring Beans Problem
    I tried adding the spring-mobile-device-1.0.0.M3.jar file to the project, but this has not resolved the errors. The documentation does not seem to be that helpful as a step by step guide... even though it seems simple.

    Any help appreciated!

    Thanks

    Jin

  • #2
    First make sure Maven was actually able to add the jar to your classpath. Did you define the ${org.springframework.mobile-version} property? Looks like it didn't resolve. You could also just put in the version directly of 1.0.0.M3. You need to make sure also the springframework milestone repository is added to your pom, otherwise the dependency won't be able to be resolved.

    As for the namespace error, you need to make sure the mvc namespace has been declared in the root element of your xml file.

    You might want to review and run the lite-showcase sample at https://github.com/SpringSource/spring-mobile-samples for additional reference.

    The documentation makes some basic assumptions that people understand how to use Maven and Spring Framework.

    Comment

    Working...
    X