7 Replies Latest reply on Aug 30, 2007 6:49 AM by Florian Bantner

    can not access a member of class ... with modifiers

    Florian Bantner Newbie

      Hi Forum,

      I'm using SessionBeans with a

      @Destroy
      @Remove
      public void destroy() {
      }

      Method. Seam complains:

      WARN [org.jboss.seam.Component] Exception calling stateful session bean default @Remove method: myBean
      java.lang.RuntimeException: exception invoking: destroy
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:134)
      ...
      Caused by: java.lang.IllegalAccessException: Class org.jboss.seam.util.Reflections can not access a member of class MyBean with modifiers "public"

      This problem puzzles me for hours now. What could it be?

      Best thanks,

      Florian

        • 1. Re: can not access a member of class ... with modifiers
          Fernando Montaño Expert

          Do you have defined such method in the business interface?

          • 2. Re: can not access a member of class ... with modifiers
            Florian Bantner Newbie

            yup. I have:

            public void destroy();

            • 3. Re: can not access a member of class ... with modifiers
              Fernando Montaño Expert

              So, it seems something related with some properties' modifiers.

              I saw something related here:
              http://www.jboss.com/index.html?module=bb&op=viewtopic&t=114028

              • 5. Re: can not access a member of class ... with modifiers
                Florian Bantner Newbie

                Here you are:

                -----------------------------------------------------------

                package de.axone.shop.context;

                import java.util.Locale;

                import javax.ejb.Local;

                import de.axone.shop.client.Client;
                import de.axone.shop.selector.SelectorQuery;
                import de.axone.shop.shop.Shop;
                import de.axone.shop.user.User;

                @Local
                public interface Context {

                public void create();

                public void destroy();

                public Client getClient();
                public Shop getShop();
                public User getUser();
                public Locale getLocale();
                public SelectorQuery getSelectorQuery();
                }

                -----------------------------------------------------------

                package de.axone.shop.context;

                import java.util.Locale;

                import javax.ejb.Remove;
                import javax.ejb.Stateful;

                import org.jboss.seam.ScopeType;
                import org.jboss.seam.annotations.Create;
                import org.jboss.seam.annotations.Destroy;
                import org.jboss.seam.annotations.Name;
                import org.jboss.seam.annotations.Scope;

                import de.axone.shop.client.Client;
                import de.axone.shop.selector.SelectorQuery;
                import de.axone.shop.selector.SelectorQueryImpl;
                import de.axone.shop.shop.Shop;
                import de.axone.shop.user.User;

                @Stateful
                @Scope(ScopeType.EVENT)
                @Name("shopContext")
                class ContextImpl implements Context {

                public ContextImpl(){}

                Client client;
                Locale locale;
                Shop shop;
                User user;

                @Create
                public void create() {
                }

                @Destroy
                @Remove
                public void destroy() {
                }

                @Override
                public Client getClient() {
                return client;
                }

                @Override
                public Shop getShop() {
                return shop;
                }

                @Override
                public User getUser() {
                return user;
                }

                @Override
                public Locale getLocale() {
                return locale;
                }

                protected SelectorQueryImpl cachedSelectorQuery;

                @Override
                public SelectorQuery getSelectorQuery() {

                if( cachedSelectorQuery == null ) {
                cachedSelectorQuery = new SelectorQueryImpl();

                if( client != null )
                cachedSelectorQuery.setItem( "client", client.getName() );
                if( shop != null )
                cachedSelectorQuery.setItem( "shop", shop.getName() );
                if( user != null )
                cachedSelectorQuery.setItem( "user", user.getName() );
                if( user != null )
                cachedSelectorQuery.setItem( "user.no", user.getNo() );
                if( locale != null )
                cachedSelectorQuery.setItem( "language", locale.getLanguage() );
                if( locale != null )
                cachedSelectorQuery.setItem( "country", locale.getCountry()
                .toUpperCase() );
                }
                return cachedSelectorQuery;
                }

                @Override
                public String toString() {

                return getSelectorQuery().toString();
                }

                }

                -----------------------------------------------------------

                And the complete stack trace:

                12:02:23,750 WARN [org.jboss.seam.Component] Exception calling stateful session bean default @Remove method: shopContext
                java.lang.RuntimeException: exception invoking: destroy
                at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:134)
                at org.jboss.seam.Component.callComponentMethod(Component.java:1957)
                at org.jboss.seam.Component.callDefaultRemoveMethod(Component.java:1868)
                at org.jboss.seam.Component.destroy(Component.java:1227)
                at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:251)
                at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:394)
                at org.jboss.seam.contexts.FacesLifecycle.endRequest(FacesLifecycle.java:83)
                at org.jboss.seam.jsf.SeamPhaseListener.afterRender(SeamPhaseListener.java:515)
                at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230)
                at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
                at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
                at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
                at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:63)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                at java.lang.Thread.run(Unknown Source)
                Caused by: java.lang.IllegalAccessException: Class org.jboss.seam.util.Reflections can not access a member of class de.axone.shop.context.ContextImpl with modifiers "public"
                at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
                at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
                ... 47 more


                --------------------


                Florian

                • 7. Re: can not access a member of class ... with modifiers
                  Florian Bantner Newbie

                  oh. ok. I thought it must be something _very_ stupid. Well, it is. I missinterpreted the error message and thougt I had too much and not to less "public". Now its obvious.

                  Thanks very much.

                  Florian