You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bigcache1 <sh...@gmail.com> on 2012/08/02 18:44:31 UTC
another java.lang.LinkageError (loader constraint violation in
interface itable initialization)
In my application I use the idea if middle data access layers. I implemented
that through the set of different data access objects, which I named
mediators. Each mediator is presented through the interface and implementing
class, which are binded with the Tapestry IoC.
But mediators are referencing each other interfaces in their classes. And
this is where I get this exception when the one class is loaded by different
classloaders. Here is the structure of that references:
TeacherPage.tml calls the tMed.getActiveClients(), where the tMed is
annotated with @Inject. This, first, inject is fine.
TeacherPage.tml:
<html t:type="layout"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter">
<ul t:type="loop" t:source="tMed.activeClients" t:value="tClient">
<li>
${tClient.name}
</li>
</ul>
</html>
TeacherPage.java:
public class TeacherPage {
@Inject
@Property
private TeacherMed tMed; //TeacherMed is the Interface. TeacherMediator is
the implementing class.
@Property
private Client tClient;
}
TeacherMediator.java:
public class TeacherMediator implements TeacherMed {
@Inject
private CrudServiceDAO dao;
@Inject
private ClientMed clientMed; //ClientMed is the interface, and
ClientMediator is the implementing class.
public Teacher unit;
public List<Client> getActiveClients() {
return clientMed.filterByActiveTeacher(unit).getGroup();
}
}
And here, when clientMed is called, exception occurs:
/java.lang.LinkageError
loader constraint violation in interface itable initialization: when
resolving method
"tap.execounting.dal.mediators.ClientMediator.setGroup(Ljava/util/List;)Ltap/execounting/dal/mediators/ClientMediator;"
the class loader (instance of
org/apache/tapestry5/internal/plastic/PlasticClassLoader) of the current
class, tap/execounting/dal/mediators/ClientMediator, and the class loader
(instance of org/mortbay/jetty/webapp/WebAppClassLoader) for interface
tap/execounting/dal/mediators/interfaces/ClientMed have different Class
objects for the type
ounting.dal.mediators.ClientMediator.setGroup(Ljava/util/List;)Ltap/execounting/dal/mediators/ClientMediator;
used in the signature/
http://pastebin.com/kSvHbDqc Full stack. / http://pastebin.com/mWpC37Lw
Tapestry report
I checked/tried the following things:
1) Tried to move classes into different package.
2) Tried to annotate ClientMed as @Environmental.
3) Tried to run the project on the linux, on the mac, on the glassfish
server (which works in another linux)
4) Tried to run with different JREs.
5) Checked the Inject annotation itself. It is correct.
I still want to use IoC concept in that fashion.
Is it right to use tapestry @Inject in such way? Or should I use other IoC
container for the rest (not Pages and Components) of application?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/another-java-lang-LinkageError-loader-constraint-violation-in-interface-itable-initialization-tp5714993.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: another java.lang.LinkageError (loader constraint violation in interface itable initialization)
Posted by Howard Lewis Ship <hl...@gmail.com>.
Absolutely, you typically have services injected into other service implementations.
Sent from my iPad
On Aug 3, 2012, at 10:56 PM, bigcache1 <sh...@gmail.com> wrote:
> I will try to recreate this exception on another page, with another services
> injected.
>
> Is it right, that there is no constraints (except jvm memory) for Tapestry,
> for the level of injection?
> I mean, could we place @Inject, inside of injected service, which lives
> inside another injected service, and so on?
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/another-java-lang-LinkageError-loader-constraint-violation-in-interface-itable-initialization-tp5714993p5715055.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: another java.lang.LinkageError (loader constraint violation in
interface itable initialization)
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sat, 04 Aug 2012 02:56:38 -0300, bigcache1 <sh...@gmail.com>
wrote:
> I will try to recreate this exception on another page, with another
> services
> injected.
>
> Is it right, that there is no constraints (except jvm memory) for
> Tapestry,
> for the level of injection?
Nope. Don't forget that, in Java, all fields which aren't primitive (int,
long, etc) are references (pointers), so there's no nesting, fields of one
object referencing other objects. It's not a tree, it's a graph.
> I mean, could we place @Inject, inside of injected service, which lives
> inside another injected service, and so on?
Yes.
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: another java.lang.LinkageError (loader constraint violation in
interface itable initialization)
Posted by bigcache1 <sh...@gmail.com>.
I will try to recreate this exception on another page, with another services
injected.
Is it right, that there is no constraints (except jvm memory) for Tapestry,
for the level of injection?
I mean, could we place @Inject, inside of injected service, which lives
inside another injected service, and so on?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/another-java-lang-LinkageError-loader-constraint-violation-in-interface-itable-initialization-tp5714993p5715055.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: another java.lang.LinkageError (loader constraint violation in
interface itable initialization)
Posted by bigcache1 <sh...@gmail.com>.
If you mean launching application in production mode - it didn't help. Still
getting the same exception.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/another-java-lang-LinkageError-loader-constraint-violation-in-interface-itable-initialization-tp5714993p5715036.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: another java.lang.LinkageError (loader constraint violation in
interface itable initialization)
Posted by Howard Lewis Ship <hl...@gmail.com>.
This may be a consequence of live class reloading for services, if you
are invoking protected (or package private) methods of other classes.
Try turning live class reloading entirely off; if that fixes the
problem, you can disabled service reloading for the individual
service(s) using the ServiceBinder.
On Thu, Aug 2, 2012 at 9:44 AM, bigcache1 <sh...@gmail.com> wrote:
> In my application I use the idea if middle data access layers. I implemented
> that through the set of different data access objects, which I named
> mediators. Each mediator is presented through the interface and implementing
> class, which are binded with the Tapestry IoC.
> But mediators are referencing each other interfaces in their classes. And
> this is where I get this exception when the one class is loaded by different
> classloaders. Here is the structure of that references:
> TeacherPage.tml calls the tMed.getActiveClients(), where the tMed is
> annotated with @Inject. This, first, inject is fine.
>
> TeacherPage.tml:
> <html t:type="layout"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
> xmlns:p="tapestry:parameter">
> <ul t:type="loop" t:source="tMed.activeClients" t:value="tClient">
> <li>
> ${tClient.name}
> </li>
> </ul>
> </html>
>
> TeacherPage.java:
> public class TeacherPage {
> @Inject
> @Property
> private TeacherMed tMed; //TeacherMed is the Interface. TeacherMediator is
> the implementing class.
>
> @Property
> private Client tClient;
> }
>
> TeacherMediator.java:
> public class TeacherMediator implements TeacherMed {
>
> @Inject
> private CrudServiceDAO dao;
>
> @Inject
> private ClientMed clientMed; //ClientMed is the interface, and
> ClientMediator is the implementing class.
>
> public Teacher unit;
>
> public List<Client> getActiveClients() {
> return clientMed.filterByActiveTeacher(unit).getGroup();
> }
> }
>
> And here, when clientMed is called, exception occurs:
> /java.lang.LinkageError
> loader constraint violation in interface itable initialization: when
> resolving method
> "tap.execounting.dal.mediators.ClientMediator.setGroup(Ljava/util/List;)Ltap/execounting/dal/mediators/ClientMediator;"
> the class loader (instance of
> org/apache/tapestry5/internal/plastic/PlasticClassLoader) of the current
> class, tap/execounting/dal/mediators/ClientMediator, and the class loader
> (instance of org/mortbay/jetty/webapp/WebAppClassLoader) for interface
> tap/execounting/dal/mediators/interfaces/ClientMed have different Class
> objects for the type
> ounting.dal.mediators.ClientMediator.setGroup(Ljava/util/List;)Ltap/execounting/dal/mediators/ClientMediator;
> used in the signature/
> http://pastebin.com/kSvHbDqc Full stack. / http://pastebin.com/mWpC37Lw
> Tapestry report
>
> I checked/tried the following things:
> 1) Tried to move classes into different package.
> 2) Tried to annotate ClientMed as @Environmental.
> 3) Tried to run the project on the linux, on the mac, on the glassfish
> server (which works in another linux)
> 4) Tried to run with different JREs.
> 5) Checked the Inject annotation itself. It is correct.
>
> I still want to use IoC concept in that fashion.
> Is it right to use tapestry @Inject in such way? Or should I use other IoC
> container for the rest (not Pages and Components) of application?
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/another-java-lang-LinkageError-loader-constraint-violation-in-interface-itable-initialization-tp5714993.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
--
Howard M. Lewis Ship
Creator of Apache Tapestry
The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!
(971) 678-5210
http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: another java.lang.LinkageError (loader constraint violation in
interface itable initialization)
Posted by Howard Lewis Ship <hl...@gmail.com>.
On Saturday, September 8, 2012, bigcache1 wrote:
> I found the issue.
> I was referencing the implementing class in the interface, which is to be
> implemented.
>
> Like:
> interface MyInterface{
> public MyImplementation doSomething();
> }
> class MyImplementation implements MyInterface {
> public MyImplementation doSomething();
> }
>
> So it was entirely my fault.
>
> Interesting. What you are doing is unintentional, but valid. It would work
in vanilla Java, but Tapestry's class loading breaks it. Ideally, Tapestry
should identify this and generate a useful exception.
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/another-java-lang-LinkageError-loader-constraint-violation-in-interface-itable-initialization-tp5714993p5716146.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org<javascript:;>
> For additional commands, e-mail: users-help@tapestry.apache.org<javascript:;>
>
>
--
Howard M. Lewis Ship
Creator of Apache Tapestry
The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!
(971) 678-5210
http://howardlewisship.com
Re: another java.lang.LinkageError (loader constraint violation in
interface itable initialization)
Posted by bigcache1 <sh...@gmail.com>.
I found the issue.
I was referencing the implementing class in the interface, which is to be
implemented.
Like:
interface MyInterface{
public MyImplementation doSomething();
}
class MyImplementation implements MyInterface {
public MyImplementation doSomething();
}
So it was entirely my fault.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/another-java-lang-LinkageError-loader-constraint-violation-in-interface-itable-initialization-tp5714993p5716146.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: another java.lang.LinkageError (loader constraint violation in
interface itable initialization)
Posted by bigcache1 <sh...@gmail.com>.
Forgot to mention, mediators interfaces are placed in the
x.y.dal.mediators.interfaces and implementing classes in x.y.dal.mediators
--
View this message in context: http://tapestry.1045711.n5.nabble.com/another-java-lang-LinkageError-loader-constraint-violation-in-interface-itable-initialization-tp5714993p5714994.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org