-
Notifications
You must be signed in to change notification settings - Fork 5
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
Runtime ClassNotFoundError #35
Comments
My guess - as we've seen this before, some other dependency is missing in "jetty-server", |
Perhaps, but in that case, we need to find a way to unmask these errors, this is important. |
Even when trying to manually and explicitely add in the module descriptor all the transitive depdendencies I can find, the run finished with this error :
Other information : the same code is running inside Eclipse using the flat classpath containing the same jars (except when we have 2 versions of the same module) |
So I found the cause of JBoss modules hiding the exception for us. It tries to load I've no idea how to fix this, but we want this exception propagated rather than swallowed, we're losing info here this is not normal. Perhaps newer versions of JBoss modules don't have that behaviour, but I've no idea. |
Oh, and the |
Which is defined in |
Well, apparently it depends on it but indirectly. |
I pushed the test. |
OK, will have a look asap. |
So can we reasonably assume that Maven artifacts even care about their dependencies at all? This seems to be in favour of @quintesse's opinion that we should make every maven module work in a shared "flat" class loader to mimic their execution on a flat classpath. |
They should care. As, imo, not doing that, would lead to more issues; |
They should, but we can't make the world rewrite their POMs, we need to find a way to either detect and fix broken POMs, or flatten it so that it just works, or allow the users to override POMs. We can point fingers at invalid POMs but that won't make them go away, we have to live with them and make them work. In the case of Camel, that dependency is still not added in the latest version (if it's still required), though I guess we could tell them, but that won't fix other Maven modules. |
What's the issue there? |
It's not optional, it's just missing: http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-server/7.5.4.v20111024/jetty-server-7.5.4.v20111024.pom How do I know why they didn't add it? |
Personally I don't think we should try to fix broken POMs, it's a "feature" of Maven and not something we can do anything about. All the problems mentioned are prob lems of Maven and something that we can accept when importing Maven modules. If in a project you encounter that Maven causes problems we always have the possibility to import the artifacts into Herd and do it right. I don't think we should add a whole bunch of complex heuristics trying to fix things that might not even be fixable.
The issue is that Maven uses a flat class path, so I'm pretty sure there are artifacts out there that depend on the fact that they can just access information from other artifacts without having defined any dependencies. They could even be dynamically loading them so scanning the code wouldn't give us any information to try to "fix" things. That's why I suggested that if Maven uses a flat class path for all its artifacts so should we (for Maven dependencies!) for god knows what kind of things we would be breaking by imposing hierarchical class loading on a system that wasn't designed to support it. |
This was my feeling. Maven is broken. Let's not waste time trying to fix it. |
Weird. |
If it would be flat for 1st level deps, then it would be OK. |
Sure, but that means we can't fix this. But if we would handle all Maven dependencies in a single class loader we could just tell people to add an extra dependency on the missing artifact (even if the project doesn't directly use it) and things would work, right? That way at least we have a work-around.
Why not? I think we're in for a world of hurt if we try to impose our rules on Maven that wasn't designed with this in mind. (But I'll gladly be proven wrong) |
Yes ! This way we would be able to define wrapper libraries with a module |
I'll recap my point of view on this (also after reading Stef's blog item on modules): I think treating Maven dependencies outside of the JBoss Module system would be fine. Just add them to the global JVM class path. Why? Because I don't think the other proposals are viable options. Byte-code analysis is very complex and won't solve all of the problems (eg dynamic class loading), and with user-overridable POMs we pass the problem on to the developer who might not have a clue what is wrong and how to solve it. |
From other discussions around this subject, I'm starting to wonder if that's enough to make a flat classpath for anything Maven. Perhaps we'll need a way to override other module dependencies, especially if we start to have conflicting versions in that flat classpath, because I'm not entirely sure we can produce the same classpath ordering that Maven would produce, and we may end up with the wrong version of a duplicate module first rather than last. Also it's not clear how we can solve the use-case that some Maven modules will attempt to scan the classpath and autoregister/instantiate certain types, based on annotations, like JAX-RS, JPA or CDI. If these Maven modules can't see our Ceylon modules (because those sit outside the Maven CL) then we may need something more. |
BTW I predict that this issue will become the #1 interop issue for our users. It has already been noticed and we've no workaround so far. |
Possibly yes, but I still think we need outside help with this. Although maybe if we do ceylon/ceylon-module-resolver#59 we could lift the handling of Maven modules outside of the JBoss Modules and add them as a flat class path before it. But I'm not even sure if that doable. So discussing this with someone who knows all about JBoss Modules would be nice. |
Yes but is that going to be enough to have a flat classpath for them, that's my question. I'm starting to wonder if we don't need something within the notion of assemblies that @gavinking suggested where we can specify a file that can tweak all the module dependencies, but adding/removing/editing them for every module used by the assembly. Note that we could pass it as command-line argument to the ceylon tools for compilation and running, since that's the closest thing we can call an assembly at the moment. |
Yeah, I read your first messgae after your second one ;) So, first of all, wouldn't Aether help us maintain the correct loading order? If it can't that would definitely suck yes. The part about scanning the classpath makes my head ache >< Tweaking: I don't know, it all seems very dependant on the programmer knowing exactly what they're doing, which defaults the purpose of having a nice module system that suppsedly knows how to figure it out by itself. Now for very special cases, sure, but this issue right here for example should just work without any tweaking, right? |
All Maven issues move to 1.0 |
This is a CMR issue: ceylon/ceylon-module-resolver#81 |
As shown in ceylon/ceylon-compiler#1100 we have a runtime error with the following code:
When I connect to
localhost:8080
(does not fail before I connect), I get:Not sure at all why that is: the
org.eclipse.jetty.server.Connector
class appears to come from thejetty-server
module, which appears to be imported by thecamel-jetty
artifact.The text was updated successfully, but these errors were encountered: