thiagopri 18 de nov. de 2008
Opa, blz ?
Rapaz, para poder importar as libs do Struts, basta vc inclui-las no WEB-INF/lib da sua aplicação (e tb incluir os arquivos de conf do struts), mas pelo que entendi vc está tendo problemas com a IDE, correto ? Qual IDE ? Qual versão ?
Valew.
RDSILVA 18 de nov. de 2008
cara estou utilizando o eclipse 3.2
minha web inf esta assim
<?xml version="1.0" encoding="UTF-8"?>
<web-app id= "WebApp_ID" version= "2.4" xmlns= "http://java.sun.com/xml/ns/j2ee" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<display-name> TesteStruts</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>
<servlet>
<servlet-name> action</servlet-name>
<servlet-class> org.apache.struts.action.ActionServlet</servlet-class>
<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>
<servlet-mapping>
<servlet-name> action</servlet-name>
<url-pattern> *.do</url-pattern>
</servlet-mapping>
</web-app>
e meu Struts-config.xml esta assim
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Fundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<action-mappings>
<action path= "/VerificaAno" type= "br.com.webStruts.VerificaAno" >
<forward name= "resposta" path= "/resultadoAno.jsp" ></forward>
</action>
</action-mappings>
</struts-config>
mas quando começo fazer minha classe e tento fazer
import org.apache.struts …não aparece o pacote STRUTS para que eu faça os imports…
caio_ferreira 18 de nov. de 2008
kra, eu sempre vejo por ai, o pessoal falando que o eclipse é a melhor IDE, mas sempre que tento usar ele acontece esse tipo de problemas, eu uso o NetBeans e acho bem mais facil…mas ainda vou aprender usar o eclipse
thiagopri 18 de nov. de 2008
RDSilva, só falta vc colocar os arquivos *.jar referente ao struts (no caso do 1.3 basico - struts-core-1.3.8.jar + apache commons) no seguinte diretorio: <dir_projeto>/WebContent/WEB-INF/lib. De um refresh no seu projeto e tente novamente. Leia a doc do struts para saber quais jar vc vai precisar de acordo com as features que vai utilizar.
Abs.
RDSILVA 18 de nov. de 2008
Agora ja funcionou…so que ao executar a aplicação aparece o seguinte erro
13 : 53 : 45 , 711 ERROR [[ / TesteStruts ]] Servlet / TesteStruts threw load () exception
java . lang . ClassNotFoundException : org . apache . struts . action . ActionServlet
at org . apache . catalina . loader . WebappClassLoader . loadClass ( WebappClassLoader . java : 1355 )
at org . apache . catalina . loader . WebappClassLoader . loadClass ( WebappClassLoader . java : 1201 )
at org . apache . catalina . core . StandardWrapper . loadServlet ( StandardWrapper . java : 1034 )
at org . apache . catalina . core . StandardWrapper . load ( StandardWrapper . java : 932 )
at org . apache . catalina . core . StandardContext . loadOnStartup ( StandardContext . java : 3951 )
at org . apache . catalina . core . StandardContext . start ( StandardContext . java : 4225 )
at org . apache . catalina . core . ContainerBase . addChildInternal ( ContainerBase . java : 759 )
at org . apache . catalina . core . ContainerBase . addChild ( ContainerBase . java : 739 )
at org . apache . catalina . core . StandardHost . addChild ( StandardHost . java : 524 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . apache . commons . modeler . BaseModelMBean . invoke ( BaseModelMBean . java : 503 )
at org . jboss . mx . server . RawDynamicInvoker . invoke ( RawDynamicInvoker . java : 164 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . apache . catalina . core . StandardContext . init ( StandardContext . java : 5052 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . apache . commons . modeler . BaseModelMBean . invoke ( BaseModelMBean . java : 503 )
at org . jboss . mx . server . RawDynamicInvoker . invoke ( RawDynamicInvoker . java : 164 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . jboss . web . tomcat . tc5 . TomcatDeployer . performDeployInternal ( TomcatDeployer . java : 297 )
at org . jboss . web . tomcat . tc5 . TomcatDeployer . performDeploy ( TomcatDeployer . java : 103 )
at org . jboss . web . AbstractWebDeployer . start ( AbstractWebDeployer . java : 371 )
at org . jboss . web . WebModule . startModule ( WebModule . java : 83 )
at org . jboss . web . WebModule . startService ( WebModule . java : 61 )
at org . jboss . system . ServiceMBeanSupport . jbossInternalStart ( ServiceMBeanSupport . java : 289 )
at org . jboss . system . ServiceMBeanSupport . jbossInternalLifecycle ( ServiceMBeanSupport . java : 245 )
at sun . reflect . GeneratedMethodAccessor2 . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . jboss . mx . interceptor . ReflectedDispatcher . invoke ( ReflectedDispatcher . java : 155 )
at org . jboss . mx . server . Invocation . dispatch ( Invocation . java : 94 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 86 )
at org . jboss . mx . server . AbstractMBeanInvoker . invoke ( AbstractMBeanInvoker . java : 264 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . jboss . system . ServiceController $ ServiceProxy . invoke ( ServiceController . java : 978 )
at $ Proxy0 . start ( Unknown Source )
at org . jboss . system . ServiceController . start ( ServiceController . java : 417 )
at sun . reflect . GeneratedMethodAccessor9 . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . jboss . mx . interceptor . ReflectedDispatcher . invoke ( ReflectedDispatcher . java : 155 )
at org . jboss . mx . server . Invocation . dispatch ( Invocation . java : 94 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 86 )
at org . jboss . mx . server . AbstractMBeanInvoker . invoke ( AbstractMBeanInvoker . java : 264 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . jboss . mx . util . MBeanProxyExt . invoke ( MBeanProxyExt . java : 210 )
at $ Proxy38 . start ( Unknown Source )
at org . jboss . web . AbstractWebContainer . start ( AbstractWebContainer . java : 466 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . jboss . mx . interceptor . ReflectedDispatcher . invoke ( ReflectedDispatcher . java : 155 )
at org . jboss . mx . server . Invocation . dispatch ( Invocation . java : 94 )
at org . jboss . mx . interceptor . AbstractInterceptor . invoke ( AbstractInterceptor . java : 133 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 88 )
at org . jboss . mx . interceptor . ModelMBeanOperationInterceptor . invoke ( ModelMBeanOperationInterceptor . java : 142 )
at org . jboss . mx . interceptor . DynamicInterceptor . invoke ( DynamicInterceptor . java : 97 )
at org . jboss . system . InterceptorServiceMBeanSupport . invokeNext ( InterceptorServiceMBeanSupport . java : 238 )
at org . jboss . ws . integration . jboss . DeployerInterceptor . start ( DeployerInterceptor . java : 92 )
at org . jboss . deployment . SubDeployerInterceptorSupport $ XMBeanInterceptor . start ( SubDeployerInterceptorSupport . java : 188 )
at org . jboss . deployment . SubDeployerInterceptor . invoke ( SubDeployerInterceptor . java : 95 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 88 )
at org . jboss . mx . server . AbstractMBeanInvoker . invoke ( AbstractMBeanInvoker . java : 264 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . jboss . mx . util . MBeanProxyExt . invoke ( MBeanProxyExt . java : 210 )
at $ Proxy39 . start ( Unknown Source )
at org . jboss . deployment . MainDeployer . start ( MainDeployer . java : 1025 )
at org . jboss . deployment . MainDeployer . deploy ( MainDeployer . java : 819 )
at org . jboss . deployment . MainDeployer . deploy ( MainDeployer . java : 782 )
at sun . reflect . GeneratedMethodAccessor55 . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . jboss . mx . interceptor . ReflectedDispatcher . invoke ( ReflectedDispatcher . java : 155 )
at org . jboss . mx . server . Invocation . dispatch ( Invocation . java : 94 )
at org . jboss . mx . interceptor . AbstractInterceptor . invoke ( AbstractInterceptor . java : 133 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 88 )
at org . jboss . mx . interceptor . ModelMBeanOperationInterceptor . invoke ( ModelMBeanOperationInterceptor . java : 142 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 88 )
at org . jboss . mx . server . AbstractMBeanInvoker . invoke ( AbstractMBeanInvoker . java : 264 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . jboss . mx . util . MBeanProxyExt . invoke ( MBeanProxyExt . java : 210 )
at $ Proxy8 . deploy ( Unknown Source )
at org . jboss . deployment . scanner . URLDeploymentScanner . deploy ( URLDeploymentScanner . java : 421 )
at org . jboss . deployment . scanner . URLDeploymentScanner . scan ( URLDeploymentScanner . java : 634 )
at org . jboss . deployment . scanner . AbstractDeploymentScanner $ ScannerThread . doScan ( AbstractDeploymentScanner . java : 263 )
at org . jboss . deployment . scanner . AbstractDeploymentScanner . startService ( AbstractDeploymentScanner . java : 336 )
at org . jboss . system . ServiceMBeanSupport . jbossInternalStart ( ServiceMBeanSupport . java : 289 )
at org . jboss . system . ServiceMBeanSupport . jbossInternalLifecycle ( ServiceMBeanSupport . java : 245 )
at sun . reflect . GeneratedMethodAccessor2 . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . jboss . mx . interceptor . ReflectedDispatcher . invoke ( ReflectedDispatcher . java : 155 )
at org . jboss . mx . server . Invocation . dispatch ( Invocation . java : 94 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 86 )
at org . jboss . mx . server . AbstractMBeanInvoker . invoke ( AbstractMBeanInvoker . java : 264 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . jboss . system . ServiceController $ ServiceProxy . invoke ( ServiceController . java : 978 )
at $ Proxy0 . start ( Unknown Source )
at org . jboss . system . ServiceController . start ( ServiceController . java : 417 )
at sun . reflect . GeneratedMethodAccessor9 . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . jboss . mx . interceptor . ReflectedDispatcher . invoke ( ReflectedDispatcher . java : 155 )
at org . jboss . mx . server . Invocation . dispatch ( Invocation . java : 94 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 86 )
at org . jboss . mx . server . AbstractMBeanInvoker . invoke ( AbstractMBeanInvoker . java : 264 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . jboss . mx . util . MBeanProxyExt . invoke ( MBeanProxyExt . java : 210 )
at $ Proxy4 . start ( Unknown Source )
at org . jboss . deployment . SARDeployer . start ( SARDeployer . java : 302 )
at org . jboss . deployment . MainDeployer . start ( MainDeployer . java : 1025 )
at org . jboss . deployment . MainDeployer . deploy ( MainDeployer . java : 819 )
at org . jboss . deployment . MainDeployer . deploy ( MainDeployer . java : 782 )
at org . jboss . deployment . MainDeployer . deploy ( MainDeployer . java : 766 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . jboss . mx . interceptor . ReflectedDispatcher . invoke ( ReflectedDispatcher . java : 155 )
at org . jboss . mx . server . Invocation . dispatch ( Invocation . java : 94 )
at org . jboss . mx . interceptor . AbstractInterceptor . invoke ( AbstractInterceptor . java : 133 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 88 )
at org . jboss . mx . interceptor . ModelMBeanOperationInterceptor . invoke ( ModelMBeanOperationInterceptor . java : 142 )
at org . jboss . mx . server . Invocation . invoke ( Invocation . java : 88 )
at org . jboss . mx . server . AbstractMBeanInvoker . invoke ( AbstractMBeanInvoker . java : 264 )
at org . jboss . mx . server . MBeanServerImpl . invoke ( MBeanServerImpl . java : 659 )
at org . jboss . mx . util . MBeanProxyExt . invoke ( MBeanProxyExt . java : 210 )
at $ Proxy5 . deploy ( Unknown Source )
at org . jboss . system . server . ServerImpl . doStart ( ServerImpl . java : 482 )
at org . jboss . system . server . ServerImpl . start ( ServerImpl . java : 362 )
at org . jboss . Main . boot ( Main . java : 200 )
at org . jboss . Main $ 1. run ( Main . java : 490 )
at java . lang . Thread . run ( Unknown Source )
RDSILVA 19 de nov. de 2008
Consegui corrigir este erro colocando no WEF-INF\lib\ o jar
struts-core-1.3.5.jar
So que ao subir a aplicação ocorre o seguinte erro, ja coloquei todos os jars do STRUTS no WEF-INF\lib
e mesmo assim não funcionou
ERROR [ActionServlet] Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.
java.lang.NoClassDefFoundError: org/apache/commons/chain/config/ConfigParser
RDSILVA 19 de nov. de 2008
Ai consegui resolver aqui dando umas pesquisadas…
seguinte coloquei no JBOSS\server<porta que estaou utilizando>\lib
o commons-chain-1.1.jar
com isso não deu mais erro…