TomCat + WebServices + JAX = Erro

Estou tendo este erro ao usar WebServices usando JAX, localmente usando o NetBeans 6.0 e TomCat e esta funcionando, mas quando envio para o servidor retorna este erro:

SEVERE: Context [/WebApplication1] startup failed due to previous errors
Jan 25, 2008 5:29:02 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jre1.6.0_02/lib/i386/server:/usr/java/jre1.6.0_02/lib/i386:/usr/java/jre1.6.0_02/…/lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
Jan 25, 2008 5:29:02 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8234
Jan 25, 2008 5:29:02 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 534 ms
Jan 25, 2008 5:29:02 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 25, 2008 5:29:02 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
Jan 25, 2008 5:29:03 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3770)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Jan 25, 2008 5:29:03 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Jan 25, 2008 5:29:03 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jan 25, 2008 5:29:03 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/WebApplication1] startup failed due to previous errors
Jan 25, 2008 5:29:03 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jan 25, 2008 5:29:03 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jan 25, 2008 5:29:03 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded(‘org.apache.catalina.Registry’, ‘org.apache.tomcat.util.modeler.Registry@da18ac’)
Jan 25, 2008 5:29:03 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded(‘org.apache.catalina.MBeanServer’, ‘com.sun.jmx.mbeanserver.JmxMBeanServer@8a0544’)
Jan 25, 2008 5:29:03 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8234
Jan 25, 2008 5:29:03 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:9345
Jan 25, 2008 5:29:03 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/25 config=null
Jan 25, 2008 5:29:03 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 970 ms

Alguem tem umaideia doque poderia ser?

Parceiro , creio que é um erro de lib.
Tem que dar uma analisada melhor…
Vc está executando com jre1.6.
Está compilando com qual ?

abraço

Estou usando o JRE 1.6.2 servidor e localmente estou usando o JRE 1.6.4.
O JDK 6 update 4.

As libs que estou usando:

activation.jar
FastInfoset.jar
http.jar
jaxb-api.jar
jaxb-impl.jar
jaxb-xjc.jar
jaxws-api.jar
jaxws-rt.jar
jaxws-tools.jar
jsr173_api.jar
jsr181-api.jar
jsr250-api.jar
saaj-api.jar
saaj-impl.jar
sjsxp.jar
stax-ex.jar
streambuffer.jar

No TomCat que vem com o netbeans 6 esta funcionando, ja no servidor que usa o mesmo tomcat não.
Ja coloquei as libs na pasta lib publica e não deu certo, ja coloquei junto com o projeto e tbm não deu.

Aqui está o código, para testar o erro fiz o mais simples possivel:

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService()
public class WSTeste {

    @WebMethod(operationName = "Funcao1")
    public String[] Funcao1() {
        
        String[] local = new String[2];
        
        local[0] = "1";
        local[1] = "Teste 0.2";
        
        return local;
    }

}

O problema todo está na API JAX-WS 2.1 que deve ser colocada em uma pasta endorsed dentro das libs, estou usando o servidor da KingHost, lah tem o TomCat 6.0.10, instalei localmente a mesma versão no linux e no Windows e não tive nenhum problema, será que o problema está com o servidor da KingHost?

Jan 30, 2008 3:25:03 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jre1.6.0_02/lib/i386/server:/usr/java/jre1.6.0_02/lib/i386:/usr/java/jre1.6.0_02/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
Jan 30, 2008 3:25:03 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8234
Jan 30, 2008 3:25:03 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 934 ms
Jan 30, 2008 3:25:03 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 30, 2008 3:25:03 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
Jan 30, 2008 3:25:04 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
INFO: WSSERVLET12: JAX-WS context listener initializing
Jan 30, 2008 3:25:04 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/home/konageski/webapps/AplicacaoWeb1/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/home/konageski/webapps/AplicacaoWeb1/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:136)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:406)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:270)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:103)
	at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:89)
	at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:126)
	at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:125)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:124)
	at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:63)
	at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:224)
	at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:308)
	at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:174)
	at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:420)
	at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:237)
	at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:133)
	at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:97)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:448)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
	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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Jan 30, 2008 3:25:04 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/home/konageski/webapps/AplicacaoWeb1/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
	at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:107)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:448)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
	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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/home/konageski/webapps/AplicacaoWeb1/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:136)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:406)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:270)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:103)
	at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:89)
	at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:126)
	at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:125)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:124)
	at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:63)
	at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:224)
	at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:308)
	at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:174)
	at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:420)
	at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:237)
	at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:133)
	at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:97)
	... 24 more
Jan 30, 2008 3:25:04 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jan 30, 2008 3:25:04 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/AplicacaoWeb1] startup failed due to previous errors
Jan 30, 2008 3:25:04 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextDestroyed
INFO: WSSERVLET13: JAX-WS context listener destroyed
Jan 30, 2008 3:25:05 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jan 30, 2008 3:25:05 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jan 30, 2008 3:25:05 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.catalina.Registry', 'org.apache.tomcat.util.modeler.Registry@dc9766')
Jan 30, 2008 3:25:05 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.catalina.MBeanServer', 'com.sun.jmx.mbeanserver.JmxMBeanServer@57e787')
Jan 30, 2008 3:25:05 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8234
Jan 30, 2008 3:25:05 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:9345
Jan 30, 2008 3:25:05 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/39  config=null
Jan 30, 2008 3:25:05 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1962 ms

Flw!

Resolvi o problema da seuinte forma:

  • Instalei o netbeans 5.5 e criei um projeto web e criei um webservice;
  • Troquei as libs do projeto do Netbeans 6.0 pelas do projeto do NetBeans 5.5;
  • As libs antigas são compativeis com o TomCat e o JRE;

A melhor solução seria a atualização do servidor mas como isso não é possivel, ja da para quebrar um galho enquanto isso,

T++

Tive o mesmo problema e resolvi de uma outra maneira.
Depois de pesquisar um pouco, segui as instruções desse blog http://weblogs.java.net/blog/ramapulavarthi/archive/2007/01/problems_using.html e ai deu certo … criei uma pasta /lib/endorsed e depois copiei o jaxb-api.jar (versão 2.1) que o NetBeans 6 utiliza para lá.

Localmente eu fiz isso e resolveu, mas o servidor de produção era pago, dai não tinha como criar essas pasta e atualizar as libs…

Cara estou com o mesmo problema, so que não estou conseguindo solucionar, como vc fez para buscar os jars da versão nova do JAXB 2.1? E vc cria a pasta nas libs do Tomcat ou da JDK ?