Once more, the code, this time without markup:

Take a service:

public interface MyService {

        public void testMe();
}


And its implementation:

public class MyServiceImpl implements MyService {

        public MyServiceImpl(Collection<MyContribution> config) {
                for (MyContribution contrib: config) {
                        System.err.println("contributed name" + 
contrib.getName());
                }
                
        }
        
        @Override
        public void testMe() {
                System.out.println("Hello World");
        }
}


The contribution class is as follows:

public class MyContribution {

        private String name;
        
        public MyContribution(final String name) {
                this.name = name;
        }
        
        protected String getName() {
                return name;
        }
}


And lives in the same package as the service (ofcourse)

Then bind the service and contribute a class:

binder.bind(MyService.class,MyServiceImpl.class);


 public static void contributeMyService(Configuration<MyContribution>
configuration) {
        configuration.add(new MyContribution("testme"));
    }




When now injecting the service and calling the testMe method , Tapestry
(5.2.6) comes up with:

Caused by: java.lang.RuntimeException: Error invoking constructor public
<package>.MyServiceImpl(java.util.Collection) (for service 'MyService'):
tried to access method <package>.MyContribution.getName()Ljava/lang/String;
from class <package>.MyServiceImpl
        at
org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:76)
        at
org.apache.tapestry5.ioc.internal.ReloadableServiceImplementationObjectCreator.createInstance(ReloadableServiceImplementationObjectCreator.java:52)
        at
org.apache.tapestry5.ioc.internal.AbstractReloadableObjectCreator$1.invoke(AbstractReloadableObjectCreator.java:148)
        at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
        ... 97 more
Caused by: java.lang.IllegalAccessError: tried to access method
<package>.MyContribution.getName()Ljava/lang/String; from class
<package>.MyServiceImpl
        at <package>.MyServiceImpl.<init>(MyServiceImpl.java:12)




Can someone have a look at this?

        

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/TAP5-1233-re-open-java-lang-IllegalAccessError-tp4864790p4867652.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to