This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 102812 - runtime SQL exception for imported Creator 2 U1 project
Summary: runtime SQL exception for imported Creator 2 U1 project
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: John Baker
URL:
Keywords:
: 112375 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-04-27 19:05 UTC by sjangity
Modified: 2007-10-12 19:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
exception from server log (12.79 KB, text/plain)
2007-04-27 19:06 UTC, sjangity
Details
server.log (68.61 KB, text/plain)
2007-07-31 13:40 UTC, _ alexpetrov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sjangity 2007-04-27 19:05:36 UTC
1. Create a Creator 2 Update 1 project
2. Add mysql datasource and drop the default bundled 'mysql' database on a table
component
3. Open the project in NB 6.0 (migrate settings when prompted)
4. Deploy to Glassfish

Logs show the following exception:

java.lang.RuntimeException: java.sql.SQLException
        at
com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow(CachedRowSetDataProvider.java:362)
        at
com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorIndex(CachedRowSetDataProvider.java:319)
        at
com.sun.data.provider.impl.CachedRowSetDataProvider.getRowCount(CachedRowSetDataProvider.java:652)
        at
com.sun.rave.web.ui.component.TableRowGroup.getRowKeys(TableRowGroup.java:817)
        at
com.sun.rave.web.ui.component.TableRowGroup.getFilteredRowKeys(TableRowGroup.java:440)
        at
com.sun.rave.web.ui.component.TableRowGroup.getRowCount(TableRowGroup.java:760)
        at com.sun.rave.web.ui.component.Table.getRowCount(Table.java:318)

...

Caused by: javax.naming.NameNotFoundException: No object bound to name
java:comp/env/jdbc/mysql
        at
com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:807)
        at
com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:160)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:313)

(Full exception in attachment)
Comment 1 sjangity 2007-04-27 19:06:31 UTC
Created attachment 41863 [details]
exception from server log
Comment 2 John Baker 2007-04-27 19:14:20 UTC
 
but this was working earlier this week right?
Comment 3 John Baker 2007-04-27 19:21:52 UTC
The steps to migrate are incomplete.

The process has been explained and is documented:
http://jupiter.czech.sun.com/wiki/view/Creatorqe/CreatorXVWP5XNB6MigrationGuide

Either you need to select the Data Source Reference(s) node, right-click and
choose Resolve Data Source(s) or  open a page with the data-bound components
Comment 4 John Baker 2007-04-27 19:24:59 UTC
I meant the steps listed by the submitter are incomplete
Comment 5 John Baker 2007-04-27 19:56:22 UTC
After migrating 5.5 settings user tried to migrate a Creator 2 project.

This won't work because the Creator 2 settings had not been migrated.

For M10, we'll try to come up with a solution to migrate settings from 
all previous releases.
Comment 6 _ alexpetrov 2007-07-31 13:39:05 UTC
This bug is still reproduced (see a description below):

Product Version: NetBeans 5.5.1 (0704122300) Creator 2.1 RC2 (070516_20000) 
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03)
System: Windows XP version 5.1 running on x86; 
Sun Application Server 9.1

&

Product Version: NetBeans IDE Dev (Build 200707270000) 
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06 
System: Windows XP version 5.1 running on x86; 
Glassfisg V2 (build 57)

1. Start Creator 2 Update1.
   Define Sun Application Server 9.1 (Runtime, Servers).
   Connect to DB MySQL (Runtime, Databases)
2. Create new project, Dnd JSF component Table on Designer, DnD any MySQL DB table on it.
   Save and close project.
3. Delete a directory <user_home>/.netbeans/dev
   Start NB VWP 6.0 with import settings from 5.5.1

Result:
- MySQL connection will be presented under Databases in Services.
- Sun Application Server (in addition to Glassfish V2) will be presented under Servers in Services.

4. Connect to MySQL DB
5. Open project, created by Creator 5.5.1.

Result:
- it will be opened without any problem

6.  Use popup menu item "Properties" for root project tree node in windwow Projects.
7. Select category "Run" in the dialog and change Server from "Sun Application Server" to "Glassfish V2"
   Click OK.
8. Run project.
Result:
- empty web-page will appear in a web-browser
- SQLException (and javax.naming.NameNotFoundException) will appear in the server.log (see the attached file):
com.sun.rave.web.ui.appbase.ApplicationException: java.sql.SQLException
	at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.cleanup(ViewHandlerImpl.java:572)
	at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:303)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
	at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
......
Caused by: java.sql.SQLException
	at com.sun.sql.rowset.internal.CachedRowSetXReader.connect(CachedRowSetXReader.java:359)
	at com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.java:138)
	at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:990)
	at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:1454)
	at com.sun.data.provider.impl.CachedRowSetDataProvider.checkExecute(CachedRowSetDataProvider.java:1290)
	at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow(CachedRowSetDataProvider.java:348)
	... 58 more
Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/jdbc/dataSource_1185878963843
	at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:834)
	at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
	at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:337)
	at javax.naming.InitialContext.lookup(InitialContext.java:392)
	at com.sun.sql.rowset.internal.CachedRowSetXReader.connect(CachedRowSetXReader.java:344)
	... 63 more
Comment 7 _ alexpetrov 2007-07-31 13:40:24 UTC
Created attachment 45938 [details]
server.log
Comment 8 John Baker 2007-08-09 02:12:38 UTC
reproducible.

the resource reference is not added to the web.xml
Comment 9 John Baker 2007-08-09 02:35:07 UTC
I reproduced this the first time out of the box.
It seems the first time that data sources are not found in the project.
As a result, the web.xml cannot be updated.

If the page is opened as the project opens then the data sources detected and the web.xml can be updated.
Once the resource reference gets added to web.xml, the project can be executed successfully.
Comment 10 John Baker 2007-08-09 02:35:42 UTC
*** Issue 112375 has been marked as a duplicate of this issue. ***
Comment 11 John Baker 2007-08-09 07:41:31 UTC
startModeling() does not detect data sources in a project.

No ModelSet event occurs
Comment 12 John Baker 2007-08-11 02:17:21 UTC
It really seems like data source in a project cannot be determined, until a page of the project, with the current insync
APIs.

While trying to fix this and debugging

 LiveUnit daUnit = fModel.getLiveUnit() returns null.
a LiveUnit object is needed to determine the data source names.

The LiveUnit object is null because liveUnitWrapper is null.
It appears that LiveUnitWrapper is instantiated only when a Markup is available.
Markup is instantiated when a jsp page is available.

It would be ideal if a page is automatically opened when a project is opened.


Comment 13 John Baker 2007-08-11 02:39:31 UTC
I may have a workaround.
Passing the jsp file of the Project to FacesModelSet.getModelSetIfAvailable() will create a Markup
and LiveUnitWrapper

Initial test results shows that this may the fix
Comment 14 John Baker 2007-08-11 03:26:54 UTC
Fixed

using FacesModelSet.getModelSetIfAvailable() creates a Markup and LiveUnitWrapper objects that are needed to
retrieve the data sources.

Checking in
visualweb/dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/datasource/DataSourceResolver.java;
/cvs/visualweb/dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/datasource/DataSourceResolver.java,v
 <--  DataSourceResolver.java

new revision: 1.12; previous revision: 1.11
done

Comment 15 _ alexpetrov 2007-10-12 19:06:05 UTC
Verified on:

Product Version: NetBeans IDE Dev (Build 200710120000)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b02
System: Windows XP version 5.1 running on x86.
+
new org-netbeans-modules-visualweb-dataconnectivity.jar, which John sent me.