Bug 56861 - java.lang.ClassNotFoundException: org.netbeans.modules.db.explorer.OpenConnection
java.lang.ClassNotFoundException: org.netbeans.modules.db.explorer.OpenConnec...
Status: CLOSED FIXED
Product: db
Classification: Unclassified
Component: Code
4.x
All All
: P3 (vote)
: 4.x
Assigned To: Nam Nguyen
issues@db
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-03-23 13:27 UTC by Petr Blaha
Modified: 2006-03-24 12:48 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
stack trace (4.26 KB, text/plain)
2005-03-23 13:28 UTC, Petr Blaha
Details
Fix using service lookup (4.86 KB, patch)
2005-03-25 09:16 UTC, Nam Nguyen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Blaha 2005-03-23 13:27:54 UTC
[Build 20050322]
Steps:
1) I created new EJB module with session bean
2) add entity bean and open impl class in editor
3) invoke Enterprise Resource | Use Database .. PointBase database was starting
manually
4) deploy project
5) close IDE
6) open IDE and get exception
Comment 1 Petr Blaha 2005-03-23 13:28:52 UTC
Created attachment 21059 [details]
stack trace
Comment 2 Petr Jiricka 2005-03-23 16:00:10 UTC
It is weird that the IDE attempts to update the config files during deployment.
These files should be created much sooner than that, not during deployment.
Assigning to Stepan.
Comment 3 Nam Nguyen 2005-03-23 19:18:42 UTC
The current deployment activity would need to have ConfigurationStorage to
either write deployment plan (jsr-88 deploy) or to get WebContext value or get
the DeployableObject for incrementall deployment calls.  This we why the config
graph is get built.

The stack trace seems to tell that while loading the config bean graph, the
plugin implementation of ensureResourceDefined is called.  This should not try
to create the resource because it should have been already created during 'Use
Database' action in the previous IDE session.  IMO, this is plugin issue: 
plugin should not try to acquire the connection during ensureResourceDefined(). 

Side issue: it is also interesting to know why the dbexplorer using context
class loader could not see class in its own modules.


Comment 4 Nam Nguyen 2005-03-24 01:35:41 UTC
This is really a P1.  Users could not deploy ejbjar with CMP's after restart the
IDE.  Per my previous assessment, assign to Ludo for further assessment for a
fix in plugin.

The ClassNotFoundException is part of the filtering of Ant execution classpath
to be free of IDE classloaders.
Comment 5 _ ludo 2005-03-24 02:04:14 UTC
Rajeshwar, start the evaluation.
Comment 6 _ ludo 2005-03-24 02:09:14 UTC
The CNF might be because the AS plugin depends on dbschema module, but not on
dbexplorer module.
We might need to add:
org.netbeans.modules.db/1 = 1.1

in our manifest for dependant modules...
Rajeshwar, please try.
Comment 7 _ ludo 2005-03-24 02:14:20 UTC
Too bad, we already have this dependancy...
Comment 8 _ ludo 2005-03-24 02:24:51 UTC
Nam,
can you explain this code in db explorer?
It seems that Studio is defining a class name via a bundle, and the defautl nb
impls is nop, but where is the studio real impl there?

I will remove this hack for now. We need to go to ARC review for customization
this, as this trick is not defined anywhere.
Comment 9 _ ludo 2005-03-24 02:33:10 UTC
removing the hack will fix the bug which is a must fix P3 fior 4.1.
I could create a default impl of this interface in case of CNF error.

But: 
Now it will not fix hidden requirements for the JSE team.
Comment 10 Nam Nguyen 2005-03-24 15:07:00 UTC
OpenConnection is a mechanism for JSE to do extra work when open and close a
connection. When merge back into trunk, I don't like this hack of defining
service through Bundle.properties.  This practice mainly used for branding
practice, and I guess the usage here for the Sun JDBC drivers is justified by
saying this is also "kind of" branding.  
The CNFE I guess is because the restriction of Ant execution classloader.  So we
have options:
(1) avoid getting db connection if resource already defined in this test case.
(2) redefine the mechanism using service lookup pattern for OpenConnection.
Options #2 is the right fix, but isnt' it too late for API change.  Or, could we
say this dbexplorer dependency is implementation, so it is not API yet at this time.
Comment 11 _ ludo 2005-03-24 15:34:21 UTC
I am not sure how this would work with the new nb4.1 and buzz...
So you gona brand the db explorer module?
Classloader between modules changed a lot between 3.6 and 4.1
Comment 12 Nam Nguyen 2005-03-24 16:02:12 UTC
Yes.  We currently have org/netbeans/modules/db/resources/Bundle_jse.properties:
CLASS_open_connection=com.sun.tools.dbdrivers.JseOpenConnection

This has been done and tested to work by the SPD team.  The classloader changed,
so we had to change to use context classloader instead of current classloader.
Comment 13 _ ludo 2005-03-24 16:42:30 UTC
so this way of adressing the issue does not work...as depending on nb3.6 or nb4.1
you need a different classloader....
or can you try again in nb4.1 with the current classloader isntead of contextcl?
Comment 14 Nam Nguyen 2005-03-24 20:39:53 UTC
I am sure trying current classloader after CNFE from context classloader will
work for NB4.1 but still not work for JSE.  I will try the service lookup
pattern for OpenConnection tonight.  

On the other hand, we also need to make sure ensureResourceDefined is not
creating new resource definition when one already defined as indicated by this
issue test case and stack trace.

Comment 15 _ ludo 2005-03-25 01:21:11 UTC
I could not reproduce this anyway so far.
Nam, can you? 
Comment 16 Nam Nguyen 2005-03-25 05:14:49 UTC
I can see the exception but with binary from build 3/17.  The test case last
step should read "open ide, deploy the ejbmodule project. Will see exception". 
Could not work on latest code because of issue 56968
Comment 17 _ ludo 2005-03-25 05:21:44 UTC
I can aslo see the exception and I do not see issue 56968

What is the plan of action? service lookup? Could we temporaly remove the
exception by choosing the correct classloader, or can you have a fix by tonight?
Comment 18 Nam Nguyen 2005-03-25 05:38:56 UTC
I am working on this tonight.  I will try the current classloader if the context
classloader failed.  I will test against JSE.  If not work, I will try service
lookup. 
Comment 19 Nam Nguyen 2005-03-25 07:44:05 UTC
Temporary work-around.  Still need to fix for JSE to work.

Checking in DatabaseConnection.java;
/cvs/db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java,v  <-- 
DatabaseConnection.java
new revision: 1.33; previous revision: 1.32
Comment 20 Nam Nguyen 2005-03-25 09:16:59 UTC
Created attachment 21128 [details]
Fix using service lookup
Comment 21 Nam Nguyen 2005-03-25 09:23:06 UTC
The attached patch replace "branding open connection service" with service
lookup.  This patch work for this test case in both NB4.1 and JSE.  I am doing a
full clean build and will check in by tomorrow morning PST.
Comment 22 Nam Nguyen 2005-03-25 15:17:51 UTC
Checking in src/org/netbeans/modules/db/explorer/OpenConnectionInterface.java;
/cvs/db/src/org/netbeans/modules/db/explorer/OpenConnectionInterface.java,v  <--
 OpenConnectionInterface.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/netbeans/modules/db/explorer/OpenConnection.java;
/cvs/db/src/org/netbeans/modules/db/explorer/OpenConnection.java,v  <-- 
OpenConnection.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/netbeans/modules/db/explorer/DatabaseConnection.java;
/cvs/db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java,v  <-- 
DatabaseConnection.java
new revision: 1.34; previous revision: 1.33
done
Comment 23 Petr Blaha 2005-09-08 12:00:16 UTC
I can't reproduce the issue in the latest daily build.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo