Thread: SEVERE: Error while registering Oracle JDBC Diagnosability MBean


Permlink Replies: 32 - Pages: 3 [ 1 2 3 | Next ] - Last Post: Sep 15, 2009 11:27 AM Last Post By: user5263223 Threads: [ Previous | Next ]
vampboy

Posts: 8
Registered: 05/28/00
SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Aug 30, 2007 9:33 AM
Click to report abuse...   Click to reply to this thread Reply
I get the following when using the 11g JDBC driver (ojdbc6.jar) when the OracleDriver class is accessed multiple times within the same JVM

dbunit Aug 30, 2007 9:12:44 AM oracle.jdbc.driver.OracleDriver registerMBeans
dbunit SEVERE: Error while registering Oracle JDBC Diagnosability MBean.
dbunit javax.management.InstanceAlreadyExistsException: com.oracle.jdbc:type=diagnosability,name=java.net.URLClassLoader@14318bb
dbunit at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453)
dbunit at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1484)
dbunit at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:963)
dbunit at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917)
dbunit at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
dbunit at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
dbunit at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:305)
dbunit at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:213)
dbunit at java.security.AccessController.doPrivileged(Native Method)
dbunit at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:209)
dbunit at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
dbunit at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
dbunit at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
dbunit at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
dbunit at java.lang.Class.newInstance0(Class.java:355)
dbunit at java.lang.Class.newInstance(Class.java:308)
dbunit at org.dbunit.ant.DbUnitTask.createConnection(DbUnitTask.java:340)
dbunit at org.dbunit.ant.DbUnitTask.execute(DbUnitTask.java:266)
dbunit at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
dbunit at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
dbunit at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
dbunit at java.lang.reflect.Method.invoke(Method.java:597)
dbunit at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
dbunit at org.apache.tools.ant.Task.perform(Task.java:348)
dbunit at org.apache.tools.ant.Target.execute(Target.java:357)
dbunit at org.apache.tools.ant.Target.performTasks(Target.java:385)
dbunit at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
dbunit at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
dbunit at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
dbunit at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
dbunit at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
dbunit at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
dbunit at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
dbunit at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
dbunit at java.lang.reflect.Method.invoke(Method.java:597)
dbunit at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
dbunit at org.apache.tools.ant.Task.perform(Task.java:348)
dbunit at org.apache.tools.ant.Target.execute(Target.java:357)
dbunit at org.apache.tools.ant.Target.performTasks(Target.java:385)
dbunit at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
dbunit at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
dbunit at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
dbunit at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
dbunit at org.apache.tools.ant.Main.runBuild(Main.java:698)
dbunit at org.apache.tools.ant.Main.startAnt(Main.java:199)
dbunit at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
dbunit at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

In our case we're calling multiple DB operations within the same build file and then after the 1st call we encounter that error for every operation.

It doesn't fail anything but it would seem that there is a static block in the OracleDriver class that tries to register the MBean every time it is touched whether or not it was previously registered.

Might consider a flag or some check to prevent this every time as it made some people skittish when they encountered it, lol.
dsurber

Posts: 191
Registered: 01/10/01
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Aug 30, 2007 12:18 PM   in response to: vampboy in response to: vampboy
Click to report abuse...   Click to reply to this thread Reply
This should not happen. The MBean is registered only when the driver class is loaded. If the driver class is loaded more than once, then it should be loaded by different ClassLoaders in which case the name of the MBean will be different and you won't get the exception. It should not be possible to load the class multiple times with the same ClassLoader. Can you provide a stand alone test case?

Douglas
vampboy

Posts: 8
Registered: 05/28/00
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Aug 31, 2007 1:34 PM   in response to: dsurber in response to: dsurber
Click to report abuse...   Click to reply to this thread Reply
This looks to be a class loader issue. After playing around with this for a bit and looking to see how Ant's class loader behaves I think the following code snippet is indicative to the behviour

import java.net.URL;
import java.net.URLClassLoader;

public class OracleDriverTest {
public static void main(String[] args) throws Exception {
OracleDriverTest test = new OracleDriverTest();
test.test();
}

public void test() throws Exception {
String oracleJar = "/ojdbc6.jar";
String oracleDriverName = "oracle.jdbc.driver.OracleDriver";

for (int i = 0; i < 5; i++) {
MyClassLoader p = new MyClassLoader(new URL[]{this.getClass().getResource(oracleJar)}, this.getClass().getClassLoader());
Class driver = p.loadClass2(oracleDriverName);
System.out.println("Driver classloader is " + driver.getClassLoader());
driver.newInstance();
}
System.out.println("Thread classloader = " + Thread.currentThread().getContextClassLoader());
}

private class MyClassLoader extends URLClassLoader {
public MyClassLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
}

/**
* Load method to skip checking the parent class loader
*
* @param name
* @return
* @throws ClassNotFoundException
*/
public Class<?> loadClass2(String name) throws ClassNotFoundException {
return super.findClass(name);
}
}
}

Essentially, what this is simulating is the class loader behavior where the child classloader skips looking to the parent classloader when trying to resolve a class.

As you can see by my stellar sysouts the driver class is loaded by each individual class loader for each iteration.

However, the MBean registration looks to be using the Thread's class loader which is the same for each failure.

for the 5 iterations you will see the original exception displayed 4 times. The first time it registers w/o any issues and then subsequently fails.

I'm, by far, not a class loader expert so I don't know which side of the fence this undesired behavior falls (Ant or Oracle). I originally logged posted here since this was new behavior since we upgraded to the 11g drivers.
dsurber

Posts: 191
Registered: 01/10/01
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Sep 4, 2007 8:40 AM   in response to: vampboy in response to: vampboy
Click to report abuse...   Click to reply to this thread Reply
I don't where the error lies either. I'll contact our ClassLoader gurus and see what they say, but I would like to hear from any other ClassLoader experts as well.

Joe, Anyone at BEA you can ask?

Douglas
dsurber

Posts: 191
Registered: 01/10/01
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Sep 6, 2007 4:22 PM   in response to: vampboy in response to: vampboy
Click to report abuse...   Click to reply to this thread Reply
deleted
dsurber

Posts: 191
Registered: 01/10/01
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Sep 11, 2007 9:08 AM   in response to: vampboy in response to: vampboy
Click to report abuse...   Click to reply to this thread Reply
This has been filed as bug 6362104. It will be fixed in the first patch release. I'm still not convinced that a correctly working ClassLoader should demonstrate this problem, but it was easy enough to fix and the fixed version is more robust.

Douglas
user594859

Posts: 1
Registered: 09/13/07
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Sep 13, 2007 6:48 AM   in response to: vampboy in response to: vampboy
Click to report abuse...   Click to reply to this thread Reply
I´m having the same problem using JBOSS + hibernate

Herrera
Mint

Posts: 1
Registered: 10/01/07
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Oct 1, 2007 3:52 AM   in response to: user594859 in response to: user594859
Click to report abuse...   Click to reply to this thread Reply
I am facing the same issue with Tomcat 5.5.4 & Oracle 11g.
drozzy

Posts: 1
Registered: 10/20/07
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Oct 20, 2007 7:43 PM   in response to: Mint in response to: Mint
Click to report abuse...   Click to reply to this thread Reply
I am having the same problem with Oracle 10g Express edition + Eclipse 3.3, Tomcat 6.0:


SEVERE: Error while registering Oracle JDBC Diagnosability MBean.
javax.management.MalformedObjectNameException: Invalid character '
' in value part of property
at javax.management.ObjectName.construct(ObjectName.java:602)
at javax.management.ObjectName.<init>(ObjectName.java:1394)
at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:303)
at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:213)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:209)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.example.ch03.Database.lookupFullname(Database.java:24)
at org.example.ch03.HelloServlet.doGet(HelloServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

dsurber

Posts: 191
Registered: 01/10/01
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Oct 31, 2007 12:51 PM   in response to: drozzy in response to: drozzy
Click to report abuse...   Click to reply to this thread Reply
Try redownloading the drivers from OTN. So many people are hitting this problem that we added the patch to the download. If you want to know whether you have the patched jar or not run

java -jar ojdbc6.jar

The unpatched jar prints

Oracle 11.1.0.6.0-Production JDBC 4.0 complied with JDK6

and the patched jar prints

Oracle 11.1.0.6.0-Production+ JDBC 4.0 complied with JDK6

If you use ojdbc5 it will say 3.0 and 1.5.

Douglas
vampboy

Posts: 8
Registered: 05/28/00
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Nov 13, 2007 11:45 AM   in response to: dsurber in response to: dsurber
Click to report abuse...   Click to reply to this thread Reply
This seems to fix my issues I was having with ant. Am I to assume that this is a very isolated patch and doesn't contain any other changes?
dsurber

Posts: 191
Registered: 01/10/01
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Nov 14, 2007 8:41 AM   in response to: vampboy in response to: vampboy
Click to report abuse...   Click to reply to this thread Reply
There are two patches in the plus jars. The first is the fix to the MBean problem. The second is only in the ojdbc(5|6)dms.jar files and has no impact on non-dms jars.

Douglas
dangerismymiddl...

Posts: 1
Registered: 01/23/08
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Jan 23, 2008 12:45 PM   in response to: dsurber in response to: dsurber
Click to report abuse...   Click to reply to this thread Reply
I was getting "SEVERE: Error while registering Oracle JDBC Diagnosability MBean". I was using the patched jar though. I switched to an older driver and the problem went away.

Message was edited by:
dangerismymiddlename.com
snazy

Posts: 2
Registered: 01/27/08
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Jan 27, 2008 2:46 AM   in response to: drozzy in response to: drozzy
Click to report abuse...   Click to reply to this thread Reply
Hi dozzy,

I've had the same error message

SEVERE: Error while registering Oracle JDBC Diagnosability MBean.
javax.management.MalformedObjectNameException: Invalid character '
' in value part of property

yesturday and implemented a workaround for it.
The bug is related to the code in OracleDataSource implementation. Oracle assumes, that Thread.currentThread().getContextClassLoader().toString() will not contain characters that are invalid in javax.management.ObjectName . Oops - Tomcat's class loaders toString() implementations mostly contain newlines (\r\n) - and these characters are not escaped and that's why a MalformedObjectNameException is thrown.

I've written a detailed explanation and workaround on my page: http://www.robert-stupp.de/blog/2008/01/oracle_malicious_11g_data_source_implementation.html

Regards
Robert
snazy

Posts: 2
Registered: 01/27/08
Re: SEVERE: Error while registering Oracle JDBC Diagnosability MBean
Posted: Jan 27, 2008 2:56 AM   in response to: snazy in response to: snazy
Click to report abuse...   Click to reply to this thread Reply
Hi!

I just saw, that there is already a patch on OTN. But I cannot find it on OTN - tried to look in the list of "new downloads" (http://www.oracle.com/technology/software/new_downloads.html) - but there is no updated JDBC driver?! Even in other categories I did not find any 11g JDBC driver as a seperate package.
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums