OC4J – java.lang.NoSuchMethodError: exclude

24 05 2013

Problema

cliente webservice CXF não funciona no OC4J lançando a seguinte exeção

2013-05-24 10:21:16,901 ERROR web.context.ContextLoader -> Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘chequeServiceWs’ defined in class path resource [truncagemContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create()] threw exception; nested exception is java.lang.NoSuchMethodError: javax.jws.WebMethod.exclude()Z
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:423)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:901)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:815)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

Causa

Provavelemente o OC4J está sobrescrevendo uma de suas libs causando uma imcopatibilidade com o JaxWS.

Solução

Forçar o OC4J carregar as libs do projeto e não as sharedlibs

1) Criar o arquivo WEB-INF/orion-web.xml (que ira dizer para priorizar o load das libs do seu projeto)

<?xml version=”1.0″?>
<orion-web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
xsi:noNamespaceSchemaLocation=”http://xmlns.oracle.com/oracleas/schema/orion-web-10_0.xsd&#8221;
development=”true” schema-major-version=”10″ schema-minor-version=”0″>
<web-app-class-loader search-local-classes-first=”true”
include-war-manifest-class-path=”true” />
<web-app>
</web-app>
</orion-web-app>

2) Forçar a remoção do load das sharedlibs no arquivo orion-application.xml que ira no EAR

<?xml version=”1.0″ encoding=”UTF-8″?>
<orion-application xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=”http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd”&gt;
<imported-shared-libraries>
<remove-inherited name=”oracle.jwsdl”/>
<remove-inherited name=”oracle.xml”/>
<remove-inherited name=”apache.commons.logging”/>
<remove-inherited name=”oracle.toplink”/>
<remove-inherited name=”org.jgroups”/>
<remove-inherited name=”javax.*”/>
</imported-shared-libraries>
</orion-application>

FONTE1

FONTE 2

Anúncios

Ações

Information

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s




%d blogueiros gostam disto: