Javafree
 Forum   Topics   Author   Post 
Spring Framework Spring security aviso: Method 'setFilterProcessesUrl' is marked deprecated robertorp [code]<security:http> <security:intercept-url pattern="/paginas/**" access="ROLE_ADMIN"/> <security:form-login login-page="/publico/login.xhtml" always-use-default-target="true" default-target-url="/paginas/funcionario.xhtml" authentication-failure-url="/publico/login.xhtml?login_error=1"/> <security:logout invalidate-session="true" logout-success-url="/publico/login.xhtml"/> <security:remember-me/> </security:http> <security:authentication-manager> <security:authentication-provider> <security:jdbc-user-service data-source-ref="dataSourceMySQL" users-by-username-query="select usuario, senha, ativo from funcionario where usuario = ?" authorities-by-username-query="select f.usuario, f.permissao from funcionario f where f.usuario = ?"/> </security:authentication-provider> </security:authentication-manager>[/code] isso na parte [code]<security:form-login login-page="/publico/login.xhtml" always-use-default-target="true" default-target-url="/paginas/funcionario.xhtml" authentication-failure-url="/publico/login.xhtml?login_error=1"/>[/code] warning: Method 'setFilterProcessesUrl' is marked deprecated o mesmo acontece com o [code]<security:logout/>[/code] o mesmo acontece.. alguem ajuda? alguma ideia para min estar utilizando outro meio? em alguns lugares ficou a suspeita de ser um bug do eclipse (li no forum do spring em um topico) ja no stackoverflow disseram que não era um bug enfim na documentação os métodos realmente estão deprecated link: http://dev.nexaweb.com/docs/ref/v4547/ReferenceFramework/com/nexaweb/server/security/impl/CustomLogoutFilter.html tenho três construtores mas não sei por onde começar a montar oque vou passar por parâmetro para eles um deles e esse [code]CustomLogoutFilter(java.lang.String logoutSuccessUrl, java.util.List handlers) [/code] passo uma url e um list de handlers(como fasso esses handlers e oque eles são? algum tutorial? ) se alguem souber de uma alternativa mais simples ou utilizando algum dos outros dois construtores ou qualquer outra coisa.. agradeco estou utilizando spring security 3.2.0 RC1
Spring Framework javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory robertorp [code]Ago 27, 2013 1:00:36 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:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files\MySQL\MySQL Utilities 1.3.4\;D:\IDES\eclipse;;. Ago 27, 2013 1:00:38 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Ultimo' did not find a matching property. Ago 27, 2013 1:00:38 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:JPAeSpring' did not find a matching property. Ago 27, 2013 1:00:43 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Ago 27, 2013 1:00:43 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Ago 27, 2013 1:00:43 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 10375 ms Ago 27, 2013 1:00:43 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Ago 27, 2013 1:00:43 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.42 Ago 27, 2013 1:00:45 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [896] milliseconds. Ago 27, 2013 1:00:58 PM org.apache.catalina.core.ApplicationContext log INFO: No Spring WebApplicationInitializer types detected on classpath Ago 27, 2013 1:00:58 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Ago 27, 2013 1:00:58 PM org.springframework.web.context.ContextLoader initWebApplicationContext INFO: Root WebApplicationContext: initialization started Ago 27, 2013 1:00:58 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing Root WebApplicationContext: startup date [Tue Aug 27 13:00:58 BRT 2013]; root of context hierarchy Ago 27, 2013 1:00:58 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] Ago 27, 2013 1:00:58 PM com.mchange.v2.log.MLog <clinit> INFO: MLog clients using java 1.4+ standard logging. Ago 27, 2013 1:00:58 PM com.mchange.v2.c3p0.C3P0Registry banner INFO: Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10] Ago 27, 2013 1:00:59 PM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory INFO: Building JPA container EntityManagerFactory for persistence unit 'punit' Ago 27, 2013 1:00:59 PM org.hibernate.annotations.common.Version <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final} Ago 27, 2013 1:00:59 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.2.4.Final} Ago 27, 2013 1:00:59 PM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found Ago 27, 2013 1:00:59 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Ago 27, 2013 1:00:59 PM org.hibernate.ejb.Ejb3Configuration configure INFO: HHH000204: Processing PersistenceUnitInfo [ name: punit ...] Ago 27, 2013 1:00:59 PM org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider Ago 27, 2013 1:01:00 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 1, acquireRetryAttempts -> 5, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 180000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge0ys8w1hew759q7qzv6|dddb4e, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge0ys8w1hew759q7qzv6|dddb4e, idleConnectionTestPeriod -> 250, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost/fj21, lastAcquisitionFailureDefaultUser -> null, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 180, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 5, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 2, numHelperThreads -> 5, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ] Ago 27, 2013 1:01:02 PM org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect Ago 27, 2013 1:01:02 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException Ago 27, 2013 1:01:02 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory Ago 27, 2013 1:01:02 PM org.hibernate.cache.spi.UpdateTimestampsCache <init> INFO: HHH000250: Starting update timestamps cache at region: org.hibernate.cache.spi.UpdateTimestampsCache Ago 27, 2013 1:01:02 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12eb5a3: 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,dataSourceMySQL,entityManagerFactory,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy Ago 27, 2013 1:01:02 PM org.springframework.web.context.ContextLoader initWebApplicationContext SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1507) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1145) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:493) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 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) Caused by: javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:924) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:293) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:317) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1566) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1503) ... 22 more Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:264) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1790) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) ... 28 more Caused by: org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath). at org.hibernate.cache.internal.NoCachingRegionFactory.buildTimestampsRegion(NoCachingRegionFactory.java:87) at org.hibernate.cache.spi.UpdateTimestampsCache.<init>(UpdateTimestampsCache.java:62) at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:72) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:40) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:35) at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) ... 34 more Ago 27, 2013 1:01:02 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1507) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1145) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:493) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 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) Caused by: javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:924) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:293) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:317) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1566) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1503) ... 22 more Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:264) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1790) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) ... 28 more Caused by: org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath). at org.hibernate.cache.internal.NoCachingRegionFactory.buildTimestampsRegion(NoCachingRegionFactory.java:87) at org.hibernate.cache.spi.UpdateTimestampsCache.<init>(UpdateTimestampsCache.java:62) at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:72) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:40) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:35) at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) ... 34 more Ago 27, 2013 1:01:02 PM com.sun.faces.config.ConfigureListener contextInitialized INFO: Inicializando Mojarra 2.1.1 (FCS 20110408) para o contexto '/Ultimo' Ago 27, 2013 1:01:03 PM com.sun.faces.spi.InjectionProviderFactory createInstance INFO: JSF1048: Anotações PostConstruct/PreDestroy presentes. Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas. Ago 27, 2013 1:01:03 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart Ago 27, 2013 1:01:03 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/Ultimo] startup failed due to previous errors Ago 27, 2013 1:01:03 PM org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext Ago 27, 2013 1:01:03 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/Ultimo] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. Ago 27, 2013 1:01:03 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/Ultimo] created a ThreadLocal with key of type [javax.faces.context.FacesContext$1] (value [javax.faces.context.FacesContext$1@1843f31]) and a value of type [com.sun.faces.config.InitFacesContext] (value [com.sun.faces.config.InitFacesContext@150b2f3]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. Ago 27, 2013 1:01:03 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Ago 27, 2013 1:01:03 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Ago 27, 2013 1:01:03 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 20463 ms [/code] arquio application-context [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:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <context:component-scan base-package="br" /> <!-- verifica qual classes tem anotações --> <context:annotation-config /> <!-- cria um PersistenceAnnotationBeanPostProcessor --> <!-- <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> --> <!-- Objeto dataSource arquivo c3p0-0.9.1.jar--> <bean id="dataSourceMySQL" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver" /> <property name="jdbcUrl" value="jdbc:mysql://localhost/fj21" /> <property name="user" value="root" /> <property name="password" value="123456" /> <property name="minPoolSize" value="2" /> <property name="maxPoolSize" value="5" /> <property name="maxStatements" value="0" /> <property name="checkoutTimeout" value="180000" /> <property name="idleConnectionTestPeriod" value="250" /> <property name="maxIdleTime" value="180" /> <property name="numHelperThreads" value="5" /> <property name="acquireIncrement" value="1" /> <property name="acquireRetryAttempts" value="5" /> </bean> <!-- gerenciamento de jpa pelo spring --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSourceMySQL" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="database" value="MYSQL" /> <property name="showSql" value="true" /> <property name="generateDdl" value="false" /> </bean> </property> <property name="jpaProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">false</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.cglib.use_reflection_optimizer">true</prop> <prop key="hibernate.jdbc.use_streams_for_binary">true</prop> <prop key="hibernate.jdbc.batch_size">0</prop> <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_structured_entries">true</prop> <prop key="hibernate.connection.release_mode">after_transaction</prop> <prop key="hibernate.jdbc.use_get_generated_keys">true</prop> <prop key="hibernate.statement_cache.size">0</prop> </props> </property> </bean> </beans>[/code] arquivo presistense.xml [code]<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="punit"> <!-- provedor/implementacao do JPA --> <provider>org.hibernate.ejb.HibernatePersistence</provider> </persistence-unit> </persistence>[/code] Alguma solução? Obrigado
Spring Framework javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory robertorp [code]Ago 27, 2013 1:00:36 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:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files\MySQL\MySQL Utilities 1.3.4\;D:\IDES\eclipse;;. Ago 27, 2013 1:00:38 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Ultimo' did not find a matching property. Ago 27, 2013 1:00:38 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:JPAeSpring' did not find a matching property. Ago 27, 2013 1:00:43 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Ago 27, 2013 1:00:43 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Ago 27, 2013 1:00:43 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 10375 ms Ago 27, 2013 1:00:43 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Ago 27, 2013 1:00:43 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.42 Ago 27, 2013 1:00:45 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [896] milliseconds. Ago 27, 2013 1:00:58 PM org.apache.catalina.core.ApplicationContext log INFO: No Spring WebApplicationInitializer types detected on classpath Ago 27, 2013 1:00:58 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Ago 27, 2013 1:00:58 PM org.springframework.web.context.ContextLoader initWebApplicationContext INFO: Root WebApplicationContext: initialization started Ago 27, 2013 1:00:58 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing Root WebApplicationContext: startup date [Tue Aug 27 13:00:58 BRT 2013]; root of context hierarchy Ago 27, 2013 1:00:58 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] Ago 27, 2013 1:00:58 PM com.mchange.v2.log.MLog <clinit> INFO: MLog clients using java 1.4+ standard logging. Ago 27, 2013 1:00:58 PM com.mchange.v2.c3p0.C3P0Registry banner INFO: Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10] Ago 27, 2013 1:00:59 PM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory INFO: Building JPA container EntityManagerFactory for persistence unit 'punit' Ago 27, 2013 1:00:59 PM org.hibernate.annotations.common.Version <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final} Ago 27, 2013 1:00:59 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.2.4.Final} Ago 27, 2013 1:00:59 PM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found Ago 27, 2013 1:00:59 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Ago 27, 2013 1:00:59 PM org.hibernate.ejb.Ejb3Configuration configure INFO: HHH000204: Processing PersistenceUnitInfo [ name: punit ...] Ago 27, 2013 1:00:59 PM org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider Ago 27, 2013 1:01:00 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 1, acquireRetryAttempts -> 5, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 180000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge0ys8w1hew759q7qzv6|dddb4e, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge0ys8w1hew759q7qzv6|dddb4e, idleConnectionTestPeriod -> 250, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost/fj21, lastAcquisitionFailureDefaultUser -> null, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 180, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 5, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 2, numHelperThreads -> 5, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ] Ago 27, 2013 1:01:02 PM org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect Ago 27, 2013 1:01:02 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException Ago 27, 2013 1:01:02 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory Ago 27, 2013 1:01:02 PM org.hibernate.cache.spi.UpdateTimestampsCache <init> INFO: HHH000250: Starting update timestamps cache at region: org.hibernate.cache.spi.UpdateTimestampsCache Ago 27, 2013 1:01:02 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12eb5a3: 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,dataSourceMySQL,entityManagerFactory,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy Ago 27, 2013 1:01:02 PM org.springframework.web.context.ContextLoader initWebApplicationContext SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1507) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1145) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:493) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 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) Caused by: javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:924) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:293) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:317) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1566) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1503) ... 22 more Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:264) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1790) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) ... 28 more Caused by: org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath). at org.hibernate.cache.internal.NoCachingRegionFactory.buildTimestampsRegion(NoCachingRegionFactory.java:87) at org.hibernate.cache.spi.UpdateTimestampsCache.<init>(UpdateTimestampsCache.java:62) at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:72) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:40) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:35) at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) ... 34 more Ago 27, 2013 1:01:02 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1507) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1145) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:493) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 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) Caused by: javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:924) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:293) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:317) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1566) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1503) ... 22 more Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:264) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1790) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) ... 28 more Caused by: org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath). at org.hibernate.cache.internal.NoCachingRegionFactory.buildTimestampsRegion(NoCachingRegionFactory.java:87) at org.hibernate.cache.spi.UpdateTimestampsCache.<init>(UpdateTimestampsCache.java:62) at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:72) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:40) at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:35) at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) ... 34 more Ago 27, 2013 1:01:02 PM com.sun.faces.config.ConfigureListener contextInitialized INFO: Inicializando Mojarra 2.1.1 (FCS 20110408) para o contexto '/Ultimo' Ago 27, 2013 1:01:03 PM com.sun.faces.spi.InjectionProviderFactory createInstance INFO: JSF1048: Anotações PostConstruct/PreDestroy presentes. Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas. Ago 27, 2013 1:01:03 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart Ago 27, 2013 1:01:03 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/Ultimo] startup failed due to previous errors Ago 27, 2013 1:01:03 PM org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext Ago 27, 2013 1:01:03 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/Ultimo] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. Ago 27, 2013 1:01:03 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/Ultimo] created a ThreadLocal with key of type [javax.faces.context.FacesContext$1] (value [javax.faces.context.FacesContext$1@1843f31]) and a value of type [com.sun.faces.config.InitFacesContext] (value [com.sun.faces.config.InitFacesContext@150b2f3]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. Ago 27, 2013 1:01:03 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Ago 27, 2013 1:01:03 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Ago 27, 2013 1:01:03 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 20463 ms [/code] arquio application-context [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:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <context:component-scan base-package="br" /> <!-- verifica qual classes tem anotações --> <context:annotation-config /> <!-- cria um PersistenceAnnotationBeanPostProcessor --> <!-- <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> --> <!-- Objeto dataSource arquivo c3p0-0.9.1.jar--> <bean id="dataSourceMySQL" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver" /> <property name="jdbcUrl" value="jdbc:mysql://localhost/fj21" /> <property name="user" value="root" /> <property name="password" value="123456" /> <property name="minPoolSize" value="2" /> <property name="maxPoolSize" value="5" /> <property name="maxStatements" value="0" /> <property name="checkoutTimeout" value="180000" /> <property name="idleConnectionTestPeriod" value="250" /> <property name="maxIdleTime" value="180" /> <property name="numHelperThreads" value="5" /> <property name="acquireIncrement" value="1" /> <property name="acquireRetryAttempts" value="5" /> </bean> <!-- gerenciamento de jpa pelo spring --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSourceMySQL" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="database" value="MYSQL" /> <property name="showSql" value="true" /> <property name="generateDdl" value="false" /> </bean> </property> <property name="jpaProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">false</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.cglib.use_reflection_optimizer">true</prop> <prop key="hibernate.jdbc.use_streams_for_binary">true</prop> <prop key="hibernate.jdbc.batch_size">0</prop> <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_structured_entries">true</prop> <prop key="hibernate.connection.release_mode">after_transaction</prop> <prop key="hibernate.jdbc.use_get_generated_keys">true</prop> <prop key="hibernate.statement_cache.size">0</prop> </props> </property> </bean> </beans>[/code] arquivo presistense.xml [code]<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="punit"> <!-- provedor/implementacao do JPA --> <provider>org.hibernate.ejb.HibernatePersistence</provider> </persistence-unit> </persistence>[/code] Alguma solução? Obrigado
Apresentação Oi robertorp Olá, sou Roberto estudante de ads, atualmente estudando servlets é jsf, cheio de perguntas para resolver por aqui.. boa tarde galerinha rs' bom e isso .-.'
Apresentação Oi robertorp Olá, sou Roberto estudante de ads, atualmente estudando servlets é jsf, cheio de perguntas para resolver por aqui.. boa tarde galerinha rs' bom e isso .-.'
JSP / Servlets el não esta funcionando (oque to fazendo errado?) robertorp [code]<%@page import="br.com.adspw.beans.ClienteBean"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <jsp:useBean id = "cliente" scope = "page" class = "br.com.adspw.beans.ClienteBean" /> <jsp:useBean id = "endereco" scope = "page" class = "br.com.adspw.beans.EnderecoBean" /> <jsp:useBean id="idDate" class="java.util.Date" /> <% cliente.setEndereco(endereco); %> <jsp:useBean id = "clienteData" scope = "request" class = "br.com.adspw.persistencia.ClienteDataBean" /> <% Integer codigoCliente = Integer.parseInt(request.getParameter("editarCodigo")); ClienteBean clientex = clienteData.buscaCliente(codigoCliente); cliente = clientex; %> <fmt:parseDate var="dataEntrada" value="${param.data_entrada}" type="date" /> <%-- Converte data de entrada --%> <fmt:parseDate var="dataNascimento" value="${param.data_nascimento}" type="date" /> <jsp:setProperty name="cliente" property="codigo" param="codigo" /> <jsp:setProperty name="cliente" property="data_entrada" value = "${dataEntrada}" /> <jsp:setProperty name="cliente" property="data_nascimento" value = "${dataNascimento}" /> <jsp:setProperty name="cliente" property="nome" param="nome" /> <jsp:setProperty name="cliente" property="cpf" param="cpf" /> <jsp:setProperty name="cliente" property="rg" param="rg" /> <jsp:setProperty name="cliente" property="sexo" param="sexo" /> <jsp:setProperty name="cliente" property="email" param="email" /> <jsp:setProperty name="cliente" property="telefone" param="telefone" /> <jsp:setProperty name = "endereco" property = "*" /> <c:choose> <c:when test = "${empty cliente.nome}"> <form method = "post" action = "index.jsp"> <div> <label>Codigo: </label> <input type = "text" name = "codigo" value = "<%= cliente.getCodigo() %>" size = "1" /> <label>Data Cadastro: </label> <input type="text" name="data_entrada" value="<fmt:formatDate value="${idDate}" type="date" dateStyle="short" pattern="dd/MM/yyyy"/>" /> <br /> <label for = "nome">Nome: </label> <input type = "text" name = "nome" value = "${cliente.nome}"/> <br /> <label for = "cpf">Cpf: </label> <input type = "text" name = "cpf" value = "${cliente.cpf}"/> <br /> <label for = "rg">Rg: </label> <input type = "text" name = "rg" value = "${cliente.rg}"/> <br /> <label for = "data_nascimento">Data Nascimento: </label> <input type="text" name="data_nascimento" value="<fmt:formatDate value="${cliente.data_nascimento}" type="date" dateStyle="short" pattern="dd/MM/yyyy"/>" /> <br /> <label for = "sexo">Sexo</label> <select name = "sexo"> <option value = "M" <c:if test = "${cliente.sexo == 'M'}">selected</c:if>>Masculino</option> <option value = "F" <c:if test = "${cliente.sexo == 'F'}">selected</c:if>>Feminino</option> </select> <br /> <label for = "email">Email: </label> <input type = "text" name = "email" value = "${cliente.email}"/> <br /> <label for = "telefone">Telefone: </label> <input type = "text" name = "telefone" value = "${cliente.telefone}"/> <br /> <label for = "cep">Cep: </label> <input type = "text" name = "cep" value = "${cliente.endereco.cep}"/> <br /> <label for = "rua">Rua: </label> <input type = "text" name = "rua" value = "${cliente.endereco.rua}"/> <br /> <label for = "numero">Numero: </label> <input type = "text" name = "numero" value = "${cliente.endereco.numero}"/> <br /> <label for = "compelemento">Complemento: </label> <input type = "text" name = "complemento" value = "${cliente.endereco.complemento}"/> <br /> <label for = "cidade">Cidade: </label> <input type = "text" name = "cep" value = "${cliente.endereco.cidade}"/> <br /> <br /> <input type = "submit" value = "salvar" /> </div> </form> </c:when> <c:otherwise> <% if(clienteData.salvaOuAltera(cliente)){%> <script language ="Javascript"> window.location.href = "listaCliente.jsp"; </script> <%} %> </c:otherwise> </c:choose> </body> </html>[/code] Quando uso <%= cliente.getCodigo() %> ele funciona perfeitamente. Quando uso "${cliente.codigo}" ele não pega o código porque? Obrigado.
JSP / Servlets setar valor tipo date para objeto com c:set robertorp [code]<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Cadastro Cliente</title> </head> <body> <jsp:useBean id = "cliente" scope = "request" class = "br.com.adspw.beans.ClienteBean" /> <jsp:useBean id = "endereco" scope = "request" class = "br.com.adspw.beans.EnderecoBean" /> <jsp:useBean id="idDate" scope = "request" class="java.util.Date" /> <% cliente.setEndereco(endereco); %> <jsp:useBean id = "clienteData" scope = "request" class = "br.com.adspw.persistencia.ClienteDataBean" /> <c:set target = "${cliente}" property="data_entrada"> <fmt:parseDate value = "${data_entrada}" type = "date" dateStyle = "short" pattern = "dd/MM/yyyy" /> </c:set> <jsp:setProperty name="cliente" property="codigo" param="codigo" /> <jsp:setProperty name="cliente" property="nome" param="nome" /> <jsp:setProperty name="cliente" property="cpf" param="cpf" /> <jsp:setProperty name="cliente" property="rg" param="rg" /> <jsp:setProperty name="cliente" property="sexo" param="sexo" /> <jsp:setProperty name="cliente" property="email" param="email" /> <jsp:setProperty name="cliente" property="telefone" param="telefone" /> <jsp:setProperty name = "endereco" property = "*" /> <%-- <c:set target="${cliente}" property="data_nascimento"> <fmt:parseDate value="${data_nascimento}" type="date" dateStyle="short" pattern="dd/MM/yyyy" /> </c:set>--%> <% if(cliente.getNome() == "") { %> <form method = "post" action = "index.jsp"> <div> <label>Codigo: </label> <input type = "text" name = "codigo" value = "${cliente.codigo}" size = "1" /> <label>Data Cadastro: </label> <input type="text" name="data_entrada" value="<fmt:formatDate value="${idDate}" type="date" dateStyle="short" pattern="dd/MM/yyyy" />" /> <br /> <label for = "nome">Nome: </label> <input type = "text" name = "nome" value = "<%= cliente.getNome() %>"/> <br /> <label for = "cpf">Cpf: </label> <input type = "text" name = "cpf" value = "<%= cliente.getCpf() %>"/> <br /> <label for = "rg">Rg: </label> <input type = "text" name = "rg" value = "<%= cliente.getRg() == 0 ? "" : cliente.getRg() %>"/> <br /> <%-- <label for = "data_nascimento">Data Nascimento: </label> <input type="text" name="data_nascimento" value="<fmt:formatDate value="${cliente.data_nascimento}" type="date" dateStyle="short" pattern="dd/MM/yyyy"/>" />--%> <br /> <label for = "sexo">Sexo</label> <select name = "sexo"> <option value = "M" <%= cliente.getSexo().equals("M") ? "selected" : "" %>>Masculino</option> <option value = "F" <%= cliente.getSexo().equals("F") ? "selected" : "" %>>Feminino</option> </select> <br /> <label for = "email">Email: </label> <input type = "text" name = "email" value = "<%= cliente.getEmail() %>"/> <br /> <label for = "telefone">Telefone: </label> <input type = "text" name = "telefone" value = "<%= cliente.getTelefone() %>"/> <br /> <label for = "cep">Cep: </label> <input type = "text" name = "cep" value = "<%= endereco.getCep() %>"/> <br /> <br /> <input type = "submit" value = "salvar" /> </div> </form> <% } else{ clienteData.salvaOuAltera(cliente); %> <jsp:forward page = "listaCliente.jsp" /> <% } %> </body> </html>[/code] aqui ele não está setando a data para o objeto, onde estou errando? Obrigado.
JSP / Servlets Validação de campo com diretiva , erro sempre da false robertorp Meus Arquivos usados cabecalho.html [code]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script language = "javascript" src = "Exercicio19.js"></script> </head> <body>[/code] rodape.html [code] </body> </html>[/code] Exercicio.jsp [code]<%@ include file = "cabecalho.html" %> <%! static int iContador = 0; %> <% iContador++; %> <form name = "formulario" id = "formulario" method = "get"> <%= iContador %> <br /> <label for = "inicio">inicio: </label> <input type = "text" name = "inicio" id = "inicio" /> <br /> <label for = "fim">fim: </label> <input type = "text" name = "fim" id = "fim" /> <br /> <input type = "button" value = "Calcular" onclick = "verifica();"/> <br /> <input type = "text" id = "soma"/> </form> <%@ include file= "rodape.html" %>[/code] Exercicio19.js [code]var req; function verifica() { var num1 = parseInt(document.getElementById("inicio").value); var num2 = parseInt(document.getElementById("fim").value); var bol = true; if(num1 < 0 || num1 >50) { bol = false; alert("Colocar valor de inicial entre 0 até 20."); document.formulario.inicio.focus(); } else if(num2 < 0 || num2 > 50) { bol = false; alert("Colocar valor final entre 0 até 20."); document.formulario.fim.focus(); } else if(isNaN(num1)) { bol = false; alert("Isso não é um número!"); document.formulario.inicio.focus(); } else if(isNaN(num2)) { bol = false; alert("Isso não é um número!"); document.formulario.fim.focus(); } else { if(num1 > num2) { bol = false; alert("Inicio é maior que fim."); document.formulario.inicio.focus(); } else if(num1 == num2) { bol = false; alert("Inicio e igual a fim."); document.formulario.fim.focus(); } } if(bol) { somatorio(); } } function somatorio() { var inicio = document.getElementById("inicio"); var fim = document.getElementById("fim"); var url = "Exercicio19.jsp?inicioo=" + escape(inicio.value) + "&fimm=" + escape(fim.value); if (window.XMLHttpRequest) { // requisição assincrona req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.open("GET", url, true); // true requisição assincrona, se false ela é sincrona. req.onreadystatechange = callback; // quando pronto muda o estado req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); req.send(null); } function callback() { if (req.readyState == 4) { if (req.status == 200) { var soma = document.getElementById("soma"); soma.value = req.responseText; } else alert("Status: " + req.statusText); } clear(); } function clear() { var inicio = document.getElementById("inicio"); var fim = document.getElementById("fim"); inicio.value = ""; fim.value = ""; }[/code] Exercicio19.jsp [code]<%! public boolean validaNumero(int numero) { if(numero < 0 || numero > 21) return false; else return true; } %> <% String inicio = request.getParameter("inicioo"); String fim = request.getParameter("fimm"); boolean bol = true; if(inicio == null || inicio == "") { out.println("Inicio não tem nada."); bol = false; } else if(fim == null || fim == "") { bol = false; out.println("Fim não tem nada."); } else { int auxInicio = Integer.parseInt(inicio); int auxFim = Integer.parseInt(fim); if(auxInicio > auxFim) { bol = false; out.println("Inicio é maior que fim"); } if(auxInicio == auxFim) { bol = false; out.println("Inicio é igual a fim"); } if(validaNumero(auxInicio)) { bol = false; out.println("Valor inválido."); } if(validaNumero(auxFim)) { bol = false; out.println("Valor inválido."); } if(bol) { int soma = 0; for(int cont = auxInicio; cont < auxFim; cont++) { soma += cont + auxFim; } out.println(soma); } } %>[/code] download do projeto (eclipse) https://www.dropbox.com/s/9nctwcu0y2aoacr/Exercicio19.rar Exercicio da faculdade. Implemente, no exercício da questão 16, uma validação do número informado pelo usuário, de modo que não aceite números negativos e nem maiores que 20. A validação deve ser feita no cliente e no servidor. A validação no servidor deve ser feita através de uma sub-rotina. edit Obs: No arquivo Exercico19.js coloquei a validação > 50 para entrar no servidor e testar a validação do servidor alguém ajuda com oque está faltando? é somente a validação no servidor Obrigado
GUI - (Applets, Swing, SWT, etc) JFileChooster salvar arquivo com nome pre definido e exentsão robertorp Não precisa do nome... mas eu presiava que ele definice uma extenção padrão... .pdf como adicionar? obrigado.
GUI - (Applets, Swing, SWT, etc) ComboBox quando digitar algo, ela pesquisa robertorp seguinte estou com uma comboBox editavel quando digitar algo nela queria que ela fizesse uma pesquisa no banco de dados. quando apagar algo ela fizesse a pesquisa denovo. tipo o document linester obrigado.
GUI - (Applets, Swing, SWT, etc) Melhores containers para aplicação ? robertorp JInternalFrame MDI JFrame JPanel entre outros... quais são os melhores? e porque? ou depende do tipo de aplicação que vou fazer? alguma indicação de livro? estou fazendo um trabalho com MDI (tela principal) é JInternalFrame (o restante das telas) mas enfin... oque vocês indiacriam para uma aplicação de medio porte?
Java Básico [RESOLVIDO]Validação de Usuário e Senha com o banco de dados robertorp [code]try{ //Habilita os menus da tela Admin quando o login é feito. CachedRowSetImpl resultCopia; FuncionarioNegocio negocio = new FuncionarioNegocio(); resultCopia = negocio.listaFuncionarioFULL(); try{ while(resultCopia.next()){ String login = resultCopia.getString("login"); String senha = resultCopia.getString("senha"); String senha1 = new String(senhaCaixa.getPassword()); if(loginCaixa.getText().equals(login)){ if(senha1.equals(senha)){ Admin.abilitaMenu(); this.dispose(); } else{ JOptionPane.showMessageDialog(null, "Senha invalida!"); } } else{ JOptionPane.showMessageDialog(null, "Usuário invalido!"); } } } catch(SQLException erro){ JOptionPane.showMessageDialog(null, "Erro ao tentar logar no usuario ou senha: " + erro); } } catch(SQLException ex){ JOptionPane.showMessageDialog(null, "Erro ao tentar trazer copiaResult de Login: " + ex); }[/code]
Java Básico jtextarea inserir dados sem sobreescrever[RESOLVIDO] robertorp seguinte segue como resolvi o problema [code]// Listener, um método capaz de monitorar as ações do usuário na GUI (Graphics User Interface). listaFilmes.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if(e.getClickCount() != 0) { Integer k; Filme filme = new Filme(); k = listaFilmes.getSelectedRow(); Integer codigo = (Integer) listaFilmes.getValueAt(k, 0); String nome = (String) listaFilmes.getValueAt(k, 1); Double valor = (Double) listaFilmes.getValueAt(k, 2); filme.setCodigo(codigo); filme.setNome(nome); filme.setValorLocacao(valor); filmes.add(filme); areaTexto.insert(nome, areaTexto.getCaretPosition()); areaTexto.append("\n"); } } }); [/code] assim ele insere o texto e salta uma linha :) Obrigado a todos :)
Java Básico jtextarea inserir dados sem sobreescrever[RESOLVIDO] robertorp de acordo com o que clico em uma Grid eu insiro um nome na area de texto o primeiro dado vai blz mas o segundo dado ele ja sobreescreve a area de texto como proceder com isso sem sobreescrever a area de texto ela devia dar um enter tb automaticamente obrgiado.
GUI - (Applets, Swing, SWT, etc) abrindo duas jinternalframe quero dar focus em uma, como faz? robertorp exemplo tenho uma internalframe que cadastra produtos, quando chegar na hora de digitar o fornecedor na hora em que eu começar a digitar o nome do fornecedor ele irá abrir uma outra internalframe qe ira listar o cadastro de fornecedores por ordem de letra que eu digite no jtextfield do fornecedor jtextfieldfornecedor: ro Lista abaixo automaticamente Roberto roberio roberta o erro que ocorre... a segunda jinternalframe qe mando abrir apost ter digitado ro ela abre perfeitamente fazendo a pesquisa... so que ela abre atras dos jtextfield eu quero dar destac a ela , para poder selecionar o fornecedor desejado
Java Básico Efeito do netbeans depois que vc digita objeto"." aparece uma lista de opções robertorp Oque eu quero e fazer o mesmo efeito exemplo: jtextfield: aqui eu começo digitando um nome de fornecedor logo baixo do jtextfield abre uma Janela listando todos fornecedores
Java Básico Efeito do netbeans depois que vc digita objeto"." aparece uma lista de opções robertorp exemplo: tenho um cadastro de fornecedores declaro Fornecedor fornecedr = new Fornecedor(); ai quando eu digito fornecedr. depois do ponto irá aparecer todos métodos que contem nele so que no meu caso eu queria que quando eu digitase algo em um jtextfield ele abrir uma lista de fornecedores
Goto page 1