13 Replies Latest reply on Jan 17, 2013 6:59 AM by gg.svce

    Facing some issues on deploying application on JBoss 7.1.1 Final.

    gg.svce

      Hi All,

       

      i am facing some issues while calling methods for the class which implements @Local interface, which is added as dependency in modules.

       

      Interface:

      package no.messageman.protectoria.core.security;

       

      created jar and added into modules:

       

      import java.util.Collection;

      import java.util.Hashtable;

      import javax.ejb.Local;

      import javax.ejb.Remote;

      @Local

      public interface IRBAC {

          public Hashtable<String, Hashtable<String, Boolean>> loadPermissionMap();

          public Collection<String> loadPublicResourceList();

      }

       

       

      getting Exception on this method:

       

              IRBAC handler = ProtectoriaLookup.instance().getRBACHandler();//returns the proxy vies for that class...

             Hashtable<String, Hashtable<String, Boolean>> permissionObjects = handler.loadPermissionMap(); // Exception arises at this line

              Collection<String> publicResources = handler.loadPublicResourceList();

              ServletContext servletContext = event.getServletContext();

              servletContext.setAttribute(RBACHandler.PERMISSION_MAP_NAME, permissionObjects);

              servletContext.setAttribute(RBACHandler.PUBLIC_RESOURCE_MAP_NAME, publicResources);

       

      Exception:

       

       

      13:47:30,373 INFO  [no.messageman.protectoria.core.contextlistener.InitializeGlobalContext] (MSC service thread 1-4) Charset Cp1252 will be used for sending notification mails.

      13:48:23,575 ERROR [org.jboss.ejb3.invocation] (MSC service thread 1-4) JBAS014134: EJB Invocation failed on component RBACHandler for method public abstract java.util.Hashtable no.messageman.protectoria.core.security.IRBAC.loadPermissionMap(): javax.ejb.EJBException: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at no.messageman.protectoria.core.security.IRBAC$$$view19.loadPermissionMap(Unknown Source) [impjar1.jar:]

                at no.messageman.protectoria.core.security.CacheResourceRoleMapping.contextInitialized(CacheResourceRoleMapping.java:59) [app.jar:]

                at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392)

                at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850)

                at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_21]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_21]

                at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_21]

      Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance

                at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.component.stateless.StatelessSessionComponent$1.create(StatelessSessionComponent.java:66) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.component.stateless.StatelessSessionComponent$1.create(StatelessSessionComponent.java:63) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.pool.AbstractPool.create(AbstractPool.java:60) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.pool.strictmax.StrictMaxPool.get(StrictMaxPool.java:123) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:47) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                ... 29 more

      Caused by: java.lang.NullPointerException

                at org.jboss.seam.intercept.RootInterceptor.init(RootInterceptor.java:47) [jboss-seam.jar:1.2.1.GA-protectoria_JBSEAM-1323_patch]

                at org.jboss.seam.intercept.SessionBeanInterceptor.postConstruct(SessionBeanInterceptor.java:106) [jboss-seam.jar:1.2.1.GA-protectoria_JBSEAM-1323_patch]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_21]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_21]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_21]

                at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_21]

                at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:118) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                ... 37 more

       

      please do suggest??

       

      Thanks in advace.:)

        • 1. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
          jaikiran

          Caused by: java.lang.NullPointerException

                    at org.jboss.seam.intercept.RootInterceptor.init(RootInterceptor.java:47) [jboss-seam.jar:1.2.1.GA-protectoria_JBSEAM-1323_patch]

          There's the problem. Although, that jar name does look a bit weird. It looks like some custom patch. You will have to take a look at that code and see why the NPE is being thrown.

          • 2. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
            gg.svce

            Thanks for the reply Jaikiran:)

             

            I have debug the code and found that while calling the method from handler.loadPermissionMap();, which is using the proxy reference of that interface:

             

            Proxy for view class: no.messageman.protectoria.core.security.IRBAC of EJB: RBACHandler

            which is included in jar and added as module in JBoss 7.1.1 Final module\com folder. when i call this method it threw exception. i am not sure why it throws NPE:

             

            please find attached image below:

            Untitled.png

             

            please do suggest:)

             

            Thanks:)

            • 3. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
              gg.svce

              Hi Jaikiran,

              i have observed it first go into ProxyInvocationHandler and calls invoke method using reflection and on the next line it shows step it shows it do not contain that method, shows in step 1 and two, please find image for the same:

               

              Untitled1.png

               

              please let me know if u have any clu related to this issue....

               

              Thanks:)

              • 4. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                jaikiran

                It's simple actually - you'll just have to find the source for org.jboss.seam.intercept.RootInterceptor and go to line number 47 and what it's doing. Now I don't know where you will find the source for that class because it looks like you have some patched version. You'll have to check with whoever introduced that jar to know about its sources.

                • 5. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                  gg.svce

                  sorry for the reply Jaikiran:)

                   

                  I have added the source code for RootInterceptor and found that the component is null.

                   

                  can you please specify how i can rectify and resolve this issue.

                   

                  image for it as follow:

                   

                  Untitled3.png

                   

                  please do suggest:)

                   

                  Thanks!

                  Gaurav

                  • 6. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                    gg.svce

                    In logs it is showing that the component may intilized already:

                     

                     

                     

                    18:50:38,606 INFO  [org.jboss.seam.Component] (MSC service thread 1-1) Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init

                    18:50:38,620 INFO  [org.jboss.seam.init.Initialization] (MSC service thread 1-1) Installing components...

                    18:50:38,624 INFO  [org.jboss.seam.init.Initialization] (MSC service thread 1-1) done initializing Seam

                    18:50:38,668 INFO  [no.messageman.protectoria.core.contextlistener.InitializeGlobalContext] (MSC service thread 1-1) Charset Cp1252 will be used for sending notification mails.

                    • 7. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                      jaikiran

                      What does the bean implementation class look like?

                      • 8. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                        gg.svce

                        Hi,

                         

                        Class implementing interface:

                         

                        package no.messageman.protectoria.core.security;

                         

                         

                        import java.util.ArrayList;

                        import java.util.Collection;

                        import java.util.Hashtable;

                        import java.util.Iterator;

                        import java.util.List;

                         

                         

                        import javax.ejb.Stateless;

                        import javax.persistence.EntityManager;

                        import javax.persistence.PersistenceContext;

                        import javax.persistence.Query;

                         

                         

                        import org.jboss.seam.ScopeType;

                        import org.jboss.seam.annotations.Name;

                        import org.jboss.seam.annotations.Out;

                        import org.jboss.seam.annotations.Scope;

                         

                         

                        /**

                        *

                        * @author yuvraj_sawant

                        */

                        @Stateless

                        @Name("rbachandler")

                        @Scope(ScopeType.SESSION)

                        public class RBACHandler implements IRBAC {

                         

                         

                            @PersistenceContext

                            private EntityManager em;

                         

                         

                            public static final String PERMISSION_MAP_NAME = "PermissionMap";

                         

                         

                            public static final String PUBLIC_RESOURCE_MAP_NAME = "PublicResourceMap";

                         

                         

                            @Out(required = false)

                            List<Role> roleList;

                         

                            public RBACHandler() {

                                // TODO Auto-generated constructor stub

                            }

                         

                         

                            @Override

                            public Hashtable<String, Hashtable<String, Boolean>> loadPermissionMap() {

                                Query resourceQuery = em.createQuery("select u from Resource u");

                                List<Resource> resourceList = resourceQuery.getResultList();

                         

                         

                                Query permissionQuery = em.createQuery("select u from Permission u");

                                List<Permission> permissionList = permissionQuery.getResultList();

                         

                         

                                Iterator<Resource> resourceIter = resourceList.iterator();

                                Hashtable<String, Hashtable<String, Boolean>> createdPermissionMap = new Hashtable<String, Hashtable<String, Boolean>>();

                         

                         

                                while (resourceIter.hasNext()) {

                                    Resource resource = resourceIter.next();

                                    createdPermissionMap.put(resource.getUrlMapping(), new Hashtable<String, Boolean>());

                                    // List<Permission> permissionListForPerticularResource = new

                                }

                                Iterator<Permission> permissionIter = permissionList.iterator();

                                while (permissionIter.hasNext()) {

                                    Permission permission = permissionIter.next();

                                    String urlMapping = permission.getResource().getUrlMapping();

                                    RoleType role = permission.getRole().getRole();

                                    Hashtable<String, Boolean> presentRscPermLst = createdPermissionMap.get(urlMapping);

                                    presentRscPermLst.put(role.name().toLowerCase(), new Boolean(permission.isAllowedToAccess()));

                                    // List<Permission> permissionListForPerticularResource = new

                                }

                                // em.createQuery(arg0)

                                return createdPermissionMap;

                            }

                            @Override

                            public Collection<String> loadPublicResourceList() {

                                Query permissionQuery = em.createQuery("select u from Permission u where roleId=:rlid and allowedToAccess=:allowed").setParameter("rlid", Role.PUBLIC_ACCESS_ID)

                                        .setParameter("allowed", true);

                                List<Permission> permissionlist = permissionQuery.getResultList();

                                ArrayList<Permission> permissions = new ArrayList<Permission>(permissionlist);

                         

                         

                                Query resourceQuery = em.createQuery("select u from Resource u");

                                List<Resource> resourceList = resourceQuery.getResultList();

                                ArrayList<Resource> resources = new ArrayList<Resource>(resourceList);

                         

                         

                                ArrayList<String> publicResourceList = new ArrayList<String>();

                                for (int rescCnt = 0; rescCnt < resources.size(); rescCnt++) {

                                    Resource resource = resources.get(rescCnt);

                                    for (int permCnt = 0; permCnt < permissions.size(); permCnt++) {

                                        Permission permission = permissions.get(permCnt);

                                        if (resource.getResourceId() == permission.getResourceId()) {

                                            publicResourceList.add(resource.getUrlMapping());

                                        }

                                    }

                                }

                         

                         

                                return publicResourceList;

                            }

                        }

                        i have added the interface (Local) as module in JBoss 7.1.1 Final.

                        • 9. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                          gg.svce

                          please let me know if u have any idea regarding the same??

                           

                          Thanks

                          • 10. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                            gg.svce

                            Hi Jaikiran,

                             

                            please find component.xml, is it some issue related to this xml file???

                            As its not able to load Component..

                             

                            <?xml version="1.0" encoding="UTF-8"?>

                            <components

                                xmlns="http://jboss.com/products/seam/components"

                                xmlns:core="http://jboss.com/products/seam/core"

                                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                xmlns:web="http://jboss.com/products/seam/web"

                                xmlns:pdf="http://jboss.com/products/seam/pdf"

                                xmlns:framework="http://jboss.com/products/seam/framework"

                                xsi:schemaLocation="http://jboss.com/products/seam/core

                                           http://jboss.com/products/seam/core-1.1.xsd

                                           http://jboss.com/products/seam/components

                                           http://jboss.com/products/seam/web

                                           http://jboss.com/products/seam/web-1.2.xsd

                                           http://jboss.com/products/seam/components-1.1.xsd">

                             

                             

                                <core:init

                                    jndi-pattern="java:global/protectoria/app.jar/#{ejbName}"

                                    debug="true" />

                             

                             

                                <core:manager conversation-timeout="1800000" />

                             

                             

                                <web:multipart-filter

                                    create-temp-files="true"

                                    max-request-size="105906176"

                                    url-pattern="*.seam" />

                             

                             

                                <web:context-filter url-pattern="/component/*" />

                             

                             

                                <pdf:documentStore useExtensions="true" errorPage="/pdfMissing.seam" />

                             

                             

                                <pdf:keyStoreConfig keyStore="protectoria.keystore"

                                                    keyStorePassword="storepass"

                                                    keyPassword="keypass"

                                                    keyAlias="protectoria" />

                             

                             

                            </components>

                            please check...and do suggest what can be possible solution for such issues?

                             

                            Thanks in advance:)

                            • 11. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                              nickarls

                              Since the issue appear to be Seam-related, I recommend you take some minimal AS7-tested quickstart example and make that work first, then try throwing in your own components and see what happens.

                              • 12. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                                gg.svce

                                OK !

                                 

                                will try to build some demo project working for jsf 1.2 and will update the result soon...

                                 

                                Thanks for reply Nicklas:)

                                • 13. Re: Facing some issues on deploying application on JBoss 7.1.1 Final.
                                  gg.svce

                                  Hi Jaikiran,

                                   

                                  As i have added @Local interface to module and its dependent class along wid it......should i need to put my implementing class as well to overcome this issue??

                                   

                                  right now i have added only interface to modul (created jar of interface and added in classpath and removed that interface from the application).....is i am going in right direction or change my way of doing it. If i do not add the interface as modul i get class cast exception proxy view of that class.

                                   

                                  i have posted this problem:

                                   

                                  https://community.jboss.org/message/787257#787257

                                   

                                  please do suggest??

                                   

                                  Thanks !