Descoberta Automática de Beans utilizando JSF e Spring

27 respostas
D

E aí pessoal…
Preciso muito da ajuda de vocês para fazer a criação de um projeto utilizando JSF(1.2) e Spring(3.0). Utilizo Netbeans e glassfish; já tentei de todas as formas possíveis para fazer com que os beans sejam descobertos automaticamente e eu não precise registrá-los no faces-config do JSF.
Optei por utilizar esses dois frameworks porque o JSF me dá uma grande facilidade para trabalhar com os view’s e o spring porque me possibilita fazer esta descoberta automática de beans. Sendo assim, posso chamar o bean direto na página view desta forma: #{Controller.nameField}. Até agora, de todas as vezes que tentei, ele me retorna que o “Controller” se encontra nulo.
Só para não perdermos tempo, já tentei utilizar este tutorial: http://www.javasimples.com.br/spring-2/spring-framework-parte-6-injecao-de-dependencia-via-anotacoes mas não deu certo…
Se alguém puder me ajudar…
Desde já agradeço.
Abraços pessoal.

27 Respostas

R

Mostre seu beans.xml, ou applicationContext.xml ou seu faces-config.xml, tudo de xml que voce ta usando por favor…sono ta batendo aqui mas vo tentar te ajudar ‘-’

D
rof20004:
Mostre seu beans.xml, ou applicationContext.xml ou seu faces-config.xml, tudo de xml que voce ta usando por favor....sono ta batendo aqui mas vo tentar te ajudar '-'

arquivo context.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:context="http://www.springframework.org/schema/context"
       xmlns:lang="http://www.springframework.org/schema/lang"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
       default-lazy-init="true">

    <context:component-scan base-package="controle"/>

    <context:annotation-config />
    <context:component-scan base-package="controle" />
</beans>

arquivo web.xml do JSF

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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-app_2_5.xsd">
    <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>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/context.xml</param-value>
    </context-param>
    <welcome-file-list>
        <welcome-file>faces/welcomeJSF.jsp</welcome-file>
    </welcome-file-list>
</web-app>

arquivo faces-config.xml também do JSF

<?xml version='1.0' encoding='UTF-8'?>

<!-- =========== FULL CONFIGURATION FILE ================================== -->

<faces-config version="1.2" 
    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">


</faces-config>

são estes...

R

No seu context.xml, faça um teste deixando somente isto:

<context:component-scan base-package="org.programa.controle" />

Lembrando que nessa tag voce precisa especificar o pacote onde estao os seus beans, tipo, seus beans estao no pacote controle, mas o pacote controle esta dentro de outro pacote ? entao faça a declaracao completa do caminho do mesmo.

R

Tire o <context:annotation-config />

e o repetido, se voce observar esta repetindo.
<context:component-scan base-package=“controle” />

D

rof20004:
Tire o <context:annotation-config />

e o repetido, se voce observar esta repetindo.
<context:component-scan base-package=“controle” />

rof20004, o pacote controle está dentro do pacote padrão do projeto “Pacotes de Código Fonte”.
Retirei o <context:annotation-config /> mas não resolveu…

D

[quote=diegofm300]

rof20004:
Tire o <context:annotation-config />

e o repetido, se voce observar esta repetindo.
<context:component-scan base-package=“controle” />

rof20004, o pacote controle está dentro do pacote padrão do projeto “Pacotes de Código Fonte”.
Retirei o <context:annotation-config /> mas não resolveu…

Lembrando que dentro do Controlador que chamo na classe view eu uso a annotation controller da seguinte forma:
@Controller(“Controlador”)

R

Entao mais uma pergunta mano: poste o codigo da sua pagina, especificamente a parte onde voce chama esse bean, e tb poste a mensagem de erro completa:

Antes de postar, pode testar algo ? veja se existem espaços em branco antes e depois dessa declaração #{Controller.nameField}, e tambem mude o Controller.nameField para

#{controller.nameField}, com C minusculo, ja vi muitos problemas desse tipo serem por causa da declaracao, bom, custa nada tentar ne ^^.

D
rof20004:
Entao mais uma pergunta mano: poste o codigo da sua pagina, especificamente a parte onde voce chama esse bean, e tb poste a mensagem de erro completa:

Antes de postar, pode testar algo ? veja se existem espaços em branco antes e depois dessa declaração #{Controller.nameField}, e tambem mude o Controller.nameField para

#{controller.nameField}, com C minusculo, ja vi muitos problemas desse tipo serem por causa da declaracao, bom, custa nada tentar ne ^^.

Cara, verifiquei a questão dos espaços que você citou mas acho que está tudo ok...
segue o código da página onde faço a chamada ao bean:

arquivo welcomeJSF.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%--
    This file is an entry point for JavaServer Faces application.
--%>
<f:view>
    <h:form>
        <h:outputText value="Usuário: "/>
        <h:inputText id="usuario" value="#{Controle.usuario}"/>
        <h:outputText value="Senha: "/>
        <h:inputText id="senha" value="#{Controle.senha}"/>
        <h:commandButton id="login" value="Login" action="#{Controle.login}"/>
    </h:form>
</f:view>

Erro:

[code]HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception
javax.servlet.ServletException: Target Unreachable, identifier 'Controle' resolved to null

root cause
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'Controle' resolved to null

note The full stack traces of the exception and its root causes are available in the Sun GlassFish Enterprise Server v2.1.1 logs.

--------------------------------------------------------------------------------

Sun GlassFish Enterprise Server v2.1.1

D

rof20004 se puder me ajudar mandando dicas por e-mail também… [email removido]

D

Mais alguém aí tem alguma sugestão para me ajudar ?

R

Desculpe se estiver falando bobagem mas… se não me engano, descoberta de bean automática só acontece no JSF 2.0, e você está utilizando 1.2… não seria isso?

D

Eu utilizo essa descoberta automática de beans em outro projeto o JSF 1.2 com Spring 3.0. Caso vc possa me ajudar com a configuração desde o início usando JSF 2.0 também serve…tem problema não…

R
diegofm300:
rodrigomarcelo:
Desculpe se estiver falando bobagem mas... se não me engano, descoberta de bean automática só acontece no JSF 2.0, e você está utilizando 1.2... não seria isso?

Eu utilizo essa descoberta automática de beans em outro projeto o JSF 1.2 com Spring 3.0. Caso vc possa me ajudar com a configuração desde o início usando JSF 2.0 também serve...tem problema não...

Não tem segredo algum em JSF 2.0:

@ManagedBean(name = "apelidoDoBean")
@ViewScoped
public class BeanTalTalTal {

}

E se usa da maneira que você precisa ai mesmo... apenas #{apelidoDoBean}...

D
rodrigomarcelo:
diegofm300:
rodrigomarcelo:
Desculpe se estiver falando bobagem mas... se não me engano, descoberta de bean automática só acontece no JSF 2.0, e você está utilizando 1.2... não seria isso?

Eu utilizo essa descoberta automática de beans em outro projeto o JSF 1.2 com Spring 3.0. Caso vc possa me ajudar com a configuração desde o início usando JSF 2.0 também serve...tem problema não...

Não tem segredo algum em JSF 2.0:

@ManagedBean(name = "apelidoDoBean")
@ViewScoped
public class BeanTalTalTal {

}

E se usa da maneira que você precisa ai mesmo... apenas #{apelidoDoBean}...

Como ficaria os xml's de configuração ?

R

Não é necessário alterar nada com relação a isto nos xml’s de configuração… =]

D

Não é necessário alterar nada com relação a isto nos xml’s de configuração… =]

Deixar da maneira que coloquei neste post né ?

R

Sim sim… na vdd quando vc iniciar um novo projeto, marque a opção de criar o web.xml e o faces-config e eles já vem prontos, sem parametros praticamente… ao longo pro projeto, certamente voce precisará incluir converters, listeners e afins… mas inicialmente é soh isto mesmo…

D

Vou tentar aqui…qualquer dúvida posto aqui novamente.
Valeu por enquanto.

D
diegofm300:
rodrigomarcelo:
Sim sim... na vdd quando vc iniciar um novo projeto, marque a opção de criar o web.xml e o faces-config e eles já vem prontos, sem parametros praticamente... ao longo pro projeto, certamente voce precisará incluir converters, listeners e afins... mas inicialmente é soh isto mesmo...

Vou tentar aqui...qualquer dúvida posto aqui novamente.
Valeu por enquanto.

Será necessário fazer essa configuração no meu arquivo context.xml do spring?

<?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:lang="http://www.springframework.org/schema/lang"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
       default-lazy-init="true">

    <context:component-scan base-package="controle"/>

    <context:annotation-config />
    <context:component-scan base-package="controle" />
</beans>
D

Pessoal, fiz várias tentativas utilizando as dicas de vocês mas ainda não consegui resolver o problema. O bean é retornado nulo. Alguém pode me explicar passo a passo como devo fazer ???
Alguém me dá mais uma força aí ?

R

Vou mostrar como eu uso. Também é JSF 1.2 e Spring:

web.xml:

&lt;listener&gt;
    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;listener&gt;
    &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
  &lt;/listener&gt;

faces-config.xml:

&lt;application&gt;
	
	   &lt;resource-bundle&gt;
			&lt;base-name&gt;message&lt;/base-name&gt;
			&lt;var&gt;msg&lt;/var&gt;
		&lt;/resource-bundle&gt;
	
		&lt;view-handler&gt;com.sun.facelets.FaceletViewHandler&lt;/view-handler&gt;
		&lt;el-resolver&gt;org.springframework.web.jsf.el.SpringBeanFacesELResolver&lt;/el-resolver&gt;
	&lt;/application&gt;

applicationContext.xml:

&lt;bean
		class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" /&gt;
	&lt;bean
		class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;

	
	&lt;bean id="contextApplicationContextProvider" class="context.ApplicationContextProvider" /&gt;
	&lt;tx:annotation-driven /&gt;

	&lt;context:component-scan base-package="*" /&gt;

Exemplo de uso:

Bean injetado:

@Component
public class ProjetoDaoImp extends GenericDaoImp&lt;Projeto,Long&gt;
implements ProjetoDao{
@Component
public class ProjetoController {

	@Resource
	ProjetoDao dao;
D
raf4ever:
Vou mostrar como eu uso. Também é JSF 1.2 e Spring: web.xml:
&lt;listener&gt;
    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;listener&gt;
    &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
  &lt;/listener&gt;
faces-config.xml:
&lt;application&gt;
	
	   &lt;resource-bundle&gt;
			&lt;base-name&gt;message&lt;/base-name&gt;
			&lt;var&gt;msg&lt;/var&gt;
		&lt;/resource-bundle&gt;
	
		&lt;view-handler&gt;com.sun.facelets.FaceletViewHandler&lt;/view-handler&gt;
		&lt;el-resolver&gt;org.springframework.web.jsf.el.SpringBeanFacesELResolver&lt;/el-resolver&gt;
	&lt;/application&gt;
applicationContext.xml:
&lt;bean
		class=&quot;org.springframework.context.annotation.CommonAnnotationBeanPostProcessor&quot; /&gt;
	&lt;bean
		class=&quot;org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor&quot; /&gt;

	
	&lt;bean id=&quot;contextApplicationContextProvider&quot; class=&quot;context.ApplicationContextProvider&quot; /&gt;
	&lt;tx:annotation-driven /&gt;

	&lt;context:component-scan base-package=&quot;*&quot; /&gt;

Exemplo de uso:

Bean injetado:
@Component
public class ProjetoDaoImp extends GenericDaoImp&lt;Projeto,Long&gt;
implements ProjetoDao{
@Component
public class ProjetoController {

	@Resource
	ProjetoDao dao;

raf4ever, o projeto não roda...dá aquele erro: HTTP Status 503...
vou te passar como estão os meus arquivos

web.xml

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;web-app version="2.5" 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-app_2_5.xsd"&gt;
    &lt;context-param&gt;
        &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
        &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;listener&gt;
        &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
    &lt;/listener&gt;
    &lt;servlet&gt;
        &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
        &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;listener&gt;
        &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
    &lt;/listener&gt;
    &lt;servlet&gt;
        &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
        &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;session-config&gt;
        &lt;session-timeout&gt;
            30
        &lt;/session-timeout&gt;
    &lt;/session-config&gt;
    &lt;welcome-file-list&gt;
        &lt;welcome-file&gt;faces/welcomeJSF.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
&lt;/web-app&gt;

faces-config.xml

&lt;?xml version='1.0' encoding='UTF-8'?&gt;

&lt;!-- =========== FULL CONFIGURATION FILE ================================== --&gt;

&lt;faces-config version="1.2" 
    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"&gt;


    &lt;application&gt;

        &lt;resource-bundle&gt;
            &lt;base-name&gt;message&lt;/base-name&gt;
            &lt;var&gt;msg&lt;/var&gt;
        &lt;/resource-bundle&gt;

        &lt;view-handler&gt;com.sun.facelets.FaceletViewHandler&lt;/view-handler&gt;
        &lt;el-resolver&gt;org.springframework.web.jsf.el.SpringBeanFacesELResolver&lt;/el-resolver&gt;
    &lt;/application&gt;

&lt;/faces-config&gt;
welcomeJSF.jsp
&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;

&lt;%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%&gt;
&lt;%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%&gt;

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"&gt;

&lt;%--
    This file is an entry point for JavaServer Faces application.
--%&gt;
&lt;f:view&gt;
    &lt;h:form&gt;
        &lt;h:outputText value="Usuário: "/&gt;
        &lt;h:inputText value="#{Controle.usuario}"/&gt;
        &lt;h:outputText value="Senha: "/&gt;
        &lt;h:inputText value="#{Controle.senha}"/&gt;
    &lt;/h:form&gt;
&lt;/f:view&gt;

applicationContext.xml

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;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:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&gt;
    
    &lt;bean
		class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" /&gt;
    &lt;bean
		class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;


    &lt;bean id="contextApplicationContextProvider" class="context.ApplicationContextProvider" /&gt;
    &lt;tx:annotation-driven /&gt;

    &lt;context:component-scan base-package="controle" /&gt;

&lt;/beans&gt;

meu controlador(bean):

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controle;

import org.springframework.stereotype.Component;

@Component
public class Controle {

    private String usuario;
    private String senha;

    public Boolean login() {
        if (getUsuario().equals("admin") && getSenha().equals("admin")) {
            return true;
        }
        return false;
    }

    public String getSenha() {
        if (senha == null) {
            senha = "";
        }
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getUsuario() {
        if (usuario == null) {
            usuario = "";
        }
        return usuario;
    }

    public void setUsuario(String usuario) {
        this.usuario = usuario;
    }
}
fiz este método login que é chamado pelo commandButton bem simples só para caráter de teste mesmo... Fiz também a validação do arquivo applicationContext.xml após colocar as configurações que você me passou e ele me retornou o seguinte erro:
The prefix "context" for element "context:component-scan" is not bound. [34]
R

Ainda precisa de algumas modificações:

Pode retirar esses dois trechos:

&lt;context-param&gt;  
        &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;  
        &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;  
    &lt;/context-param&gt;  

  &lt;servlet&gt;  
        &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;  
        &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;  
        &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;  
    &lt;/servlet&gt;

E adapta o cabeçalho do teu applicationContext.xml de acordo com esse:

&lt;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"
	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"&gt;
D

raf4ever:
Ainda precisa de algumas modificações:

Pode retirar esses dois trechos:

&lt;context-param&gt;  
        &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;  
        &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;  
    &lt;/context-param&gt;  

  &lt;servlet&gt;  
        &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;  
        &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;  
        &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;  
    &lt;/servlet&gt;

E adapta o cabeçalho do teu applicationContext.xml de acordo com esse:

&lt;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" 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"&gt;

Cara, parece que está quase dando certo…
agora faltou componente dispatcher, olha a saída da IDE:

Deploying application in domain failed; Error loading deployment descriptors for module [PROJETO] -- There is no web component by the name of dispatcher here. /home/NetBeansProjects/PROJETO/nbproject/build-impl.xml:713: O módulo não foi implementado. FALHA NA CONSTRUÇÃO (tempo total: 0 segundos)

R

Vixe,esse erro eu nunca vi.Tá usando qual servidor de aplicacao?

D

Glassfish 2.1

R

Glassfish 2.1

É mandatório usar um AS full-stack? Tinha como testar num Tomcat da vida?

Criado 12 de fevereiro de 2013
Ultima resposta 21 de fev. de 2013
Respostas 27
Participantes 4