2010-10-09 2 views
3

Я пытаюсь настроить Весна с веб-сервера Geronimo, но я получаю следующее сообщение об ошибке:Ошибка при публикации Spring приложения на веб-сервере Geronimo

2010-10-08 18:52:45,105 WARN [PathMatchingResourcePatternResolver] Cannot search for matching files underneath URL [bundle://316.0:1/com/unveiled/politics/] because it does not correspond to a directory in the file system 
java.io.FileNotFoundException: URL [bundle://316.0:1/com/unveiled/politics/] cannot be resolved to absolute file path because it does not reside in the file system: bundle://316.0:1/com/unveiled/politics/ 
at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:204) 
at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:51) 
at org.springframework.core.io.UrlResource.getFile(UrlResource.java:168) 
... 

Это приложение работает на JBoss AS.

Некоторые другие конфигурационные файлы, которые имеют значение:

web.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 
    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"> 

    <!-- Handles all requests into the application --> 
    <servlet> 
     <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <init-param> 
      <param-name>contextConfigLocation</param-name> 
      <param-value> 
       /WEB-INF/spring/app-config.xml 
      </param-value> 
     </init-param> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
     <url-pattern>/*</url-pattern> 
    </servlet-mapping> 

</web-app> 

приложение-config.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"> 

    <!-- Scans the classpath of this application for @Components to deploy as beans --> 
    <context:component-scan base-package="com.unveiled.politics" /> 

    <!-- Configures Spring MVC --> 
    <import resource="mvc-config.xml" /> 

</beans> 

MVC-config.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:mvc="http://www.springframework.org/schema/mvc" 
    xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> 

    <!-- Configures the @Controller programming model --> 
    <mvc:annotation-driven /> 

    <!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory --> 
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
     <property name="prefix" value="/WEB-INF/views/"/> 
     <property name="suffix" value=".jsp"/> 
    </bean> 

</beans> 

WelcomeControlle r.java:

package com.unveiled.politics.controllers; 

import org.springframework.stereotype.Controller; 
import org.springframework.ui.ModelMap; 
import org.springframework.web.bind.annotation.RequestMapping; 
import org.springframework.web.bind.annotation.RequestMethod; 
import org.springframework.web.bind.annotation.RequestParam; 

@Controller 
public class WelcomeController { 
    @RequestMapping(value="welcome", method = RequestMethod.GET) 
    public String getWelcomePage(ModelMap model) { 
     return "index"; 
    } 
} 

ответ

1

компонент сканирования будет работать только в случае, если приложение (будь то EAR или WAR) распаковывается приложением к файловой системе. Службы приложений обычно будут делать это в любом случае по причинам производительности во время исполнения.

Так что, похоже, ваш сервер Geronimo этого не делает. Надеемся, что есть где-нибудь, где вы можете настроить распаковку приложения перед его запуском.

Смежные вопросы