E o código do Vraptor que irá tratar o evento e responder:
@Path("/restante/popularcontrato/{uf}")
public void populaComboContrato(String uf){
System.out.println("TESTE POPULAR");
List<Contrato> lista = contratodao.list(uf);
StringBuilder options = new StringBuilder();
options.append("<option value=''></option>");
if(!uf.equalsIgnoreCase("")){
for (Contrato c : lista) {
options.append("<option value=");
options.append("'" + c.getCod() + "'>");
options.append(c.getNome() + "-" + c.getUf());
options.append("</option>");
}
}
writer.print(options);
result.use(Results.nothing());
}
Porém, a Jquery sequer está acessando minha url.
Já tentei escrever a url de várias maneiras:
’/restante/popularcontrato/’
‘restante/popularcontrato/’
’/popularcontrato/’
‘popularcontrato/’
Achei que o problema pudesse ser o arquivo js com a biblioteca do jquery, mas tenho outros códigos jquery rodando e funcionando na mesma página.
Não consigo ver o que há de errado.
Se alguém puder ajudar, obrigado!!!
O que eu fiquei intrigado é que eu vi vários exemplos na internet feitos do mesmo modo que eu. Mas nenhum mostrava como o servidor respondia. E se tantos exemplos foram dados dessa forma, acredito que deveria funcionar.
O status de erro sumiu depois q eu fechei e abri o eclipse. Mas quando eu dou start no servidor, ele dá esse erro:
13/01/2010 09:45:01 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:bc' did not find a matching property.
13/01/2010 09:45:01 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\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Arquivos de programas/Java/jre6/bin/client;C:/Arquivos de programas/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Arquivos de programas\ATI Technologies\ATI.ACE\Core-Static;C:\Arquivos de programas\Microsoft SQL Server\80\Tools\Binn\;C:\Arquivos de programas\QuickTime\QTSystem\
13/01/2010 09:45:01 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
13/01/2010 09:45:01 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2293 ms
13/01/2010 09:45:01 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
13/01/2010 09:45:01 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
13/01/2010 09:45:04 org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter vraptor
java.lang.ClassNotFoundException: br.com.caelum.vraptor.VRaptor
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:249)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
13/01/2010 09:45:04 org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
13/01/2010 09:45:05 org.apache.catalina.core.StandardContext start
SEVERE: Context [/bc] startup failed due to previous errors
13/01/2010 09:45:06 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
13/01/2010 09:45:06 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
13/01/2010 09:45:06 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
13/01/2010 09:45:07 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
13/01/2010 09:45:07 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/109 config=null
13/01/2010 09:45:07 org.apache.catalina.startup.Catalina start
INFO: Server startup in 5594 ms
Eu olhei no classpath e a nova versão do vraptor tá lá. Será que tem mais algum jar que eu tenha que atualizar?
Eu fiz o seguinte, depois de várias tentivas frustradas de resolver, comecei um projeto novo à partir do vraptor-blank-project, adicionei meus jars restantes, minhas classes, etc, rodei o tomcat e ele apresentou um erro no start em cima de uma biblioteca q eu nem tinha no meu projeto anterior.
16:24:39,859 INFO [VRaptorApplicationContext] Refreshing Root WebApplicationContext: startup date [Sat Jan 16 16:24:39 GMT-03:00 2010]; root of context hierarchy
16:24:40,437 INFO [VRaptorApplicationContext] Scanning WEB-INF/classes: C:\Documents and Settings\bribeiro\Desktop\JAVA\apache-tomcat-6.0.20\wtpwebapps\bc\WEB-INF\classes
16:24:40,828 INFO [VRaptorApplicationContext] Scanning packages from WEB-INF/classes and jars: [bsr.vraptor]
16:24:40,875 WARN [ComponentScanner ] bean already found previously, there is probably no need to declare its package in web.xml:bsr.vraptor.controller.AtividadeController
16:24:40,875 WARN [ComponentScanner ] bean already found previously, there is probably no need to declare its package in web.xml:bsr.vraptor.controller.CcController
16:24:40,875 WARN [ComponentScanner ] bean already found previously, there is probably no need to declare its package in web.xml:bsr.vraptor.controller.ContratoController
16:24:40,875 WARN [ComponentScanner ] bean already found previously, there is probably no need to declare its package in web.xml:bsr.vraptor.controller.I18nController
16:24:40,875 WARN [ComponentScanner ] bean already found previously, there is probably no need to declare its package in web.xml:bsr.vraptor.controller.LanguageController
16:24:40,875 WARN [ComponentScanner ] bean already found previously, there is probably no need to declare its package in web.xml:bsr.vraptor.controller.ProjetoController
16:24:40,875 WARN [ComponentScanner ] bean already found previously, there is probably no need to declare its package in web.xml:bsr.vraptor.controller.RestanteController
16:24:40,921 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor': replacing [Root bean: class [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [br.com.caelum.vraptor.ioc.spring.InjectionBeanPostProcessor]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
16/01/2010 16:24:41 org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter vraptor
java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.<init>(Ljava/lang/Class;)V
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:350)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:296)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:787)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:671)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:401)
at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.start(SpringBasedContainer.java:63)
at br.com.caelum.vraptor.ioc.spring.SpringProvider.start(SpringProvider.java:75)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:107)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:100)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
16/01/2010 16:24:41 org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
16/01/2010 16:24:41 org.apache.catalina.core.StandardContext start
SEVERE: Context [/bc] startup failed due to previous errors
16/01/2010 16:24:42 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
16/01/2010 16:24:42 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
16/01/2010 16:24:42 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
16/01/2010 16:24:43 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
16/01/2010 16:24:43 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/188 config=null
16/01/2010 16:24:43 org.apache.catalina.startup.Catalina start
INFO: Server startup in 4752 ms