Weblogic12c (12.1.2) 兼容性问题汇总

上篇文章介绍了

Oracle WebLogic Server 12.1.2 新特性

最近在部署应用的时候发现了一些新问题总结如下:

1〉JDK 兼容性问题。

我们可以通过http://www.oracle.com/technetwork/java/javase/7u-relnotes-515228.html 查看各个JDK版本的新特性。

 a) 由于JDK1.7.0_21中对API的更改Runtime.getRuntime().exec的更改,使得参数如果有空格将不支持的问题。

Runtime.getRuntime().exec(cmd, envTokens, file1);

IllegalArgumentException :Executable name has embedded quote, split the arguments 

比如:

Runtime.getRuntime().exec("C:\\My Programs\\foo.exe bar") is an attempt to launch the program"C:\\My" with the arguments"Programs\\foo.exe" and"bar". This command is likely to fail with an exception to indicate"C:\My" cannot be found.

The example Runtime.getRuntime().exec("\"C:\\My Programs\\foo.exe\" bar") is an attempt to launch the program"\"C:\\My". This command will fail with an exception to indicate the program has an embedded quote.

Applications that need to launch programs with spaces in the program name should consider using the variants ofRuntime.exec that allow the command and arguments to be specified in an array.

Alternatively, the preferred way to create operating systems processes since JDK 5.0 is usingjava.lang.ProcessBuilder. TheProcessBuilder class has a much more complete API for setting the environment, working directory and redirecting streams for the process.

如:

ProcessBuilder pb = new ProcessBuilder ( "command" , "argument1" , "argument2" );

Map<String,String> env= pb.environment();env.put("var1","value1");

Process p= pb.start();

b)Changes to RMI

From this release, the RMI property java.rmi.server.useCodebaseOnly is set totrue by default. In previous releases the default value wasfalse.

This change of default value may cause RMI-based applications to break unexpectedly. The typical symptom is a stack trace that contains ajava.rmi.UnmarshalException containing a nestedjava.lang.ClassNotFoundException.

c) Changes to Application Signing

Starting from JDK 7u21, it is recommended that all applications be signed. In addition, it is also possible to restrict signed applications to the security sandbox.

Therefore, the previous use of the term "unsigned" to mean an application that ran in the security sandbox and"signed" to mean an application that ran with extended permissions, is no longer meaningful.

Unsigned or self-signed applications may not be supported in future JDK update releases.

2〉Spring 中遇到的问题

1.版本兼容性的问题

Weblogic 12.1.2将只支持Spring,升级weblogic 可能需要同步升级应用框架。附Weblogic 支持Spring的版本:

Spring Version
WLS 8.1 SP5 Spring Framework 1.2.7
WLS 9.0 Spring Framework 1.2.5
WLS 9.1 Spring Framework 1.2.6
WLS 9.2 Spring Framework 1.2.8 and 2.0.x
WLS 9.2 MP1 Spring Framework 1.2.8 and 2.0.x
WLS 9.2 MP2 Spring Framework 1.2.8 and 2.0.x
WLS 9.2 MP3 Spring Framework 1.2.8, 2.0.x, and 2.5.1
WLS 9.2 MP4 Spring Framework 1.2.8, 2.0.x, and 2.5.6
WLS 10.0 Spring Framework 1.2.8 and 2.0.x
WLS 10.3 Spring Framework 2.5.3 and up
WLS 10.3.1 Spring Framework 2.5.3 and up
WLS 10.3.2 Spring Framework 2.5.3 and up
WLS 10.3.3 Spring Framework 2.5.3 and up
WLS 10.3.4 Spring Framework 3.0
WLS 10.3.5 Spring Framework 3.0
WLS 10.3.6 Spring Framework 3.0
WLS 12.1.1 Spring Framework 3.0
WLS 12.1.2 Spring Framework 3.0.2 & 3.1.0

2.项目中出现的nullbean问题

这个问题主要是Spring的框架中的监听器没有加载,也就是在web.xml加载的时候就失败了。Spring为web.xml中加载监听提供了两种方式,但是达到的效果是一样的。

首先介绍Spring的监听器作用。ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息。因为它实现了ServletContextListener这个接口,在web.xml配置这个监听器,启动容器时,就会默认执行它实现的方法。在ContextLoaderListener中关联了ContextLoader这个类,所以整个加载配置过程由ContextLoader来完成。ContextLoader创建的是 XmlWebApplicationContext这样一个类,它实现的接口是WebApplicationContext→ConfigurableWebApplicationContext→Application- Context→BeanFactory,这样一来Spring中的所有bean都由这个类来创建。

如果在web.xml中不写任何参数配置信息,默认的路径是/WEB-INF/application- Context.xml,在WEB-INF目录下创建的xml文件的名称必须是applicationContext.xml。如果是要自定义文件名,可以在web.xml里加入contextConfigLocation这个context参数。

示例9-2

 
  
  1. <context-param> 
  2.   <param-name>contextConfigLocationparam-name> 
  3.   <param-value> 
  4.     /WEB-INF/classes/applicationContext-*.xml  
  5.   param-value> 
  6. context-param> 
在 里指定相应的xml文件名,如果有多个xml文件,可以写在一起并以", "分隔。上面的applicationContext-*.xml采用通配符,比如这目录下有applicationContext-ibatis-base.xml,applicationContext-action.xml,applicationContext-ibatisdao.xml等文件,都会一同被载入。

3〉Servlet兼容性问题

Weblogic12c 12.1.2 支持Java EE6, 也就说全面支持Servlet3, Servlet3 的新特性,详见文档 JavaEE 6Servlet 3.0 中的新特性。


你可能感兴趣的:(JAVA,Weblogic,J2EE,Web)