Javafree
 Forum   Topics   Author   Post 
Spring Framework HTTP Status 404 Error - Spring MVC Dispatcher Servlet is not available TheJayybe Olá. estou tendo problemas ao tentar implementar o Spring MVC, e estou nisso a tarde toda :). Adicionei ao class-path todos os JARs do spring-3.2.4-src. A mensagem de erro é: "HTTP Status 404 - Servlet Spring MVC Dispatcher Servlet is not available". web.xml: [code] <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"[wmv] 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_4.xsd" > <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-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>[/wmv] <servlet-mapping> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app> [/code] spring-context.xml: [code] <?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" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="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 http://www.springframework.org/schema/spring-context-3.0.xsd"> <context:component-scan base-package="br.com.springmvc.jayybe"/> <mvc:annotation-driven /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views"/> <property name="suffix" value=".jsp"/> </bean> </beans> [/code] OlaMundoController: [code] package br.com.springmvc.jayybe; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class OlaMundoController { @RequestMapping("/olaMundo") public String execute(){ System.out.print("Executando a lógica com Spring MVC"); return "ok"; } } [/code] Erro no console: [code]Out 19, 2013 8:27:16 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Arquivos de programas\Java\jre7\bin;C:\WINDOWS.0\Sun\Java\bin;C:\WINDOWS.0\system32;C:\WINDOWS.0;C:/Arquivos de programas/Java/jre7/bin/client;C:/Arquivos de programas/Java/jre7/bin;C:/Arquivos de programas/Java/jre7/lib/i386;C:\Arquivos de programas\Intel\iCLS Client\;C:\WINDOWS.0\system32;C:\WINDOWS.0;C:\WINDOWS.0\system32\WBEM;C:\Arquivos de programas\QuickTime\QTSystem\;C:\Arquivos de programas\MySQL\MySQL Utilities 1.3.4\;D:\Eclipse;;. Out 19, 2013 8:27:16 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:TesteWeb' did not find a matching property. Out 19, 2013 8:27:16 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Out 19, 2013 8:27:16 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Out 19, 2013 8:27:16 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 523 ms Out 19, 2013 8:27:16 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Out 19, 2013 8:27:16 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.22 Out 19, 2013 8:27:17 PM org.apache.catalina.core.ApplicationContext log INFO: Marking servlet Spring MVC Dispatcher Servlet as unavailable Out 19, 2013 8:27:17 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /TesteWeb threw load() exception java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523) at org.springframework.web.servlet.DispatcherServlet.<clinit>(DispatcherServlet.java:246) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:127) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Out 19, 2013 8:27:17 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Out 19, 2013 8:27:17 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Out 19, 2013 8:27:17 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 433 ms Out 19, 2013 8:27:31 PM org.apache.catalina.core.StandardWrapperValve invoke INFO: Servlet Spring MVC Dispatcher Servlet is currently unavailable [/code] Obrigado
Java Avançado Compartilhar arquivo de texto entre duas aplicações. TheJayybe [b]O[/b]lá, criei uma aplicação em outra plataforma que não é a Java cujos usuários em máquinas distintas compartilham suas informações através de TXT, cada um com o seu próprio arquivo de texto tudo isso guardado em uma pasta de uma máquina da rede. Entretanto quando uma das aplicações é fechada não pode excluir seu arquivo de texto. [b]P[/b]ara isso criei um aplicativo Java para apenas comunicar-se com as aplicações, a aplicação do usuário escreve no arquivo o caractere '0' e a aplicação Java que recebe a informação, e responde com '1' e assim sucessivamente. Entretanto o Java tem acusado a exceção [i]'java.io.FileNotFoundException: (O arquivo já está sendo usado por outro processo)'[/i] pois por mais que eu feche os arquivos após a leitura ou gravação hora ou outra eles se tocam e a aplicação Java encerra. Alguma sugestão ao mesmo?
Goto page 1