Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Can't use aql due to java.lang.IllegalStateException
Can't use aql due to java.lang.IllegalStateException [message #1823822] Thu, 02 April 2020 14:30 Go to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
Hi,

I've met a strange problem currently. In my .odesign file I can use service, var, feature normally, but I failed to use aql query's auto completion. Every time I type in aql:self. and hit ctrl+space, an error happens like below:
!ENTRY org.eclipse.ui 4 0 2020-04-02 22:26:59.257
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.IllegalStateException: Couldn't register package null because its name is null.
	at org.eclipse.acceleo.query.runtime.impl.EPackageProvider.registerPackage(EPackageProvider.java:282)
	at org.eclipse.acceleo.query.runtime.impl.QueryEnvironment.registerEPackage(QueryEnvironment.java:94)
	at org.eclipse.sirius.common.acceleo.aql.business.internal.AQLSiriusInterpreter.activateMetamodels(AQLSiriusInterpreter.java:181)
	at org.eclipse.sirius.common.acceleo.aql.ide.proposal.AQLProposalProvider.setupInterpreter(AQLProposalProvider.java:92)
	at org.eclipse.sirius.common.acceleo.aql.ide.proposal.AQLProposalProvider.getProposals(AQLProposalProvider.java:75)
	at org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter.getProposals(CompoundInterpreter.java:441)
	at org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getProposals(TextContentProposalProvider.java:87)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter.getProposals(ContentProposalAdapter.java:1999)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter.openProposalPopup(ContentProposalAdapter.java:1848)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter.access$16(ContentProposalAdapter.java:1843)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter$1.handleEvent(ContentProposalAdapter.java:1700)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4105)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1037)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1046)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1088)
	at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1766)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1084)
	at org.eclipse.swt.widgets.Widget.wmSysChar(Widget.java:2247)
	at org.eclipse.swt.widgets.Control.WM_SYSCHAR(Control.java:5420)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4796)
	at org.eclipse.swt.widgets.Text.windowProc(Text.java:2625)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4757)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3522)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1420)


I don't known where I'm wrong because I can use aql expressions normally, but only aql's auto complete function is unavailable.

Thanks for any advice!
Re: Can't use aql due to java.lang.IllegalStateException [message #1823839 is a reply to message #1823822] Thu, 02 April 2020 19:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Quote:
Couldn't register package null because its name is null


I strongly suspect that you have a package will a null name (or nsURI).

Edit your model, which probably has a validation error already in the Sample Ecore Model Editor to provide non-null name and nsURI.

Regards

Ed Willink
Re: Can't use aql due to java.lang.IllegalStateException [message #1823852 is a reply to message #1823839] Fri, 03 April 2020 04:12 Go to previous messageGo to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
Hi,

Thanks very much for your advice. I've checked my meta-model and sure that a nsURI is already set. Would you please tell me how can I find the package with the null name or null nsURI?
Re: Can't use aql due to java.lang.IllegalStateException [message #1823853 is a reply to message #1823852] Fri, 03 April 2020 04:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

There can't be that many. Look at them all. (and in the Sample Ecore Model Editor, validate to make sure that they are all loaded.)

Otherwise the debugger is your friend. Search the code for the message. Then set a breakpint on it.

Regards

Ed Willink
Re: Can't use aql due to java.lang.IllegalStateException [message #1823865 is a reply to message #1823853] Fri, 03 April 2020 08:48 Go to previous messageGo to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
Hi,

Sorry for bothering again but I still don't solve the problem. I read the Sirius source code and did some experiments. I found that the place where the error happens is:
private void setupInterpreter(ContentContext context, AQLSiriusInterpreter interpreter) {
        Collection<MetamodelDescriptor> metamodels = new ArrayList<MetamodelDescriptor>();
        for (EPackage pak : context.getInterpreterContext().getAvailableEPackages()) {
            if (pak != null) {
                metamodels.add(new EcoreMetamodelDescriptor(pak));
            }
        }
        interpreter.activateMetamodels(metamodels);
        if (context.getInterpreterContext().getElement() != null) {
            Resource vsmResource = context.getInterpreterContext().getElement().eResource();
            if (vsmResource != null) {
                interpreter.setProperty(IInterpreter.FILES, Lists.newArrayList(vsmResource.getURI().toPlatformString(true)));
            }
        }
        for (String imp : context.getInterpreterContext().getDependencies()) {
            interpreter.addImport(imp);
        }
    }


At context.getInterpreterContext().getAvailableEPackages() the Sirius got a null-named ePackage and then passed it to the aql runtime so caused the error. But the strange thing is, I found this error has nothing to do with my own Ecore model. I've done an experiment that I used the Sirius Sample Ecore Model(the BasicFamily model) to create a modeling project and in the viewpoint specification project I still get the null package name error. I wonder what the method getAvailableEPackages() returns and why there's always a null-named e package in the return value. The code is in a plugin without source code so I cannot set breakpoints to debug it, which makes me very disappointing.

My environment is Eclipse 2020-03 for RCP and RAP Developers with the latest Sirius and Ecore plugin installed.

Thanks so much for your help!
Re: Can't use aql due to java.lang.IllegalStateException [message #1823868 is a reply to message #1823865] Fri, 03 April 2020 09:35 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

It may not be your model; just one that your model makes transitove usage ok.

By looking at the eContainer/eResource of the bad EPackage you can find out the null EPackage's ancestry and Resource URI and so identify where to file a Bugzilla.

Regards

Ed Willink
Previous Topic:Impossible to use External Java Action
Next Topic:How to get all of the instances of a class using AQL queries
Goto Forum:
  


Current Time: Fri Mar 29 12:24:41 GMT 2024

Powered by FUDForum. Page generated in 0.01631 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top