0 Replies Latest reply on Aug 3, 2003 12:15 PM by squalidus

    Dispatch Error at Lookup ???

    squalidus Newbie

      Hello!

      I am trying to make a simple aplication using JBOSS 3.2.1, Jbulider 7, JDK1.3.1 and Struts.

      The aplication uses the ServiceLocator design Pattern, and, when he try to lookup de EJB Product, a strange error happens...

      The compilation and deploy didnt show any error. Also, the lookup of the Connection Bean works fine...

      Error occurs in this line:
      recurso = initialContext.lookup(nomeJNDI)

      10:04:55,040 ERROR [DispatchAction] Dispatch[/incluirProdutoAction] to method incluirProduto returned an exception
      java.lang.reflect.InvocationTargetException:
      java.lang.StackOverflowError
      at com.sun.naming.internal.VersionHelper12$6.run(VersionHelper12.java:164)
      at java.security.AccessController.doPrivileged(Native Method)
      ...


      I think the error can be in one of xml files:

      *** JBOSS-WEB.XML ***

      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE jboss-web (View Source for full doctype...)>
      <jboss-web>
      <ejb-ref>
      <ejb-ref-name>ejb/ControleProduto</ejb-ref-name>
      <jndi-name>java:comp/env/ejb/ControleProduto</jndi-name>
      </ejb-ref>
      </jboss-web>

      *** WEB.XML ***

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>

      <servlet-name>action</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
      <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
      </init-param>
      <init-param>
      <param-name>application</param-name>
      <param-value>messages.ApplicationResources</param-value>
      </init-param>
      <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
      </init-param>
      <load-on-startup>2</load-on-startup>

      <servlet-mapping>
      <servlet-name>action</servlet-name>
      <url-pattern>*.do</url-pattern>
      </servlet-mapping>

      <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>


      <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-html.tld</taglib-location>


      <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>


      <taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-template.tld</taglib-location>


      <ejb-ref>
      <ejb-ref-name>ejb/ControleProduto</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      pdv.casouso.manterproduto.ControleProdutoHome
      pdv.casouso.manterproduto.ControleProduto
      </ejb-ref>
      </web-app>

      *** EJB-JAR.XML ***

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <display-name>ControleProduto</display-name>
      <ejb-name>ControleProduto</ejb-name>
      <local-home>pdv.casouso.manterproduto.ControleProdutoHome</local-home>
      pdv.casouso.manterproduto.ControleProduto
      <ejb-class>pdv.casouso.manterproduto.ControleProdutoBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      <display-name>ControleCompra</display-name>
      <ejb-name>ControleCompra</ejb-name>
      <local-home>pdv.casouso.compraritens.ControleCompraHome</local-home>
      pdv.casouso.compraritens.ControleCompra
      <ejb-class>pdv.casouso.compraritens.ControleCompraBean</ejb-class>
      <session-type>Stateful</session-type>
      <transaction-type>Bean</transaction-type>


      <display-name>ManterFornecedor</display-name>
      <ejb-name>ManterFornecedor</ejb-name>
      pdv.casouso.ManterFornecedor.ManterFornecedorHome
      pdv.casouso.ManterFornecedor.ManterFornecedor
      <local-home>pdv.casouso.ManterFornecedor.ManterFornecedorLocalHome</local-home>
      pdv.casouso.ManterFornecedor.ManterFornecedorLocal
      <ejb-class>pdv.casouso.ManterFornecedor.ManterFornecedorBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      <display-name>Produto</display-name>
      <ejb-name>Produto</ejb-name>
      <local-home>pdv.entidade.produto.ProdutoHome</local-home>
      pdv.entidade.produto.Produto
      <ejb-class>pdv.entidade.produto.ProdutoBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Produto</abstract-schema-name>
      <cmp-field>
      <field-name>codigo</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>nome</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>preco</field-name>
      </cmp-field>
      <primkey-field>codigo</primkey-field>

      <query-method>
      <method-name>findAll</method-name>
      <method-params />
      </query-method>
      <ejb-ql>SELECT DISTINCT OBJECT(p) FROM Produto p</ejb-ql>



      <display-name>Pedido</display-name>
      <ejb-name>Pedido</ejb-name>
      <local-home>pdv.entidade.pedido.PedidoHome</local-home>
      pdv.entidade.pedido.Pedido
      <ejb-class>pdv.entidade.pedido.PedidoBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Pedido</abstract-schema-name>
      <cmp-field>
      <field-name>codigo</field-name>
      </cmp-field>
      <primkey-field>codigo</primkey-field>

      <query-method>
      <method-name>findAll</method-name>
      <method-params />
      </query-method>
      <ejb-ql>SELECT DISTINCT OBJECT(p) FROM Pedido p</ejb-ql>



      <display-name>ItemPedido</display-name>
      <ejb-name>ItemPedido</ejb-name>
      <local-home>pdv.entidade.pedido.ItemPedidoHome</local-home>
      pdv.entidade.pedido.ItemPedido
      <ejb-class>pdv.entidade.pedido.ItemPedidoBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>ItemPedido</abstract-schema-name>
      <cmp-field>
      <field-name>oid</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>quantidade</field-name>
      </cmp-field>
      <primkey-field>oid</primkey-field>


      <display-name>Fornecedor</display-name>
      <ejb-name>Fornecedor</ejb-name>
      pdv.entidade.fornecedor.FornecedorRemoteHome
      pdv.entidade.fornecedor.FornecedorRemote
      <local-home>pdv.entidade.fornecedor.FornecedorHome</local-home>
      pdv.entidade.fornecedor.Fornecedor
      <ejb-class>pdv.entidade.fornecedor.FornecedorBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Fornecedor</abstract-schema-name>
      <cmp-field>
      <field-name>razaoSocial</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>oid</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>cnpj</field-name>
      </cmp-field>
      <primkey-field>oid</primkey-field>

      </enterprise-beans>

      <ejb-relation>
      <ejb-relation-name>itemPedido-produto</ejb-relation-name>
      <ejb-relationship-role>
      itemPedido
      <ejb-relationship-role-name>ItemPedidoRelationshipRole</ejb-relationship-role-name>
      Many
      <relationship-role-source>
      itemPedido
      <ejb-name>ItemPedido</ejb-name>
      </relationship-role-source>
      <cmr-field>
      produto
      <cmr-field-name>produto</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      produto
      <ejb-relationship-role-name>ProdutoRelationshipRole</ejb-relationship-role-name>
      One
      <relationship-role-source>
      produto
      <ejb-name>Produto</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>pedido-itemPedido</ejb-relation-name>
      <ejb-relationship-role>
      pedido
      <ejb-relationship-role-name>PedidoRelationshipRole</ejb-relationship-role-name>
      One
      <relationship-role-source>
      pedido
      <ejb-name>Pedido</ejb-name>
      </relationship-role-source>
      <cmr-field>
      itemPedido
      <cmr-field-name>itensPedido</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      itemPedido
      <ejb-relationship-role-name>ItemPedidoRelationshipRole</ejb-relationship-role-name>
      Many
      <cascade-delete />
      <relationship-role-source>
      itemPedido
      <ejb-name>ItemPedido</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      <ejb-relation-name>fornecedor-produto</ejb-relation-name>
      <ejb-relationship-role>
      fornecedor
      <ejb-relationship-role-name>FornecedorRelationshipRole</ejb-relationship-role-name>
      One
      <relationship-role-source>
      fornecedor
      <ejb-name>Fornecedor</ejb-name>
      </relationship-role-source>
      <cmr-field>
      produto
      <cmr-field-name>produtos</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      produto
      <ejb-relationship-role-name>ProdutoRelationshipRole</ejb-relationship-role-name>
      Many
      <relationship-role-source>
      produto
      <ejb-name>Produto</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      <assembly-descriptor>
      <container-transaction>


      <ejb-name>Produto</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>ControleProduto</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>Pedido</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>ItemPedido</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>Fornecedor</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>ManterFornecedor</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      *** JBOSS.XML ***

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC '-//JBoss//DTD JBOSS 3.0//EN' 'http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd'>


      <enterprise-beans>

      <ejb-name>ControleProduto</ejb-name>
      <local-jndi-name>java:comp/env/ejb/ControleProduto</local-jndi-name>


      <ejb-name>ControleCompra</ejb-name>
      <local-jndi-name>ControleCompra</local-jndi-name>


      <ejb-name>ManterFornecedor</ejb-name>
      <jndi-name>ManterFornecedor</jndi-name>
      <local-jndi-name>ManterFornecedorLocal</local-jndi-name>


      <ejb-name>Produto</ejb-name>
      <local-jndi-name>Produto</local-jndi-name>


      <ejb-name>Pedido</ejb-name>
      <local-jndi-name>Pedido</local-jndi-name>


      <ejb-name>ItemPedido</ejb-name>
      <local-jndi-name>ItemPedido</local-jndi-name>


      <ejb-name>Fornecedor</ejb-name>
      <jndi-name>FornecedorRemote</jndi-name>
      <local-jndi-name>Fornecedor</local-jndi-name>

      </enterprise-beans>


      Anyone have a tip for me ? Im already tried a lot of things... If you need know more about the application,
      tell me how files do you need to see...


      THANKS in ADVANCE

      Squalidus <wirk@hotmail.com>