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 257887 - Code generated from Wizard Wizard doesn't work
Summary: Code generated from Wizard Wizard doesn't work
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.1
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-08 10:01 UTC by maxnitribitt
Modified: 2016-03-03 02:06 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Enables OSGi dependencies by default for newly created modules (1.98 KB, patch)
2016-02-27 19:48 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description maxnitribitt 2016-02-08 10:01:01 UTC

    
Comment 1 maxnitribitt 2016-02-08 10:08:54 UTC
The new Wizard Wizard allows to create a Wizard using html4java. I tried creating a wizard with it in an ANT as well as in Maven based project. Both generate Wizards don't work, but they have different problems:

ANT

1. Create new Project (NetBEans Modules | Module)
2. In the project create new Wizard (Module Development | Wizard)
3. Choose "New File with HTML/Java UI"
4. Run the application
5. The wizard launches and displays the content of section with id "init"
7. click next

Expected Behaviour:

- The wizard should display section "info"

Perceived Behaviour:

- The Wizard still displays the content of section "init"

MAVEN

1. Create new Project (Maven | NetBeans Module)
2. In the project create new Wizard (Module Development | Wizard)
3. Choose "New File with HTML/Java UI"
4. Run the application
5. The Wizard launches and throws an Exception:

SEVERE [org.netbeans.modules.templatesui.HTMLWizard]: Problems initializing HTML wizard
java.util.ServiceConfigurationError: org.netbeans.html.context.spi.Contexts$Provider: Provider org.netbeans.html.ko4j.KO4J not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
	at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323)
	at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at org.netbeans.html.context.spi.Contexts.fillInByProviders(Contexts.java:139)
	at net.java.html.BrwsrCtx.findDefault(BrwsrCtx.java:113)
	at com.dukescript.demo.mavenproject10.helloCntrl.<init>(helloCntrl.java:61)
	at com.dukescript.demo.mavenproject10.hello.javaWizard(hello.java:31)
Caused: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.netbeans.modules.templatesui.HTMLWizard.initSequence(HTMLWizard.java:76)
[catch] at org.netbeans.modules.templatesui.AbstractWizard$2$1.run(AbstractWizard.java:288)
	at net.java.html.boot.BrowserBuilder$1OnPageLoad$1CallInitMethod.run(BrowserBuilder.java:336)
	at net.java.html.BrwsrCtx$1Wrap.run(BrwsrCtx.java:177)
	at org.netbeans.html.boot.fx.AbstractFXPresenter.execute(AbstractFXPresenter.java:282)
	at net.java.html.BrwsrCtx.execute(BrwsrCtx.java:188)
	at net.java.html.boot.BrowserBuilder$1OnPageLoad.run(BrowserBuilder.java:374)
	at org.netbeans.html.boot.fx.AbstractFXPresenter.onPageLoad(AbstractFXPresenter.java:145)
	at net.java.html.boot.fx.FXBrowsers$Load.access$000(FXBrowsers.java:228)
	at net.java.html.boot.fx.FXBrowsers$Load$1.changed(FXBrowsers.java:251)
	at net.java.html.boot.fx.FXBrowsers$Load$1.changed(FXBrowsers.java:244)
	at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
	at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyObjectWrapper.java:176)
	at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:142)
	at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
	at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
	at javafx.scene.web.WebEngine$LoadWorker.updateState(WebEngine.java:1260)
	at javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1371)
	at javafx.scene.web.WebEngine$LoadWorker.access$1200(WebEngine.java:1253)
	at javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1240)
	at com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2400)
	at com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2244)
	at com.sun.webkit.network.URLLoader.twkDidFinishLoading(Native Method)
	at com.sun.webkit.network.URLLoader.notifyDidFinishLoading(URLLoader.java:838)
	at com.sun.webkit.network.URLLoader.lambda$didFinishLoading$96(URLLoader.java:829)
	at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Comment 2 Jaroslav Tulach 2016-02-26 21:56:12 UTC
Thanks for trying. I'll check what is wrong.
Comment 3 Jaroslav Tulach 2016-02-26 22:27:56 UTC
The Ant part:
- sometimes the system displays the info section, but sometimes it stays on the init one.
Comment 4 Jaroslav Tulach 2016-02-26 23:18:52 UTC
The Ant issue is very likely a GC problem. The Java model can be GCed while the JavaScript peer still exists - but then the propagation of changes stops.

Fixed in http://hg.netbeans.org/ergonomics/rev/f96a0aa64595
Comment 5 Jaroslav Tulach 2016-02-27 18:05:59 UTC
When trying to reproduce the Maven issue, I see following message in the log:

WARNING [org.netbeans.ProxyClassLoader]: Will not load class org.netbeans.html.context.spi.Contexts arbitrarily from one of NetbinoxLoader delegating to net.java.html_1.2.3 and ModuleCL@56316587[com.dukescript.libraries.htmlwizardmaven] starting from SystemClassLoader[522 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE

I don't know why Contexts class is twice in the system yet, but such situation can certainly confuse service loader.
Comment 6 Jaroslav Tulach 2016-02-27 19:30:43 UTC
Maven problem is packaging problem. The net.java.html @ 1.2.3 module classes are available twice. This is result of not using OSGi dependencies. Once the module is packaged as

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>nbm-maven-plugin</artifactId>
                <version>3.13</version>
                <extensions>true</extensions>
                <configuration>
                    <useOSGiDependencies>true</useOSGiDependencies>
                </configuration>
            </plugin>

the problem is gone. I suggest to change the default in the new module wizard to use OSGi dependencies. That should be compatible enough: old projects remain at their current state - new project will use OSGi dependencies as required by increasing number of OSGi bundles in the NetBeans platform.
Comment 7 Jaroslav Tulach 2016-02-27 19:48:43 UTC
Created attachment 158666 [details]
Enables OSGi dependencies by default for newly created modules

Tomáši, Miloši, this is the patch I'd like to apply. Please stop me in few days, otherwise I go on and integrate it.
Comment 8 Tomas Stupka 2016-02-29 15:48:21 UTC
fixed in jet-main #08f41a00739d
Comment 9 Milos Kleint 2016-02-29 20:43:38 UTC
useOsgiDependencies=true has proved as a stumble block for many as a lot of OSGI libraries contains OSGI headers and it's not always apparent that they do or started or ceased to use the headers. That renders any library wrapper module that contains a large set of jars useless, some artifacts will be OSGI so not.

just FYI.
Comment 10 Quality Engineering 2016-03-01 02:19:01 UTC
Integrated into 'main-silver', will be available in build *201603010002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f96a0aa64595
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #257887: Keep reference to the Java model, not only the Java script one
Comment 11 Quality Engineering 2016-03-03 02:06:02 UTC
Integrated into 'main-silver', will be available in build *201603030002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/08f41a00739d
User: Tomas Stupka <tstupka@netbeans.org>
Log: Issue #257887 - Code generated from Wizard Wizard doesn't work