Exception : java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader

Saya lagi nyoba tutorial http://netbeans.org/kb/docs/websvc/jax-ws.html, lalu create client menggunakan bahan dari tutorial http://netbeans.org/kb/docs/websvc/client.html. Tapi setelah client saya run melalui netbeans muncul error berikut ini:

 Exception in thread "main" java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/F:/glassfish/lib/webservices-rt.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.(ModelBuilder.java:173)         at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)         at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:286)         at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)         at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)         at java.lang.reflect.Method.invoke(Method.java:597)         at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)         at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)         at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)         at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)         at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:220)         at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:218)         at java.security.AccessController.doPrivileged(Native Method)         at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:217)         at com.sun.xml.ws.spi.ProviderImpl.(ProviderImpl.java:88)         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)         at java.lang.Class.newInstance0(Class.java:355)         at java.lang.Class.newInstance(Class.java:308)         at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)         at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)         at javax.xml.ws.spi.Provider.provider(Provider.java:76)         at javax.xml.ws.Service.(Service.java:57)         at org.me.calculator.CalculatorWSService.(CalculatorWSService.java:46)         at NewClass.add(NewClass.java:25)         at NewClass.main(NewClass.java:16) Java Result: 1 

Kebetulan netbeans yang saya gunakan adalah versi 6.9.1 lalu JRE yang digunakan adalah versi 1.6.0_20. Solusi untuk masalah ini adalah sangat simple yaitu copy file jaxb-api.jar ke folder C:\Program Files\Java\jdk1.6.0\jre\lib\endorsed. Folder endorsed nya secara manual saya buat.

File jaxb-api.jar nya saya dapatkan dari distribusi framework spring. Adanya di folder F:\home\ade\all\spring-framework-2.5.1\lib\jaxws.

Semoga bermanfaat!

Komentar

Postingan populer dari blog ini

Mercon Buaya