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 111131 - After project has been created, changing server will fail if they have different support for JSF
Summary: After project has been created, changing server will fail if they have differ...
Status: RESOLVED WONTFIX
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: _ potingwu
URL:
Keywords:
: 95027 117275 120995 121203 (view as bug list)
Depends on: 119406
Blocks:
  Show dependency tree
 
Reported: 2007-07-26 15:49 UTC by _ alexpetrov
Modified: 2008-11-20 23:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ alexpetrov 2007-07-26 15:50:03 UTC
Mac OS X, build # 0707241200

1. Connect to DB Derby Travel.
2. Create new VWP project: application server - "Apache Tomcat 6.0.13", Java EE version - "Java EE 5".
3. DnD JSF component Table on Designer and then DnD DB table "Trip" on it.
4. Run project.

Result:
Application will be deployed on Tomcat correctly. Data table will be shown in a web-browser.

5. Use popup menu item "Properties" for the project root tree node.
   In the dialog "Project Properties" select category "Run" and change server to "Glassfish V2".
   Click "OK".
6. Run project.

Result:
Empty page will be shown in a web-browser. Glassfish log will contain 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.webui.jsf.component.TableRowGroupBase.getRowKeys(TableRowGroupBase.java:548)
        at com.sun.webui.jsf.component.TableRowGroupBase.getFilteredRowKeys(TableRowGroupBase.java:185)
        at com.sun.webui.jsf.component.TableRowGroupBase.getRowCount(TableRowGroupBase.java:491)
        at com.sun.webui.jsf.component.Table.getRowCount(Table.java:326)
        at com.sun.webui.jsf.renderkit.html.TableRenderer.renderTitle(TableRenderer.java:416)
        at com.sun.webui.jsf.renderkit.html.TableRenderer.encodeBegin(TableRenderer.java:138)
        at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
        at com.sun.webui.jsf.component.Table.encodeBegin(Table.java:1046)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
        at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
        at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
        at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:298)
        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 com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.render(PartialTraversalLifecycle.java:92)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:266)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:268)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
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)
        ... 59 more
Caused by: javax.naming.NameNotFoundException
        at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:268)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:191)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:339)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:975)
        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:351)
        at com.sun.sql.rowset.internal.CachedRowSetXReader.connect(CachedRowSetXReader.java:344)
        ... 64 more
Comment 1 Yousuf Haider 2007-07-27 16:42:20 UTC
I can reproduce this as well.

I think this issue is similar to http://www.netbeans.org/issues/show_bug.cgi?id=95027 but the other way around.(see my
comments)

The reason why this bug is occuring is because the IDE creates a datasource entry in the context.xml for projects being
deployed to Tomcat.

For projects with target server as Glassfish it adds the data source information in sun-resources.xml under Server
Resources folder.

As a result when the target server of the project is changed to Glassfish the server does not have the sun-resources.xml
file for the project to work.

The work around is to go through this process:
1. Check the name of the jdbc resource in the web.xml and sun-web.xml file.

Go through the New file dialog to Create a new JDBC resource under Glassfish category. The JNDI name of the JDBC
resource should be the same as in the above mentioned 2 files. (for eg. "APP_ApacheDerby")

GO through the steps with default settings to create a new JDBC Pool and extract information from the corresponding
database connection. This will add the sun-resources.xml file with correct information to the project. 

Deployment should work fine at this point. 

Again I am not too sure if changing of servers is fully supported. Maybe with this workaround it is.
Comment 2 Jayashri Visvanathan 2007-07-27 18:44:10 UTC
Thanks a lot Yousuf for the evaluation. Since there is a work around, lowering priority. If we don't
support switching servers, we should a create FAQ with Yousuf's steps above.
Comment 3 _ potingwu 2007-07-31 22:18:12 UTC
"changing of servers is not supported" for the whole web project, not just visualweb.

Not a planned NetBeans 6.0 feature.
Comment 4 _ potingwu 2007-07-31 22:21:31 UTC
*** Issue 95027 has been marked as a duplicate of this issue. ***
Comment 5 _ potingwu 2007-10-18 19:22:42 UTC
Should ask NetBeans web project plan this 'switching server' feature for post NetBeans 6.0.
Comment 6 _ potingwu 2007-10-18 19:24:47 UTC
*** Issue 117275 has been marked as a duplicate of this issue. ***
Comment 7 John Baker 2007-10-18 20:49:14 UTC
If the project module detects a change in target server then create data sources could be invoked
to create the server specific resource references
Comment 8 John Baker 2007-10-18 20:51:37 UTC
See line 110  org.netbeans.modules.visualweb.project.jsf.services

                jmp.getConfigSupport().createDatasource(req.getResourceName(), req.getUrl(),
                        req.getUsername(), req.getPassword(), req.getDriverClassName());
 

or I can provide the code
Comment 9 _ potingwu 2007-11-02 18:20:12 UTC
*** Issue 120995 has been marked as a duplicate of this issue. ***
Comment 10 _ potingwu 2007-11-05 18:13:30 UTC
*** Issue 121203 has been marked as a duplicate of this issue. ***
Comment 11 wmac 2007-11-22 00:53:31 UTC
People don't look at FAQs before working with IDE!

If this feature is not supported in NB6 it should not be allowed to change the Application Server in project properties.
People will do that and will assume NB is not a reliable software.

Even a simple software should validate user actions, if it is not ok then the action should be blocked.
Comment 12 _ potingwu 2008-11-20 23:31:23 UTC
.