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

Module linkage error #82

Open
FroMage opened this issue Oct 13, 2015 · 13 comments
Open

Module linkage error #82

FroMage opened this issue Oct 13, 2015 · 13 comments

Comments

@FroMage
Copy link
Member

FroMage commented Oct 13, 2015

In ceylon.transaction:

module ceylon.transaction "1.1.1" {
// if I comment this out, I get an error
    //shared import javax.transaction.api "1.2";
    shared import org.jboss.narayana.jta "5.1.1.Final";
}

And its test:

module test.ceylon.transaction "1.1.1" {
    import ceylon.transaction "1.1.1";
}

The definition of org.jboss.narayana.jta:

<module xmlns="urn:jboss:module:1.1" name="org.jboss.jboss-transaction-spi" slot="7.1.1.Final">
  <resources>
    <resource-root path="jboss-transaction-spi-7.1.1.Final.jar"/>
  </resources>
  <dependencies>
    <module name="javax.transaction.api" export="false" slot="1.2"/>
    <module name="org.jboss.logging" export="true" slot="3.1.4.GA"/>
  </dependencies>
</module>

And javax.transaction.api:

<module xmlns="urn:jboss:module:1.1" name="javax.transaction.api" slot="1.2">
    <resources>
        <resource-root path="javax.transaction.api-1.2.jar"/>
    </resources>
</module>

The error I get are:

Debug: Finding class javax.transaction.xa.XAResource from Module "test.ceylon.transaction:1.1.1" from Ceylon ModuleLoader: RootRepositoryManager: FileContentStore: /home/stephane/.ceylon/cache
Debug: Finding local class javax.transaction.xa.XAResource from Module "javax.transaction.api:1.2" from Ceylon ModuleLoader: RootRepositoryManager: FileContentStore: /home/stephane/.ceylon/cache
Debug: Loading class javax.transaction.xa.XAResource locally from Module "javax.transaction.api:1.2" from Ceylon ModuleLoader: RootRepositoryManager: FileContentStore: /home/stephane/.ceylon/cache


Debug: Finding class javax.transaction.xa.XAResource from Module "org.jboss.narayana.jta:5.1.1.Final" from Ceylon ModuleLoader: RootRepositoryManager: FileContentStore: /home/stephane/.ceylon/cache
Warning: Failed to define class com.arjuna.ats.jta.resources.LastResourceCommitOptimisation in Module "org.jboss.narayana.jta:5.1.1.Final" from Ceylon ModuleLoader: RootRepositoryManager: FileContentStore: /home/stephane/.ceylon/cache java.lang.LinkageError: loader constraint violation: loader (instance of ceylon/modules/jboss/runtime/CeylonModuleClassLoader) previously initiated loading for a different type with name "javax/transaction/xa/XAResource"
Debug: Unexpected error in module loader java.lang.LinkageError: loader constraint violation: loader (instance of ceylon/modules/jboss/runtime/CeylonModuleClassLoader) previously initiated loading for a different type with name "javax/transaction/xa/XAResource"
@FroMage FroMage added this to the 1.2 milestone Oct 13, 2015
@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

I guess I'll need some help from @dmlloyd

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

Even an upgrade to the latest 1.4.4.Final does not fix this.

@alesj
Copy link
Member

alesj commented Oct 13, 2015

@FroMage imo, you get that same class XAResource from a module and also from JDK. /Cc @dmlloyd

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

From what I can see in the debugger, the first time it's loaded by the ModuleClassLoader for javax.transaction.api:1.2, which sounds right. The second time it's loaded as a by-product of defining a class (com.arjuna.ats.jta.resources.LastResourceCommitOptimisation) from org.jboss.jboss-transaction-spi where it fails, but no clue why, my debugger just jumps around randomly.

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

@alesj that class is not in the JDK, although its package is.

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

AHA, we're getting somewhere. I told the CeylonModuleLoader (@alesj's creation) that the JDK did not have a javax.transaction module with a javax.transaction.xa package (nobody depended on it explicitly), and it fails to link h2 (another module), which does not have a module descriptor and depended on it implicitly (like everyone depends on the JDK). So I assume that for some reason it used to get that dependency (on the jar) via the JDK auto-import (which is surely wrong).

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

ARG DAMNIT you're right the JDK does have some stuff in javax.transaction.xa. And yes that includes XAResource:

      491  2015-01-27 00:43   javax/transaction/InvalidTransactionException.class
      494  2015-01-27 00:43   javax/transaction/TransactionRequiredException.class
      500  2015-01-27 00:43   javax/transaction/TransactionRolledbackException.class
     1449  2015-01-27 00:42   javax/transaction/xa/XAException.class
     1062  2015-01-27 00:42   javax/transaction/xa/XAResource.class
      292  2015-01-27 00:42   javax/transaction/xa/Xid.class

But my jars need more than this. So how do I resolve this shit?

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

The javax.transaction.api module contains:

      541  2013-10-08 15:44   javax/transaction/Status.class
      483  2013-10-08 15:44   javax/transaction/HeuristicRollbackException.class
      491  2013-10-08 15:44   javax/transaction/InvalidTransactionException.class
      499  2013-10-08 15:44   javax/transaction/TransactionScoped.class
      863  2013-10-08 15:44   javax/transaction/Transactional.class
      292  2013-10-08 15:44   javax/transaction/xa/Xid.class
     1468  2013-10-08 15:44   javax/transaction/xa/XAException.class
     1062  2013-10-08 15:44   javax/transaction/xa/XAResource.class
      195  2013-10-08 15:44   javax/transaction/Synchronization.class
      661  2013-10-08 15:44   javax/transaction/UserTransaction.class
      474  2013-10-08 15:44   javax/transaction/HeuristicMixedException.class
      631  2013-10-08 15:44   javax/transaction/TransactionSynchronizationRegistry.class
      477  2013-10-08 15:44   javax/transaction/HeuristicCommitException.class
      771  2013-10-08 15:44   javax/transaction/Transaction.class
      456  2013-10-08 15:44   javax/transaction/RollbackException.class
      494  2013-10-08 15:44   javax/transaction/TransactionRequiredException.class
      500  2013-10-08 15:44   javax/transaction/TransactionRolledbackException.class
      885  2013-10-08 15:44   javax/transaction/TransactionManager.class
     1366  2013-10-08 15:44   javax/transaction/Transactional$TxType.class
      585  2013-10-08 15:44   javax/transaction/SystemException.class
      463  2013-10-08 15:44   javax/transaction/TransactionalException.class
      468  2013-10-08 15:44   javax/transaction/NotSupportedException.class

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

So it's a superset of the JDK's javax.transaction I suppose.

@alesj
Copy link
Member

alesj commented Oct 13, 2015

Yup, that javax.transactions is some funky shit ...

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

So what am I supposed to do? Exclude some classes from javax.transaction.api so that the JDK parts get picked up? Are they even the same classes?

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

Apparently excluding it is not enough since it excludes it from export, but it's still in the module itself.

@FroMage
Copy link
Member Author

FroMage commented Oct 13, 2015

Nope, I can't win this way. Even if I did manage that, I'd have to make the ceylon module depend on the javax.transaction module from the JDK, but it can't because the compiler does not support split packages. OK at this point it's just too damn complicated to fix, I'll move this to 1.3.

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

No branches or pull requests

2 participants