这几天我在调试weblogic12c的时候程序总挂起,WLST脚本使用
startServer command,服务启动不起来导致。
原因是weblogic12c 因为引入了web service,需要在jdk中加入 JAX-WS实现。
具体如下:
# WLST-WLS-1326447719560: 1) locate the bundled Java EE 6 endorsed directory in $WL_HOME/endorsed.
# WLST-WLS-1326447719560: 2) copy those JAR files to $JAVA_HOME/jre/lib/endorsed OR add the endorsed directory to the value specified by system property java.endorsed.dirs.
所以需要自己从网站下载 JAX-WS实现,参见 :
http://grepcode.com/snapshot/repo1.maven.org/maven2/javax.xml.ws/jaxws-api/2.2.6
同时 还需要要下载 JAXB2.2
http://www.java2s.com/Code/Jar/j/Downloadjaxbapi22jar.htm
同时并注意一下跟JDK1.6兼容的问题:
How to use JAX-WS 2.2.6 with JDK 1.6
JDK 1.6 comes with spec + implementation of JAX-WS 2.1. If we add all libs of JAX-WS 2.2.6 in our project classpath, the JDK still prefers it own JAXWS API i.e. version 2.1. It will cause jar conflicts or MethodNotFoundError etc.
To use JAX-WS 2.2.6 or later with JDK 1.6, we must force JDK to load spec+impl ver. 2.2.6. It is done by endorsing new library. There are two ways to endorse JDK to use our provided libraries instead of its own.
- From JAX-WS 2.2.6 downloaded bundle. Put only jaxws-api.jar and jaxb-api.jar to JDK1.6/jre/lib/endorsed directory.
- Set "java.endorsed.dirs" environment variable, it should point to directory than must contain jars to be endorsed. e.g. java.endorsed.dirs=d:\endorsedlibs, where endorsedlibs directory contains two jar files mentioned in step 1.
We must not put all JAX-WS 2.2.6 jar files into endorsed directory. Only specifying two API jars (the specification) is enough. At runtime, the right implementation would be loaded from your project class path. Also note that, we don't need to put jaxws-api.jar and jaxb-api.jar into your project classpath. As it will cause duplication of jar.
Another important point is, the JAX-WS 2.2.6 used JAXB 2.2. If an older JAXB is found in your classpath, it will cause issues (JDK 6 comes with JAXB 2.0). Make sure there is no copy of jaxb-api.jar older than version 2.2. In my case, our webservice module was dependent on 'core' module, which was using jaxb-api.jar version 2.1, it wasted much time to identify the issues.
并附上 java endorsed 机制介绍文章
Introduction
From time to time it is necessary to update the Javaplatform in order to incorporate newer versions of standards thatare created outside of the JavaCommunity Process ( Endorsed Standards), or in order toupdate the version of a technology included in the platform tocorrespond to a later standalone version of that technology( Standalone Technologies).
The Endorsed Standards Override Mechanism provides a meanswhereby later versions of classes and interfaces that implementEndorsed Standards or Standalone Technologies may be incorporatedinto the Java Platform.
Deploying updated packages
Packages to be updated through this mechanism should beplaced in JAR files. The system property java.endorsed.dirs specifies one or more directories thatthe Java runtime environment will search for such JAR files. Ifmore than one directory path is specified by java.endorsed.dirs, they must be separated by File.pathSeparatorChar. If no value is set for java.endorsed.dirs, then Sun Microsystem's implementationof the Java platform looks for JAR files in a default standardlocation:<java-home>\lib\endorsed [Microsoft Windows] <java-home>/lib/endorsed [Solaris or Linux]Here <java-home> refers to the directory where theruntime software is installed (which is the top-level directory ofthe Java SE Runtime Environment or the jre directory inthe JDK).
The Java SE runtime environment will use classes in such JAR filesto override the corresponding classes provided in the Java platformas it was shipped.
Endorsed Standards APIs
The Endorsed Standards for Java SE constitute allclasses and interfaces that are defined in the packages listed inthis section. Classes and interfaces defined in sub-packages oflisted packages are not Endorsed Standards unless thosesub-packages are themselves listed. The Endorsed Standards OverrideMechanism may be used to override the Java SE platform packages inthis list, and these packages may be overridden only by versions ofthe Endorsed Standard that are newer than that provided by the Javaplatform as released by Sun. With the exception of packages listedhere and the technologies listed in the StandaloneTechnologies section below, no other packages from the Java SEplatform API specification may be overridden.javax.rmi.CORBA org.omg.CORBA org.omg.CORBA.DynAnyPackage org.omg.CORBA.ORBPackage org.omg.CORBA.portable org.omg.CORBA.TypeCodePackage org.omg.CORBA_2_3 org.omg.CORBA_2_3.portable org.omg.CosNaming org.omg.CosNaming.NamingContextExtPackage org.omg.CosNaming.NamingContextPackage org.omg.Dynamic org.omg.DynamicAny org.omg.DynamicAny.DynAnyFactoryPackage org.omg.DynamicAny.DynAnyPackage org.omg.IOP org.omg.IOP.CodecFactoryPackage org.omg.IOP.CodecPackage org.omg.Messaging org.omg.PortableInterceptor org.omg.PortableInterceptor.ORBInitInfoPackage org.omg.PortableServer org.omg.PortableServer.CurrentPackage org.omg.PortableServer.POAManagerPackage org.omg.PortableServer.POAPackage org.omg.PortableServer.portable org.omg.PortableServer.ServantLocatorPackage org.omg.SendingContext org.omg.stub.java.rmi org.w3c.dom org.xml.sax org.xml.sax.ext org.xml.sax.helpersIn addition to the packages listed above, which are part of theJava SE specification, users of Sun's Java SE ReferenceImplementation are allowed to use the Endorsed Standards OverrideMechanism to override implementation-specific classes associatedwith these packages, such as the org.w3c.dom sub-packagesdelivered in Sun's Reference Implementation.
Standalone Technologies
The Standalone Technologies for Java SE constitute allclasses and interfaces that are defined and implemented in thetechnologies listed in this section. The Endorsed StandardsOverride Mechanism may be used to override the Java technologies inthis list, and these technologies may be overridden only byproviding a complete and newer implementation of the StandaloneTechnology than was provided in the original implementation of theJava Platform. With the exception of the technologies in this listand the packages listed in the Endorsed Standards APIssection above, no other packages from the Java SE platform APIspecification may be overridden.
JavaAPI for XML Processing (JAXP), version 1.4
Java Architecturefor XML Binding (JAXB), version 2.0
Java API for XML-Based WebServices (JAX-WS), version 2.0
Java CompilerAPI, version 1.0
Pluggable AnnotationProcessing API, version 1.0
Common Annotationsfor the Java Platform, version 1.0
Scripting for theJava Platform, version 1.0
SOAP with Attachments API forJava (SAAJ), version 1.3