Seguinte:
To com uma aplicação aqui que to usando Spring 2.5 com hibernate, fora da web funciona normal, tem um CRUD que funciona perfeitamente num teste fora do server. To tentando fazer isso funcionar com jsf, ai quando eu inicio o server aparece esse erro que eu postei acima. Vou colocar abaixo o conteudo dos meus arquivos, se alguem puder me ajudar fico muito grato.
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>planejasp</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<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>/faces/*</url-pattern>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
faces-config:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
<application>
<variable-resolver>
org.springframework.web.jsf.DelegatingVariableResolver
</variable-resolver>
</application>
</faces-config>
applicationContext.xml
<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config/>
<context:component-scan base-package="br.gov.sp"></context:component-scan>
<tx:annotation-driven/>
<!-- ################################################################################ -->
<bean id="oracleDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="urldDoBancoDeDados"/>
<property name="username" value="usuario"/>
<property name="password" value="senha"/>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref local="oracleDataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>br.gov.sp.planejamento.planejasp.beans.PspTipoBeneficios</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- ###################################################################################3 -->
</beans>
minha JSP:
<f:view>
<h:form>
Nome: <h:inputText value="#{pspTipoBenefHandler.nome}"/>
<br />
Desc: <h:inputText value="#{pspTipoBenefHandler.desc}"/>
<br />
<h:commandButton value="Salvar" action="#{pspTipoBenefHandler.novo}"/>
</h:form>
</f:view>
bean:
package br.gov.sp.planejamento.planejasp.beans;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name="PSP_TIPO_BENEFICIOS")
@SequenceGenerator(name="SEQ_TP_BENEF", sequenceName="SEQ_TP_BENEF")
public class PspTipoBeneficios {
@Id
@GeneratedValue(generator="SEQ_TP_BENEF")
@Column(name="SEQ_TP_BENEF")
private long id;
@Basic(optional=true)
@Column(name="NOME_TP_BENEF")
private String nomeTpBenef;
@Basic(optional=true)
@Column(name="DESC_TP_BENEF")
private String descTpBenef;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNomeTpBenef() {
return nomeTpBenef;
}
public void setNomeTpBenef(String nomeTpBenef) {
this.nomeTpBenef = nomeTpBenef;
}
public String getDescTpBenef() {
return descTpBenef;
}
public void setDescTpBenef(String descTpBenef) {
this.descTpBenef = descTpBenef;
}
}
ManagedBean:
package br.gov.sp.planejamento.planejasp.handler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import br.gov.sp.planejamento.planejasp.gerenciador.GerenciadorPspTipoBeneficios;
@Controller
@Qualifier("tipoBenefHandler")
public class PspTipoBeneficiosHandler {
@Autowired
GerenciadorPspTipoBeneficios gerenciadorPspTipoBeneficios;
Long id;
String nome;
String desc;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public GerenciadorPspTipoBeneficios getGerenciadorPspTipoBeneficios() {
return gerenciadorPspTipoBeneficios;
}
public void setGerenciadorPspTipoBeneficios(
GerenciadorPspTipoBeneficios gerenciadorPspTipoBeneficios) {
this.gerenciadorPspTipoBeneficios = gerenciadorPspTipoBeneficios;
}
public void novo(){
gerenciadorPspTipoBeneficios.novo(nome, desc);
}
}
Alguem pode me ajudar? o que pode estar errado ?
e se eu tento salvar usando o jsp da o seguinte erro:
root cause
org.apache.jasper.el.JspPropertyNotFoundException: /psptipobeneficios.jsp(16,15) '#{pspTipoBenefHandler.nome}' Target Unreachable, identifier 'pspTipoBenefHandler' resolved to null
org.apache.jasper.el.JspValueExpression.getType(JspValueExpression.java:61)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
javax.faces.component.UIInput.validate(UIInput.java:860)
javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
javax.faces.component.UIInput.processValidators(UIInput.java:666)
javax.faces.component.UIForm.processValidators(UIForm.java:229)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1030)
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
org.ajax4jsf.component.AjaxViewRoot.access$201(AjaxViewRoot.java:59)
org.ajax4jsf.component.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:321)
org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:171)
org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:335)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)