Página em Branco JSF2

9 respostas
R

Bom, ao tentar acessar minha página (que possui Primefaces) pelo link: localhost:8080/MeuProjeto/tabelas/funcionario.jsf a página fica simplesmente em branco. Então, coloquei um texto qualquer na página e aparece normalmente o texto, mas nenhum componente primefaces aparece.

1 - O que pode ser ?
2 - Não tem como habilitar um log de erros caso algo não seja inicializado corretamente, eu gostaria de ver os erros da página e não que ela mostrasse tudo em branco.

9 Respostas

tmvolpato

como está sua página? cole o código ai…

R

Desculpe a demora, mas lá vai minha página:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	
</h:head>
<h:body>
	<h:messages globalOnly="true" />
	<h:form id="formPesquisaDentista" rendered="#{dentistaMB.editMode}">
		<h:commandLink action="#{dentistaMB.criar}" value="Adicionar Dentista" />

		<h:panelGrid columns="2">
			<h:panelGroup>
			hello
			</h:panelGroup>
		</h:panelGrid>
	</h:form>
</h:body>
</html>
drsmachado

Provavelmente o mapeamento que você fez esteja contemplando alguma outra extensão (ao invés de .jsf, pode ser .xhtml).

R

Segue meu mapeamento:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	id="WebApp_ID">
	<display-name>Odontonew</display-name>
	<!-- Configuracao do Spring -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/applicationContext.xml</param-value>
	</context-param>
	<listener>
	<listener-class>
		org.springframework.web.context.ContextLoaderListener
	</listener-class>
  </listener>
  <listener>
	<listener-class>
		org.springframework.web.context.request.RequestContextListener
	</listener-class>
  </listener>
	<!-- Configuracao DO JSF -->
	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.jsf</url-pattern>
		<url-pattern>/faces/*</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.jsf</welcome-file>
	</welcome-file-list>
	
	<context-param>
		<param-name>javax.faces.PROJECT_STAGE</param-name>
		<param-value>Development</param-value>
	</context-param>
</web-app>
R

Olha como aparece o código renderizado na página:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/Odontonew/javax.faces.resource/theme.css.jsf?ln=primefaces-aristo" /></head><body></body>
</html>
drsmachado

Então, sinceramente não gosto disso

<servlet-mapping>  
        <servlet-name>Faces Servlet</servlet-name>  
        <url-pattern>*.jsf</url-pattern>  
        <url-pattern>/faces/*</url-pattern>  
    </servlet-mapping>

Prefiro isolar (na verdade, acho que o servlet-mapping só aceita uma tag url-pattern, mas não tenho certeza)

<servlet-mapping>  
        <servlet-name>Faces Servlet</servlet-name>  
            <url-pattern>*.jsf</url-pattern>  
 </servlet-mapping>
 <servlet-mapping>  
        <servlet-name>Faces Servlet</servlet-name>  
        <url-pattern>/faces/*</url-pattern>  
    </servlet-mapping>

Ou, melhor ainda

<servlet-mapping>  
        <servlet-name>Faces Servlet</servlet-name>  
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

Enfim, é o que me parece.

R

fiz como você mencionou no ultimo código, apenas JSF, mas continua não aparecendo nada na pagina.

drsmachado

Está rodando em que ambiente?
Há alguma exceção lançada na inicialização?

R

Segue inicializacao do tomcat7
obs. uso hibernate, spring, jsf2

Ago 15, 2013 5:26:20 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 (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Java\jre7\bin;C:\Program Files (x86)\Java\jdk1.7.0_21\bin;C:\ZendFramework-1.12.3\bin;C:\Program Files (x86)\VertrigoServ\Php;C:\Program Files (x86)\eclipse;;.
Ago 15, 2013 5:26:20 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Odontonew' did not find a matching property.
Ago 15, 2013 5:26:20 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Ago 15, 2013 5:26:20 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Ago 15, 2013 5:26:20 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 473 ms
Ago 15, 2013 5:26:20 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Ago 15, 2013 5:26:20 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
Ago 15, 2013 5:26:28 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Ago 15, 2013 5:26:28 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Ago 15, 2013 5:26:28 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Thu Aug 15 17:26:28 GMT-03:00 2013]; root of context hierarchy
Ago 15, 2013 5:26:28 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
Ago 15, 2013 5:26:28 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1d09f3: 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,basicBO,basicDAO,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,entityManagerFactory,transactionManager]; root of factory hierarchy
Ago 15, 2013 5:26:28 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
Ago 15, 2013 5:26:28 PM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory
INFO: Building JPA container EntityManagerFactory for persistence unit 'odontonewPU'
1 [Thread-2] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA
3 [Thread-2] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0.SP1
5 [Thread-2] INFO org.hibernate.cfg.Environment - hibernate.properties not found
7 [Thread-2] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
8 [Thread-2] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
23 [Thread-2] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA
24 [Thread-2] INFO org.hibernate.ejb.Version - Hibernate EntityManager 3.4.0.GA
27 [Thread-2] INFO org.hibernate.ejb.Ejb3Configuration - Processing PersistenceUnitInfo [
	name: odontonewPU
	...]
76 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.Pessoa
87 [Thread-2] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity br.com.odontonew.bean.Pessoa on table pessoa
107 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.PessoaFisica
108 [Thread-2] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity br.com.odontonew.bean.PessoaFisica on table pessoa_fisica
110 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.PessoaJuridica
110 [Thread-2] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity br.com.odontonew.bean.PessoaJuridica on table pessoa_juridica
112 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.Lov
112 [Thread-2] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity br.com.odontonew.bean.Lov on table lov
124 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.Sexo
125 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.SituacaoPessoa
125 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.Uf
125 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.Dentista
126 [Thread-2] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity br.com.odontonew.bean.Dentista on table dentista
126 [Thread-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: br.com.odontonew.bean.EstadoCivil
130 [Thread-2] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring
148 [Thread-2] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
150 [Thread-2] INFO org.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
155 [Thread-2] INFO org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider - Using provided datasource
301 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - RDBMS: MySQL, version: 5.5.28
301 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.15 ( Revision: ${bzr.revision-id} )
305 [Thread-2] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect
306 [Thread-2] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
306 [Thread-2] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
306 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
306 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
306 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
306 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
307 [Thread-2] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: enabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
307 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
308 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
308 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
308 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
308 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
308 [Thread-2] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
335 [Thread-2] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
421 [Thread-2] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
422 [Thread-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update
422 [Thread-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - fetching database metadata
434 [Thread-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - updating schema
451 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: odontonew.dentista
451 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - columns: [id_pessoa_fisica, id, cro]
451 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: [fk35141b9e5144569f]
451 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [primary, fk35141b9e5144569f]
461 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: odontonew.lov
461 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - columns: [codigo, id, tipo, descricao]
461 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: []
461 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [primary]
474 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: odontonew.pessoa
474 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - columns: [telefone3, complemento, telefone2, id_situacao, telefone1, observacao, id, bairro, cidade, cep, id_uf, email, nome, data_cadastro, endereco]
474 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: [fkc4e40fa74dc351fc, fkc4e40fa7303b92af]
474 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [fkc4e40fa74dc351fc, primary, fkc4e40fa7303b92af]
487 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: odontonew.pessoa_fisica
487 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - columns: [id, id_sexo, datanascimento, id_estado_civil, rg, cpf]
487 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: [fkfd9d240fc5a93835, fkfd9d240f5c7648f8, fkfd9d240fea3507ec]
487 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [fkfd9d240fc5a93835, fkfd9d240f5c7648f8, primary, fkfd9d240fea3507ec]
496 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: odontonew.pessoa_juridica
497 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - columns: [id, id_sexo, datanascimento, id_estado_civil, rg, cpf]
497 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: [fk237f9cfdc5a93835, fk237f9cfd5c7648f8, fk237f9cfdea3507ec]
497 [Thread-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [fk237f9cfdc5a93835, primary, fk237f9cfd5c7648f8, fk237f9cfdea3507ec]
497 [Thread-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - schema update complete
Ago 15, 2013 5:26:29 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 952 ms
Ago 15, 2013 5:26:29 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Inicializando Mojarra 2.1.6 (SNAPSHOT 20111206) para o contexto '/Odontonew'
Ago 15, 2013 5:26:29 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.
1135 [Thread-2] INFO org.hibernate.validator.util.Version - Hibernate Validator 4.0.2.GA
Ago 15, 2013 5:26:29 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 3.5
Ago 15, 2013 5:26:29 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFO: Monitoring jndi:/localhost/Odontonew/WEB-INF/faces-config.xml for modifications
Ago 15, 2013 5:26:29 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Ago 15, 2013 5:26:29 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Ago 15, 2013 5:26:29 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9093 ms
Ago 15, 2013 5:26:37 PM javax.faces.component.UIViewRoot$ViewMap put
WARNING: Definindo valor de atributo não serializável em ViewMap (chave: dentistaMB, classe do valor: br.com.odontonew.mb.DentistaMBImpl).
Ago 15, 2013 5:26:38 PM javax.faces.component.UIViewRoot$ViewMap put
WARNING: Definindo valor de atributo não serializável em ViewMap (chave: dentistaMB, classe do valor: br.com.odontonew.mb.DentistaMBImpl).
Criado 14 de agosto de 2013
Ultima resposta 15 de ago. de 2013
Respostas 9
Participantes 3