Lucas_Cavalcanti 2 de dez. de 2010
vc declarou a taglib c no começo da jsp?
juniorsatanas 2 de dez. de 2010
Testei assim tbm :
< %@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
< c:if test="${ param . error eq 'invalido' } ">
< c:out value="Usuário e/ou senha inválido(s)">
< /c:if>
< form name="f" action="< c:url value="/j_spring_security_check"/>" method=" POST">
< table>
< tr>
< td>
< c:out value="Usuário:"/>
< /td>
< td>
< input type='text' name='j_username'/>
< /td>
< /tr>
< tr>
< td>
< c:out value="Usuário:"/>
< /td>
< td>
< input type='password' name='j_password'>
< /td>
< /tr>
< tr>
< td colspan='2'>
< input name="submit" type="submit">
< /td>
< /tr>
< tr>
< td colspan='2'>
< input name="reset" type="reset">
< /td>
< /tr>
< /table>
< /form>
quando eu faço isso da isto :
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request .
exception
br . com . caelum . vraptor . view . ResultException : org . apache . jasper . JasperException : / WEB - INF / jsp / index / index . jsp ( 4 , 0 ) PWC6305 : The end tag "</c:if" is unbalanced
note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs .
GlassFish v3
juniorsatanas 2 de dez. de 2010
log:
< blockquote > AVISO : StandardWrapperValve [ default ] : PWC1406 : Servlet . service () for servlet default threw exception
br . com . caelum . vraptor . view . ResultException : org . apache . jasper . JasperException : / WEB - INF / jsp / index / index . jsp ( 4 , 0 ) PWC6305 : The end tag “ </ c : if ” is unbalanced
at br . com . caelum . vraptor . view . DefaultPageResult . forward ( DefaultPageResult . java : 69 )
at br . com . caelum . vraptor . extra . ForwardToDefaultViewInterceptor . intercept ( ForwardToDefaultViewInterceptor . java : 59 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 56 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . interceptor . OutjectResult . intercept ( OutjectResult . java : 64 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . interceptor . ExecuteMethodInterceptor . intercept ( ExecuteMethodInterceptor . java : 75 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 56 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . interceptor . ParametersInstantiatorInterceptor . intercept ( ParametersInstantiatorInterceptor . java : 86 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . interceptor . InstantiateInterceptor . intercept ( InstantiateInterceptor . java : 42 )
at br . com . caelum . vraptor . core . InstantiatedInterceptorHandler . execute ( InstantiatedInterceptorHandler . java : 47 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . interceptor . InterceptorListPriorToExecutionExtractor . intercept ( InterceptorListPriorToExecutionExtractor . java : 46 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . interceptor . FlashInterceptor . intercept ( FlashInterceptor . java : 81 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . interceptor . ResourceLookupInterceptor . intercept ( ResourceLookupInterceptor . java : 67 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 56 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 65 )
at br . com . caelum . vraptor . core . DefaultRequestExecution . execute ( DefaultRequestExecution . java : 70 )
at br . com . caelum . vraptor . VRaptor $ 1. insideRequest ( VRaptor . java : 92 )
at br . com . caelum . vraptor . ioc . spring . SpringProvider . provideForRequest ( SpringProvider . java : 56 )
at br . com . caelum . vraptor . VRaptor . doFilter ( VRaptor . java : 89 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 256 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 215 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 343 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . invoke ( FilterSecurityInterceptor . java : 109 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . doFilter ( FilterSecurityInterceptor . java : 83 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . access . ExceptionTranslationFilter . doFilter ( ExceptionTranslationFilter . java : 97 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . session . SessionManagementFilter . doFilter ( SessionManagementFilter . java : 100 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . authentication . AnonymousAuthenticationFilter . doFilter ( AnonymousAuthenticationFilter . java : 78 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . servletapi . SecurityContextHolderAwareRequestFilter . doFilter ( SecurityContextHolderAwareRequestFilter . java : 54 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . savedrequest . RequestCacheAwareFilter . doFilter ( RequestCacheAwareFilter . java : 35 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . authentication . www . BasicAuthenticationFilter . doFilter ( BasicAuthenticationFilter . java : 177 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . authentication . AbstractAuthenticationProcessingFilter . doFilter ( AbstractAuthenticationProcessingFilter . java : 188 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . authentication . logout . LogoutFilter . doFilter ( LogoutFilter . java : 105 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . context . SecurityContextPersistenceFilter . doFilter ( SecurityContextPersistenceFilter . java : 79 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 355 )
at org . springframework . security . web . FilterChainProxy . doFilter ( FilterChainProxy . java : 149 )
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 237 )
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 167 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 256 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 215 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 277 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 188 )
at org . apache . catalina . core . StandardPipeline . invoke ( StandardPipeline . java : 641 )
at com . sun . enterprise . web . WebPipeline . invoke ( WebPipeline . java : 97 )
at com . sun . enterprise . web . PESessionLockingStandardPipeline . invoke ( PESessionLockingStandardPipeline . java : 85 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 185 )
at org . apache . catalina . connector . CoyoteAdapter . doService ( CoyoteAdapter . java : 332 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 233 )
at com . sun . enterprise . v3 . services . impl . ContainerMapper . service ( ContainerMapper . java : 165 )
at com . sun . grizzly . http . ProcessorTask . invokeAdapter ( ProcessorTask . java : 791 )
at com . sun . grizzly . http . ProcessorTask . doProcess ( ProcessorTask . java : 693 )
at com . sun . grizzly . http . ProcessorTask . process ( ProcessorTask . java : 954 )
at com . sun . grizzly . http . DefaultProtocolFilter . execute ( DefaultProtocolFilter . java : 170 )
at com . sun . grizzly . DefaultProtocolChain . executeProtocolFilter ( DefaultProtocolChain . java : 135 )
at com . sun . grizzly . DefaultProtocolChain . execute ( DefaultProtocolChain . java : 102 )
at com . sun . grizzly . DefaultProtocolChain . execute ( DefaultProtocolChain . java : 88 )
at com . sun . grizzly . http . HttpProtocolChain . execute ( HttpProtocolChain . java : 76 )
at com . sun . grizzly . ProtocolChainContextTask . doCall ( ProtocolChainContextTask . java : 53 )
at com . sun . grizzly . SelectionKeyContextTask . call ( SelectionKeyContextTask . java : 57 )
at com . sun . grizzly . ContextTask . run ( ContextTask . java : 69 )
at com . sun . grizzly . util . AbstractThreadPool $ Worker . doWork ( AbstractThreadPool . java : 330 )
at com . sun . grizzly . util . AbstractThreadPool $ Worker . run ( AbstractThreadPool . java : 309 )
at java . lang . Thread . run ( Thread . java : 662 )
Caused by : org . apache . jasper . JasperException : / WEB - INF / jsp / index / index . jsp ( 4 , 0 ) PWC6305 : The end tag “ </ c : if ” is unbalanced
at org . apache . jasper . compiler . DefaultErrorHandler . jspError ( DefaultErrorHandler . java : 78 )
at org . apache . jasper . compiler . ErrorDispatcher . dispatch ( ErrorDispatcher . java : 373 )
at org . apache . jasper . compiler . ErrorDispatcher . jspError ( ErrorDispatcher . java : 185 )
at org . apache . jasper . compiler . Parser . checkUnbalancedEndTag ( Parser . java : 1820 )
at org . apache . jasper . compiler . Parser . parseElements ( Parser . java : 1673 )
at org . apache . jasper . compiler . Parser . parseBody ( Parser . java : 1903 )
at org . apache . jasper . compiler . Parser . parseOptionalBody ( Parser . java : 1156 )
at org . apache . jasper . compiler . Parser . parseCustomTag ( Parser . java : 1473 )
at org . apache . jasper . compiler . Parser . parseElements ( Parser . java : 1672 )
at org . apache . jasper . compiler . Parser . parseBody ( Parser . java : 1903 )
at org . apache . jasper . compiler . Parser . parseOptionalBody ( Parser . java : 1156 )
at org . apache . jasper . compiler . Parser . parseCustomTag ( Parser . java : 1473 )
at org . apache . jasper . compiler . Parser . parseElements ( Parser . java : 1672 )
at org . apache . jasper . compiler . Parser . parse ( Parser . java : 182 )
at org . apache . jasper . compiler . ParserController . doParse ( ParserController . java : 239 )
at org . apache . jasper . compiler . ParserController . parse ( ParserController . java : 140 )
at org . apache . jasper . compiler . Compiler . generateJava ( Compiler . java : 208 )
at org . apache . jasper . compiler . Compiler . compile ( Compiler . java : 447 )
at org . apache . jasper . JspCompilationContext . compile ( JspCompilationContext . java : 620 )
at org . apache . jasper . servlet . JspServletWrapper . service ( JspServletWrapper . java : 377 )
at org . apache . jasper . servlet . JspServlet . serviceJspFile ( JspServlet . java : 483 )
at org . apache . jasper . servlet . JspServlet . service ( JspServlet . java : 373 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 847 )
at org . apache . catalina . core . StandardWrapper . service ( StandardWrapper . java : 1523 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 343 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 215 )
at br . com . caelum . vraptor . core . DefaultStaticContentHandler . deferProcessingToContainer ( DefaultStaticContentHandler . java : 64 )
at br . com . caelum . vraptor . VRaptor . doFilter ( VRaptor . java : 80 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 256 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 215 )
at br . com . caelum . vraptor . core . DefaultStaticContentHandler . deferProcessingToContainer ( DefaultStaticContentHandler . java : 64 )
at br . com . caelum . vraptor . VRaptor . doFilter ( VRaptor . java : 80 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 256 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 215 )
at org . apache . catalina . core . ApplicationDispatcher . doInvoke ( ApplicationDispatcher . java : 800 )
at org . apache . catalina . core . ApplicationDispatcher . invoke ( ApplicationDispatcher . java : 664 )
at org . apache . catalina . core . ApplicationDispatcher . processRequest ( ApplicationDispatcher . java : 497 )
at org . apache . catalina . core . ApplicationDispatcher . doDispatch ( ApplicationDispatcher . java : 468 )
at org . apache . catalina . core . ApplicationDispatcher . dispatch ( ApplicationDispatcher . java : 364 )
at org . apache . catalina . core . ApplicationDispatcher . forward ( ApplicationDispatcher . java : 314 )
at br . com . caelum . vraptor . view . DefaultPageResult . forward ( DefaultPageResult . java : 67 )
… 86 more
INFO: Iniciado servidor desligado
GRAVE: 48507 [Thread-29] INFO org.hibernate.impl.SessionFactoryImpl - closing
GRAVE: 48507 [Thread-29] INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:postgresql://localhost:5432/nutec
INFO: Fechando SessionFactory…
INFO: PWC1412: WebModule[/VRaptorAjax] ServletContext.log():Closing Spring root WebApplicationContext
GRAVE: log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
juniorsatanas 2 de dez. de 2010
Lucas como sempre obrigado:
tirei isto :
<c:if test="${param.error eq 'invalido'}">
<c:out value="Usuário e/ou senha inválido(s)">
</c:if>
E parou o erro, mas não loga ! como eu faço para ver o retorno do SpringSecurity ?
Lucas_Cavalcanti 2 de dez. de 2010
se vc tirar o código que imprime o erro, vai parar de aparecer o erro mas ele vai continuar acontecendo!
já parou pra pensar que o Usuário e/ou senha estão inválido(s) ?
Edit: não tinha visto a mensagem anterior, sorry
Lucas_Cavalcanti 2 de dez. de 2010
faltou uma /
<c:if test= " ${ param . error eq 'invalido' } " >
<c:out value= "Usuário e/ou senha inválido(s)"/ >
</c:if>
juniorsatanas 2 de dez. de 2010
Amigo não sei, acho que o DEMO do cara ta errado.. Modifiquei o arquivo APPLICATION CONTEX PARA :
< ?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:tx="http://www.springframework.org/schema/tx"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:lang="http://www.springframework.org/schema/lang"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.xsd
http://www.springframework.org/schema/lang
http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">
< !--contexto-->
< context:property-placeholder location="classpath:application.properties"/>
< context:component-scan base-package="br.gov.ce.nutec" />
< !--anotacao do drive-->
< tx:annotation-driven transaction-manager="txManager"/>
< !--bean fabrica-->
< bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
< property name="persistenceUnitName" value="prime-moviecollector"/>
< property name="dataSource" ref="dataSource" />
< property name="jpaVendorAdapter">
< bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
< property name="databasePlatform" value="${ database . target } "/>
< property name="showSql" value="${ database . showSql } " />
< property name="generateDdl" value="${ database . generateDdl } " />
< /bean>
< /property>
< !--datasource para postgresql-->
< /bean>
< bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close">
< property name="driverClassName" value="org.hibernate.dialect.PostgreSQLDialect"/>
< property name="url" value="jdbc:postgresql://localhost:5432/nutec"/>
< property name="username" value="root"/>
< property name="password" value="debian23"/>
< /bean>
< bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
< property name="entityManagerFactory" ref="entityManagerFactory" />
< /bean>
< bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
< bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
< !--auto configuração postgresql-->
< security:http auto-config='true'>
< security:intercept-url pattern="/createMovie.jsf" access="ROLE_USER" />
< security:intercept-url pattern="/manageMovies.jsf" access="ROLE_USER" />
< !--< security:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /> -->
< security:concurrent-session-control max-sessions="1"/>
< security:logout logout-url="/logout" logout-success-url="/"/>
< /security:http>
< !--autenticação-->
< !--
< security:authentication-provider>
< security:user-service properties="classpath:users.properties">
< /security:user-service>
< /security:authentication-provider>
-->
< !--selec no banco users authorities-->
< security:authentication-provider>
< security:password-encoder hash="plaintext"/>
< security:jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT users.username,users.password,'true' AS enabled FROM financeiro2.users WHERE users.username=?"
authorities-by-username-query="SELECT authorities.username,authorities.autority FROM financeiro2.authorities WHERE authorities.username=?"/>
< /security:authentication-provider>
< /beans>
e funcionou tudo:
o Script do banco ficou assim :
-- Table : financeiro2 . users
-- DROP TABLE financeiro2 . users ;
CREATE TABLE financeiro2 . users
(
pk_id bigserial NOT NULL ,
username character varying ,
"password" character varying ,
enabled character varying ,
CONSTRAINT pkid PRIMARY KEY ( pk_id ),
CONSTRAINT unicidadenome UNIQUE ( username )
)
WITH (
OIDS = FALSE
);
ALTER TABLE financeiro2 . users OWNER TO root ;
-- Table : financeiro2 . authorities
-- DROP TABLE financeiro2 . authorities ;
CREATE TABLE financeiro2 . authorities
(
username character varying ,
autority character varying ,
pkid bigserial NOT NULL ,
CONSTRAINT pk_id PRIMARY KEY ( pkid ),
CONSTRAINT fk_nome FOREIGN KEY ( username )
REFERENCES financeiro2 . users ( username ) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS = FALSE
);
ALTER TABLE financeiro2 . authorities OWNER TO root ;
[img]http://lh4.ggpht.com/_nTzBoYSeT2I/TPfyK-vhS9I/AAAAAAAAEPI/jaj-JbLiQSk/s1152/1.png[/img ]
[img]http://lh3.ggpht.com/_nTzBoYSeT2I/TPfyLX9Gq6I/AAAAAAAAEPM/tgKLZ6tAoow/s1152/2.png[/img ]
QUEM QUISER BAIXAR :
[url]http://www.4shared.com/file/dNxGTdY0/VRaptorAjaxFINAL.html[/url ]
JUNIOR666
juniorsatanas 6 de dez. de 2010