3 Replies Latest reply on Apr 24, 2013 7:43 AM by Adrian Boangiu

    NoClassDefFoundError for class in jre/lib/ext jar

    Adrian Boangiu Newbie

      Hello,

      I have already tried to get some help for the kind of problem I encounter in the thread https://community.jboss.org/message/809443#809443 (Problem with JBoss JACC Integration Service and jre/lib/ext jars). However, in that thread I specified that I am using the version 7.1.1.Final and the suggestion I have received was to try a 7.2.0 version. Perhaps the suggestion was triggered by my initial message.

      In this thread, I will try to be clearer and to provide additional information regarding the structure of the application and the runtime error since I am able to reproduce the same error in the jboss-eap- 6.1 version and I come to the conclussion that JACC Integration Service is not involved in my problem.

       

      The application I try to migrate to JBoss 7 (coswin8i.war) contains several jars among them the following two contain code relevant for my problem.

      1. CommonLogin.jar contains the following interface:

      package com.siveco.login;

       

      public interface PolicyProviderAdapter

      {

           public Object create( PolicyDescriptor descriptor );

      }

       

      1. JSFLogin.jar contains the following class (its code has been stripped since only the line 39 that is clearly marked is important)

      package com.siveco.jsf.login;

       

      import java.security.Policy;

       

      import net.jini.security.policy.DynamicPolicy;

       

      import com.siveco.login.PolicyDescriptor;

      import com.siveco.login.PolicyProviderAdapter;

       

      public class DynamicPolicyProviderAdapter implements PolicyProviderAdapter

      {

           private String realmName;

       

           public DynamicPolicyProviderAdapter( String realmName )

           {

             this.realmName = realmName;

           }

       

           public Object create( PolicyDescriptor descriptor )

           {

             Policy policy = Policy.getPolicy();

       

             if( policy instanceof DynamicPolicy && ( (DynamicPolicy)policy ).grantSupported() ) /* line 39 */

             {

                /* some code here */

             }

             else

               throw new RuntimeException( "Can't start the JAAS module: Invalid policy: " +

      ( ( policy == null ) ? null : policy.getClass().toString() ) +

      " expecting net.jini.security.policy.DynamicPolicy" );

             return null;

      }

      }

       

      DynamicPolicy is a class in the jsk-policy.jar that is located in the jdk’s jre/lib/ext folder.

      In the previous versions of JBoss (4.2.2, 5.1.0 and 6.1.0) I was able to pass a property to JVM in the JBoss command line:

      -Djava.security.properties=%JBOSS_CONFIG_DIR%/jini.sec.properties

      The purpose of the file jini.sec.properties is to specify the class that has to be used as a policy provider by the java security (in case this is not specified the class sun.security.provider.PolicyFile will be used as stated by default in jdk’s jre/lib/security/java.security). Therefore, jini.sec.properties file contains the following line:

      1. policy.provider=net.jini.security.policy.DynamicPolicyProvider

       

      Using JBoss 6.1 EAP beta (from 19.04.2013) I obtain the following exception at runtime:

      Caused by: java.lang.NoClassDefFoundError: net/jini/security/policy/DynamicPolicy

      at com.siveco.jsf.login.DynamicPolicyProviderAdapter.create(DynamicPolicyProviderAdapter.java:39) [JSFLogin.jar:]

      at com.siveco.jsf.login.JAASPolicyManager.loadPolicy(JAASPolicyManager.java:54) [JSFLogin.jar:]

      at com.siveco.jsf.login.LoginEventHandler.initJAASPolicy(LoginEventHandler.java:720) [JSFLogin.jar:]

      at com.siveco.jsf.login.LoginEventHandler.internalHandleLogin(LoginEventHandler.java:432) [JSFLogin.jar:]

      at com.siveco.jsf.login.LoginEventHandler.handleLogin(LoginEventHandler.java:171) [JSFLogin.jar:]

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

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

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

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

      at com.sun.el.parser.AstValue.invoke(AstValue.java:234) [el-impl-2.2.jar:]

      at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297) [el-impl-2.2.jar:]

      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]

      at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46) [trinidad-api.jar:2.0.0.1.3-SNAPSHOT]

      ... 185 more

      Caused by: java.lang.ClassNotFoundException: net.jini.security.policy.DynamicPolicy from [Module "deployment.coswin8i.war:main" from Service Module Loader]

      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.2.0.CR1-redhat-1]

      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1-redhat-1]

      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1-redhat-1]

      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.2.0.CR1-redhat-1]

      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1-redhat-1]

      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1-redhat-1]

      ... 198 more

       

      Any suggestion to solve this issue is welcome.

      Deliberately, I do not recall here all the attempts I have done to solve the issue (by following “similar” threads or suggestions).

      Thank you,