[jira] [Commented] (WICKET-1130) Injection of Bound Instance Fails with Exception

2016-06-03 Thread Jamie Maher (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15314398#comment-15314398
 ] 

Jamie Maher commented on WICKET-1130:
-

This should be fixed in Wicket 7 - see issue WICKET-5922:
https://issues.apache.org/jira/browse/WICKET-5922

> Injection of Bound Instance Fails with Exception
> 
>
> Key: WICKET-1130
> URL: https://issues.apache.org/jira/browse/WICKET-1130
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-guice
>Affects Versions: 1.3.0-beta4
>Reporter: Daniel Spiewak
>Assignee: Igor Vaynberg
>
> If I try to inject an explicitly bound instance into a component, injection 
> fails with an exception in the creation of the CGLIB proxy:
> java.lang.IllegalArgumentException: Superclass has no null constructors but 
> no arguments were given
> Stupidly, I forgot to save the whole stack trace and the code is now gone 
> from my codebase (since I needed it to work).  To repeat:
> @Override
> public void configure() {
> bind(EntityManager.class).toInstance(manager);
> }
> Seems wicket-guice is assuming that it needs to create a new instance of 
> everything that's injected, and since EntityManager doesn't have a no-args 
> constructor, such an action fails.  Just an assumption anyway...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WICKET-1130) Injection of Bound Instance Fails with Exception

2011-04-02 Thread JIRA

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13015067#comment-13015067
 ] 

Marek Ĺ abo commented on WICKET-1130:


This one gave me run for my money, anyway, I did suggested workaround with 
empty constructor but I had to set it to protected, package-private resulted in 
IllegalAccessException. Cheers.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Igor Vaynberg

 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2010-08-09 Thread Eelco Hillenius (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12896730#action_12896730
 ] 

Eelco Hillenius commented on WICKET-1130:
-

@Casper there isn't really a meaningful way to include more as that's specific 
to my app.

The meat of the trick is just this:

{code:java}
final Parameters parameters = new Parameters();
for (Constructor c : originalType.getConstructors()) {
if (c.getParameterTypes().length == 0) {
// ok, we're good, default constructor
break;
} else if (c.getAnnotations().length  0) {
for (Annotation a : c.getAnnotations()) {
if 
(Inject.class.isAssignableFrom(a.getClass())) {
// ah, we have a guice injector
parameters.parameterTypes = 
c.getParameterTypes();
}
}
}
}
if (parameters.parameterTypes != null) {
Object[] dummyArgs = new 
Object[parameters.parameterTypes.length];
for (int i = 0; i  dummyArgs.length; i++) {
dummyArgs[i] = null;
}
parameters.dummyArgs = dummyArgs;
}
{code}

in the else branch of createProxy (which is activated when the type is not a 
primitive or an interface) and then at the end of the method:

{code:java}
Object proxy = null;
if (parameters.parameterTypes == null) {
proxy = e.create();
} else {
proxy = e.create(parameters.parameterTypes,
parameters.dummyArgs);
}
{code}

And then in between those blocks:

{code:java}
Enhancer e = new Enhancer() {
@Override
protected Object firstInstance(Class type) throws Exception {
Object instance = null;
Method setter = type.getDeclaredMethod(
CGLIB$SET_THREAD_CALLBACKS,
new Class[] { Callback[].class });
setter.invoke(null,
new Object[] { new Callback[] { handler 
} });
try {

instance = GuiceComponentInjector.getInjector()
.getInstance(type);
} finally {
setter.invoke(null, new Object[] { null });
}
return instance;
}
};
{code}

which overrides the default behavior of Enhancer by using a Guice Injector 
instance to get the 'first instance' rather than trying to construct it through 
regular Java reflection.

If you'd dig deeper (again sorry I don't have the spare cycles myself), you 
could probably do this neater by writing a custom Enhancer rather than 
extending the current one; you may be able to get around doing the constructor 
arguments introspection to start with if you do that. For now, this code works 
but the main difficulty is where to get the Guice Injector instance from: 
LazyInitProxyFactory currently is independent of which DI framework is used, so 
it'll probably require a API break to get this done properly in Wicket.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
 Fix For: 1.5-M2

 Attachments: GuiceLazyInitProxyFactory.java


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2010-08-04 Thread Caspar MacRae (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12895220#action_12895220
 ] 

Caspar MacRae commented on WICKET-1130:
---



@Eelco would you please attach the rest of the source?

I've only looked at this briefly, but am guessing you've had to refactor back 
from GuiceComponentInjector down to the underlying Inject interface to pass the 
type back.

thanks.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
 Fix For: 1.5-M1

 Attachments: GuiceLazyInitProxyFactory.java


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-09-29 Thread Tuomas Karkkainen (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12635343#action_12635343
 ] 

Tuomas Karkkainen commented on WICKET-1130:
---

Yes, adding the noarg constructor is a solution.  Finding it, based on the 
error message thrown is some trouble, especially given it works when the 
injection is in an injected child.  In our case its a third party class too, 
which adds some trouble for us.

I agree the patch is lousy.


 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.5-M1


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-09-29 Thread Igor Vaynberg (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12635375#action_12635375
 ] 

Igor Vaynberg commented on WICKET-1130:
---

hmm, i gues you were injecting a class, disregard my earlier comment.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.5-M1


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-09-29 Thread Igor Vaynberg (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12635374#action_12635374
 ] 

Igor Vaynberg commented on WICKET-1130:
---

interesting because i thought you were injecting an interface.in which case a 
jdk proxy is used instead of the cglib one

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.5-M1


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-09-26 Thread Tuomas Karkkainen (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12634880#action_12634880
 ] 

Tuomas Karkkainen commented on WICKET-1130:
---

injecting concrete classes without zero argument constructor into wicket 
components fails, even if the injection is properly configured.  

I have this:

public ConcreteClass(String a, String b) { ... }
bind(ConcreteClass.class).toInstance(new ConcreteClass(a,b));

if I have

@Inject
private ConcreteClass concreteClass 

in a wicket component it will not be injected but cglib will complain.  If I 
have it instead in a secondary dependency guice will inject it fine, which is 
confusing. e.g.

public class ConcreteClassHolder {
 @Inject 
 private ConcreteClass concreteClass;
 public getConcreteClass(){...}
}
public class SomethingPanel extends Panel{
 @Inject
 private ConcreteClassHolder concreteClassHolder;
}
 

Instead of confusingly failing, with a Superclass has no null constructors but 
no arguments were given, I would prefer wicket to atleast check for this 
condition in LazyInitProxyFactory:

public static Object createProxy(final Class type, final IProxyTargetLocator 
locator) {
...
return e.create(); 
}

with maybe:

try {
return e.create();
} catch (final IllegalArgumentException iae) {
throw new RuntimeException(Cannot proxy concrete class with no 
zero args constructor here, use an interface or see JIRA issue WICKET-1130.);
}


 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.5-M1


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-09-26 Thread Igor Vaynberg (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12634909#action_12634909
 ] 

Igor Vaynberg commented on WICKET-1130:
---

unfortunately this is a limitation of java/cglb. easiest thing to do is to add 
a package-private noarg constructor to the class. was this the underlying 
reason for your previous troubles?

i cant say that i agree with your patch either, there may be other reasons why 
IllegalArgumentException is thrown from e.create() no?

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.5-M1


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-03-24 Thread Alastair Maw (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12581639#action_12581639
 ] 

Alastair Maw commented on WICKET-1130:
--

This is getting looked at right now. Will keep you posted.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.3.3


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-03-24 Thread Alastair Maw (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12581695#action_12581695
 ] 

Alastair Maw commented on WICKET-1130:
--

So this sort of thing is a limitation in cglib. We need to proxy the class 
using an Enhancer, so that it can be serialized, and the class needs to have a 
zero-arg constructor in order for cglib to be able to do that.

I don't understand why this is failing for you, as you should surely be 
injecting against an interface, in which case this should work just fine.

I.e:
bind(javax.persistence.EntityManager.class).toInstance(hibernateEntityManager) 
or whatever.

So no, this probably isn't ever going to be fixed, as it's pretty much 
impossible to do so.

There are two alternatives:
 - We inject the object, not a proxy. This will either cause serialization 
errors (in your case), or the session size to blow up. Neither sounds good.
 - We get clever about serializing/deserializing pages, and effectively do the 
proxying there. We'd probably need to require annotations for this - it's not 
going to make it in before 1.4.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.3.3


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-03-24 Thread Daniel Spiewak (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12581748#action_12581748
 ] 

Daniel Spiewak commented on WICKET-1130:


Ok, I can happily wait.  I figured it was going to be a bit of a sticky issue, 
but I was still hopeful.

BTW, I'm not injecting an interface but an actual class.  EntityManager is a 
class in ActiveObjects which shares the same name as the interface in JPA (they 
serve almost identical purposes).

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.5-M1


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-03-24 Thread Igor Vaynberg (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12581754#action_12581754
 ] 

Igor Vaynberg commented on WICKET-1130:
---

which is a shame, because if it was an interface it would work just fine :) 
what you can try is adding a package-level default constructor. that way cglib 
can create the subclass and no one outside your api will see it.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.5-M1


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-03-24 Thread Daniel Spiewak (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12581756#action_12581756
 ] 

Daniel Spiewak commented on WICKET-1130:


Thought about that, but there's two problems.  First, it's a public API, so 
even if it is my project I don't want to mess too much with it.  More 
importantly though, the class actually needs those constructor parameters in 
order to do anything useful.  I suppose though that cglib is actually creating 
a delegate proxy, so it would still work.  I wonder if a possible workaround 
would be to derive a class from EntityManager which has a package-private 
default constructor, then bind to this instance.  Would be a bit ugly though 
since every usage of EntityManager in code would have to be changed to use this 
internal deviant.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.5-M1


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-1130) Injection of Bound Instance Fails with Exception

2008-03-22 Thread Igor Vaynberg (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12581286#action_12581286
 ] 

Igor Vaynberg commented on WICKET-1130:
---

it will get looked at whenever Al has time or someone comes up with a patch. i 
think Al is the only one from the core team using guice so the rest of us have 
no idea what the problem is or how to fix it.

 Injection of Bound Instance Fails with Exception
 

 Key: WICKET-1130
 URL: https://issues.apache.org/jira/browse/WICKET-1130
 Project: Wicket
  Issue Type: Bug
  Components: wicket-guice
Affects Versions: 1.3.0-beta4
Reporter: Daniel Spiewak
Assignee: Alastair Maw
 Fix For: 1.3.3


 If I try to inject an explicitly bound instance into a component, injection 
 fails with an exception in the creation of the CGLIB proxy:
 java.lang.IllegalArgumentException: Superclass has no null constructors but 
 no arguments were given
 Stupidly, I forgot to save the whole stack trace and the code is now gone 
 from my codebase (since I needed it to work).  To repeat:
 @Override
 public void configure() {
 bind(EntityManager.class).toInstance(manager);
 }
 Seems wicket-guice is assuming that it needs to create a new instance of 
 everything that's injected, and since EntityManager doesn't have a no-args 
 constructor, such an action fails.  Just an assumption anyway...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.