FYI I see there's a tip in the tutorial for exactly this case : One drawback of the approach above is that now our CustomerEditorTopComponent only works if it can find a TopComponent with the ID "CustomerViewerTopComponent". Either this needs to be explicitly documented, so that developers of alternative editors can know that they need to identify the viewer TopComponent this way, or you need to rewrite the selection model, as described [in the tutorial] by Tim Boudreau.
Peter ________________________________ From: Peter Blemel <[email protected]> Sent: Friday, December 18, 2020 8:39 AM To: [email protected] <[email protected]> Subject: Re: Embedded Derby DB and Platform Application Just a quick guess without looking at your code ... The stack trace java.lang.IllegalStateException: Cannot find TopComponent with > > preferredID CustomerViewerTopComponent, see IDE log for more details. would seem to imply that you may have renamed your top component (or written a new one), but have a bit of example code that still referring to it by the 'old' name, probably here result = WindowManager.getDefault().findTopComponent("CustomerViewerTopComponent").getLookup().lookupResult(Customer.class); If so, I'd search for that string and change it to be whatever you've called your top component. Peter ________________________________ From: Ömer Halit Çizmeci <[email protected]> Sent: Friday, December 18, 2020 12:41 AM To: [email protected] <[email protected]> Subject: Re: Embedded Derby DB and Platform Application Hi, FYI, Derby embedded/client database works with NetBeans 12.0. You might want to review your code or imports. On Fri, Dec 18, 2020, 10:29 AM Geertjan Wielenga <[email protected]> wrote: > Put all the code on GitHub so someone can take a look. > > Gj > > On Fri, 18 Dec 2020 at 04:29, Sean Carrick <[email protected]> wrote: > > > Hey All! > > > > I am trying to use an embedded Derby database in my platform > > application, but cannot get it to work. I have worked through the CRUD > > tutorial <https://platform.netbeans.org/tutorials/nbm-crud.html> using > > the sample Derby database and it works flawlessly. However, when I try > > to do this with my embedded database, it blows up. > > > > After I add my viewer window, run the application, and the window shows > > up as expected. Then, when I start adding in the persistence/database > > access code, I get the following error: > > > > A java.lang.IllegalStateException exception has occurred. > > Click Show Details or see the messages.log file located in your > > /home/sean/NetBeansProjects/TestDBApp/build/testuserdir/var/log folder. > > > > This is accompanied by this stacktrace: > > > > java.lang.IllegalStateException: Cannot find TopComponent with > > preferredID CustomerViewerTopComponent, see IDE log for more details. > > at > > > > > org.openide.windows.OpenComponentAction.actionPerformed(OpenComponentAction.java:69) > > at > > org.openide.awt.AlwaysEnabledAction$1.run(AlwaysEnabledAction.java:174) > > at > org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:70) > > at > > > > > org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:91) > > at > > > org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:74) > > at > > > > > org.openide.awt.AlwaysEnabledAction.actionPerformed(AlwaysEnabledAction.java:177) > > at > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) > > at > > > > > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) > > at > > > > > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) > > at > > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) > > at javax.swing.AbstractButton.doClick(AbstractButton.java:376) > > at > > javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:842) > > at > > > > > javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:886) > > at java.awt.Component.processMouseEvent(Component.java:6539) > > at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) > > at java.awt.Component.processEvent(Component.java:6304) > > at java.awt.Container.processEvent(Container.java:2239) > > at java.awt.Component.dispatchEventImpl(Component.java:4889) > > at java.awt.Container.dispatchEventImpl(Container.java:2297) > > at java.awt.Component.dispatchEvent(Component.java:4711) > > at > > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904) > > at > > java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535) > > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476) > > at java.awt.Container.dispatchEventImpl(Container.java:2283) > > at java.awt.Window.dispatchEventImpl(Window.java:2746) > > at java.awt.Component.dispatchEvent(Component.java:4711) > > at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) > > at java.awt.EventQueue.access$500(EventQueue.java:97) > > at java.awt.EventQueue$3.run(EventQueue.java:709) > > at java.awt.EventQueue$3.run(EventQueue.java:703) > > at java.security.AccessController.doPrivileged(Native Method) > > at > > > > > java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) > > at > > > > > java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) > > at java.awt.EventQueue$4.run(EventQueue.java:733) > > at java.awt.EventQueue$4.run(EventQueue.java:731) > > at java.security.AccessController.doPrivileged(Native Method) > > at > > > > > java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) > > at > > > > > org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136) > > [catch] at > > > > > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) > > at > > > > > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) > > at > > > > > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) > > at > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) > > at > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) > > at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) > > > > I commented out all of the code that I placed in the constructor of the > > CustomerViewerTopComponent, then started adding back the code, one line > > at a time. This exception is actually thrown at the very first line: > > > > EntityManager entityManager = > > > > > Persistence.createEntityManagerFactory("CustomerLibraryPU").createEntityManager(); > > > > I have all appropriate imports, and my annotations are as follows: > > > > @ConvertAsProperties( > > dtd = > > "-//com.pekinsoft.nwind.db.customer.viewer//CustomerViewer//EN", > > autostore = false > > ) > > @TopComponent.Description( > > preferredID = "CustomerViewerTopComponent", > > iconBase = > > "com/pekinsoft/nwind/db/customer/viewer/customers16.png", > > persistenceType = TopComponent.PERSISTENCE_ALWAYS > > ) > > @TopComponent.Registration(mode = "explorer", openAtStartup = false) > > @ActionID(category = "Window", id = > > "com.pekinsoft.nwind.db.customer.viewer.CustomerViewerTopComponent") > > @ActionReference(path = "Menu/Window/Administration" /*, position = 333 > */) > > @TopComponent.OpenActionRegistration( > > displayName = "#CTL_CustomerViewerAction", > > preferredID = "CustomerViewerTopComponent" > > ) > > @Messages({ > > "CTL_CustomerViewerAction=CustomerViewer", > > "CTL_CustomerViewerTopComponent=CustomerViewer Window", > > "HINT_CustomerViewerTopComponent=This is a CustomerViewer window" > > }) > > > > As can clearly be seen, the preferredID = "CustomerViewerTopComponent" > > is present...twice, to be exact, as generated by the Window wizard. > > > > My next step was, since I had only created the tables and they were > > empty, was to add a test record into my CUSTOMERS table, thinking that > > maybe this was due to there not being any data in the table. However, I > > still received this exception. > > > > My Persistence Unit is defined with the following connection string: > > jdbc:derby:testdb;create=true; > > > > I am using Oracle Java 8, NetBeans 12.0 (64-bit) for both. I am running > > on MX Linux with a CORE i7 (7th Gen), 8GiB of RAM, 1TB HDD. All kernel > > updates are in place and at version: > > > > uname -a: Linux omen 4.19.0-12-amd64 #1 SMP Debian 4.19.152-1 > > (2020-10-18) x86_64 GNU/Linux > > > > I am at a loss as to why this is not working and am wondering if it is > > just that the embedded Derby database is not working with NB12.0 for > > some reason. Any help anyone can provide is greatly appreciated. Thank > > you all in advance. > > > > Sean C. > > > > >
