Chinaunix首页 | 论坛 | 博客
  • 博客访问: 41138
  • 博文数量: 18
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 165
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-19 15:23
个人简介

转身撞上猪

文章分类

全部博文(18)

文章存档

2017年(18)

我的朋友

分类: 系统运维

2017-06-18 13:08:42


weblogic 1036 创建JDBC store失败,报错如下
登录数据库检查,table "test0616_WLStore"已经成功创建

点击(此处)折叠或打开

  1. <2017-6-16 上午11时30分34秒 CST> JDBCStore-0" failed to open table "test0616_WLStore".
  2. java.lang.Exception: java.lang.NoSuchMethodError: weblogic/jdbc/wrapper/PreparedStatement.init(Ljava/sql/Statement;Lweblogic/jdbc/wrapper/Connection;Ljava/lang/String;II)V
  3. at weblogic.store.io.jdbc.JDBCStoreIO.open(JDBCStoreIO.java:545)
  4. at weblogic.store.internal.PersistentStoreImpl.recoverStoreConnections(PersistentStoreImpl.java:435)
  5. at weblogic.store.internal.PersistentStoreImpl.open(PersistentStoreImpl.java:423)
  6. at weblogic.store.admin.AdminHandler.activate(AdminHandler.java:126)
  7. at weblogic.store.admin.JDBCAdminHandler.activate(JDBCAdminHandler.java:71)
  8. Truncated. see log file for complete stacktrace
  9. Caused By: java.lang.NoSuchMethodError: weblogic/jdbc/wrapper/PreparedStatement.init(Ljava/sql/Statement;Lweblogic/jdbc/wrapper/Connection;Ljava/lang/String;II)V
  10. at weblogic.jdbc.wrapper.PreparedStatement.makePreparedStatement(PreparedStatement.java:41)
  11. at weblogic.jdbc.wrapper.Connection.prepareStatement(Connection.java:559)
  12. at weblogic.store.io.jdbc.ReservedConnection.prepareStatement(ReservedConnection.java:527)
  13. at weblogic.store.io.jdbc.ReservedConnection.getReadOneRowStatement(ReservedConnection.java:594)
  14. at weblogic.store.io.jdbc.JDBCStoreIO.internalRead(JDBCStoreIO.java:851)
  15. Truncated. see log file for complete stacktrace
  16. >



找出进程552951 加载的所有的JAR文件,并zipinfo看下哪个文件中包含PreparedStatement.class
结果找到如下第四行有个非weblogic自带的,第三个的JAR包中包含此方法,类冲突。

点击(此处)折叠或打开

  1. [root@linuxServr ~]# for file in `lsof -p 552951 |grep "war$\|jar$"| awk '{print $NF}'`;do ret=`zipinfo "$file" |grep -l PreparedStatement`;if [ ! -z "$ret" ];then echo $file;echo $ret;fi;done
  2. /bea1036/jrockit-jdk1.6.0_37-R28.2.5-4.1.0/jre/lib/rt.jar
  3. (standard input)
  4. /xxx_app/lib/PSTrace.jar
  5. (standard input)
  6. /bea1036/wlserver_10.3/server/lib/weblogic.jar
  7. (standard input)
  8. /bea1036/modules/com.bea.core.descriptor.wl_1.4.0.0.jar
  9. (standard input)
  10. /bea1036/modules/com.bea.core.descriptor.wl.binding_1.4.0.0.jar
  11. (standard input)
  12. /bea1036/modules/com.bea.core.datasource6_1.10.0.0.jar
  13. (standard input)
  14. /bea1036/modules/org.apache.openjpa_1.3.0.0_1-1-1-SNAPSHOT.jar
  15. (standard input)
  16. /bea1036/modules/com.bea.core.kodo_1.5.0.0_4-2-1.jar
  17. (standard input)
  18. /bea1036/modules/com.bea.core.compat.wl.90_1.4.0.0.jar
  19. (standard input)
  20. /bea1036/wlserver_10.3/server/lib/ojdbc6.jar
  21. (standard input)
  22. /bea1036/wlserver_10.3/server/lib/ucp.jar
  23. (standard input)
  24. /bea1036/wlserver_10.3/server/lib/mysql-connector-java-commercial-5.1.17-bin.jar
  25. (standard input)
  26. 1/bea1036/wlserver_10.3/server/lib/wlsqlserver.jar
  27. (standard input)
  28. /bea1036/wlserver_10.3/server/lib/wldb2.jar
  29. (standard input)
  30. /bea1036/wlserver_10.3/server/lib/wlsybase.jar
  31. (standard input)
  32. /bea1036/wlserver_10.3/server/lib/wlinformix.jar
  33. (standard input)



另外在启动JVM时加上-verbose:class也可以看到哪些类被装载,从而也能发现问题。

如下摘自网络,是对verbose的解释。
When running a Java program, verbose options can be used to tell the JVM which kind of information to see. JVM suports three verbose options out of the box. As the name suggests, verbose is for displaying the work done by JVM. Mostly the information provided by these parameters is used for debugging purposes. Since it is used for debugging, its use is in development. One would never have to use verbose parameters in production enviornment. The three verbose options supported by JVM are: 

-verbose:class 
-verbose:gc 
-verbose:jni 

-verbose:class is used to display the information about classes being loaded by JVM. This is useful when using class loaders for loading classes dynamically or for analysing what all classes are getting loaded in a particular scenario. A very simple program which does nothing also loads so many classes as shown below: 
package com.example;

public class Test {

public static void main(String args[]) {

}
}



Output: 
[Opened C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.Object from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.io.Serializable from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.Comparable from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.CharSequence from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
..............................................................................
..............................................................................
..............................................................................
[Loaded java.lang.Void from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.Shutdown from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.Shutdown$Lock from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]

I am showing only selected output from Eclipse console. Classes from java.lang, java.io and java.util packages are loaded into memory by default. 
As stated earlier, one would use the verbose:class option when checking for what all classes are getting loaded which is usually a requirement when working with class loaders in Java. 

-verbose:gc is used to check garbage collection event information. When used as command line argument for running Java program, the details of garbage collection are printed on the console. The following program demonstrates the usage: 

package com.example;

public class Test {

public static void main(String args[]) throws InterruptedException {
Test t1 = new Test();
t1=null;
System.gc();
}
}

Output: 
[GC 318K->304K(61056K), 0.0081277 secs]
[Full GC 304K->225K(61056K), 0.0054004 secs]

-verbose:jni is used for printing the native methods as and when they are registered in the application. These methods include JDK as well as custom native methods. Note that jni stands for Java Native Interface. The sourcecode and output demonstrating the usage of this option is shown below: 
package com.example;

public class Test {

public static void main(String args[]) throws InterruptedException {
}
}

Output: 
[Dynamic-linking native method java.lang.Object.registerNatives ... JNI]
[Registering JNI native method java.lang.Object.hashCode]
[Registering JNI native method java.lang.Object.wait]
[Registering JNI native method java.lang.Object.notify]
[Registering JNI native method java.lang.Object.notifyAll]
[Registering JNI native method java.lang.Object.clone]
[Dynamic-linking native method java.lang.System.registerNatives ... JNI]
...............................................................
...............................................................
...............................................................
[Registering JNI native method sun.misc.Perf.highResCounter]
[Registering JNI native method sun.misc.Perf.highResFrequency]
[Dynamic-linking native method java.lang.ClassLoader.defineClass1 ... JNI]
[Dynamic-linking native method java.lang.Runtime.gc ... JNI]
[Dynamic-linking native method java.lang.ref.Finalizer.invokeFinalizeMethod ... JNI]


阅读(1324) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~