Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK dependencies in module.xml don't work #46

Open
quintesse opened this issue Oct 9, 2013 · 21 comments
Open

JDK dependencies in module.xml don't work #46

quintesse opened this issue Oct 9, 2013 · 21 comments
Labels
Milestone

Comments

@quintesse
Copy link
Member

Adding a dependency like:

    <module name="javax.xml" slot="7"/>

to a module.xml file doesn't work, resulting in errors like:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:86)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:21)
Caused by: org.jboss.modules.ModuleLoadError: Module javax.base:7 is not found in local module loader @279ad355 (roots: /home/tschotan/projects/ceylon/ceylon-dist/dist/repo)
    at org.jboss.modules.ModuleLoadException.toError(ModuleLoadException.java:78)
    at org.jboss.modules.Module.getPathsUnchecked(Module.java:1191)
    at org.jboss.modules.Module.loadModuleClass(Module.java:522)
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    at ceylon.modules.jboss.runtime.AbstractJBossRuntime.createRepository(AbstractJBossRuntime.java:107)
    at ceylon.modules.jboss.runtime.AbstractJBossRuntime.createRepository(AbstractJBossRuntime.java:138)
    at ceylon.modules.jboss.runtime.JBossRuntime.createModuleLoader(JBossRuntime.java:31)
    at ceylon.modules.jboss.runtime.AbstractJBossRuntime.loadModule(AbstractJBossRuntime.java:77)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:110)
    at ceylon.modules.Main.execute(Main.java:69)
    at ceylon.modules.Main.main(Main.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.jboss.modules.Module.run(Module.java:270)
    at org.jboss.modules.Main.main(Main.java:294)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:162)
    at com.redhat.ceylon.tools.CeylonTool.run(CeylonTool.java:302)
    at com.redhat.ceylon.tools.CeylonTool.execute(CeylonTool.java:265)
    ... 6 more

Also see discussion on ceylon/ceylon-module-resolver#70

@FroMage
Copy link
Member

FroMage commented Nov 6, 2013

Didn't you fix this already?

@FroMage
Copy link
Member

FroMage commented Nov 6, 2013

Ah no I guess not. Well, unless @alesj can fix this today we'll have to live without it.

@alesj
Copy link
Member

alesj commented Nov 6, 2013

Do you have a test to reproduce this?

@alesj
Copy link
Member

alesj commented Nov 6, 2013

javax.xml::7 -- this is Ceylon only notion.
Before you get into CeylonModuleLoader you cannot know about this.

The way you solve this is to have so called "system" module,
which exposes this package(s).

Let me check if we have something like that already.

@alesj
Copy link
Member

alesj commented Nov 6, 2013

@FroMage
Copy link
Member

FroMage commented Nov 6, 2013

OK, so you're saying this issue is only for our modules, not for other modules loaded by ceylon code that will have module.xml files?

@quintesse
Copy link
Member Author

@alesj It's a Ceylon-only notion, but we'd like it integrated somehow with the runtime. Otherwise we'll have two different systems: people can do import java.base "7" in module.ceylon files, but cannot do the same in module.xml or module.properties files.

The class com.redhat.ceylon.cmr.api.JDKUtils has all the functions necessary to look up the packages belonging to a modules name like java.base.

@alesj
Copy link
Member

alesj commented Nov 6, 2013

Runtime, CMR, etc also uses JBoss Modules to "assemble" itself -- but using only default JBoss Modules things, pretty much similar to Wildfly. Hence it only knows default module.xml stuff.

Whereas Ceylon modules are loaded by custom ModuleLoader, CeylonModuleLoader.
Where the imports / dependencies come from doesn't matter; can be ceylon.import, module.xml, module.properties, etc
Any Ceylon module will understand 'java.base 7'.

To have this before, you would have a chicken-n-egg problem. ;-)

@alesj
Copy link
Member

alesj commented Nov 6, 2013

@FroMage so, yes.

@quintesse
Copy link
Member Author

Well the JDKUtils are completely independent from Ceylon, so I don't see why the same way that we have our own module.properties reader we couldn't have our own XML reader that just turns an import like java.base/7 into the appropriate ExportPath invocations. (not saying we can do it now, it might take some time, but I don't see why it can't be done).

@FroMage
Copy link
Member

FroMage commented Nov 6, 2013

OK, then fair enough, this is not so important if it only applies to our bootstrap modules.

@FroMage
Copy link
Member

FroMage commented Nov 6, 2013

Though perhaps it messes things up for ceylon modules that import our bootstrap modules?

@FroMage
Copy link
Member

FroMage commented Nov 6, 2013

As in, the Ceylon module that imports one of our bootstrap module, will look at its shared imports, and where it should see something like java.base/7 it will see what?

@quintesse
Copy link
Member Author

No, it won't see those because we don't have them defined. That's why it's a less than ideal solution what we have now. Nothing really major I think, but not really correct either.

@gavinking
Copy link
Member

Though perhaps it messes things up for ceylon modules that import our bootstrap modules?

Like @lucaswerkmeister's stuff.

@alesj
Copy link
Member

alesj commented Nov 7, 2013

It shouldn't mess things up imo, as the class(loader) should be the same -- the system classloader.

@FroMage
Copy link
Member

FroMage commented Nov 8, 2013

I mean, they won't see that the modules depend on JDK stuff, but this slips to 1.1 anyways.

@alesj
Copy link
Member

alesj commented Nov 8, 2013

they won't see that the modules depend on JDK stuff

What do you mean by this?

@quintesse
Copy link
Member Author

What do you mean by this?

It means that if you ask for the module's dependencies "javax.xml/7" won't be part of it.

@alesj
Copy link
Member

alesj commented Jun 17, 2014

It depends who uses this module.xml.
If it's JBoss Modules directly, then you need to use that system export feature -- see CMR' module.xml in Runtime.
If it's Ceylon, then it should work, as the CeylonModuleLoader has those semi-hard coded.

@FroMage
Copy link
Member

FroMage commented Sep 25, 2014

Moving to 1.2, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants