java.lang.IllegalArgumentException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hibernate always registers JACC event listeners regardless of whether JACC has been enabled or not (by defining the property hibernate.jacc.enabled in the configurations). The JACC even listeners cause exceptions to be thrown in several situations when Hibernate is not running as part of a container. The most common exception I've seen so far is the "java.lang.IllegalArgumentException: unknown handler key" Hibernate should only register the JACC listeners when JACC is enabled. The fix seems to be in the EventListenerConfigurator class. A simple check for the hibernate.jacc.enabled property should be done before adding any of the JACC event listeners (JACCPreDeleteEventListener, JACCPreLoadEventListener, JACCPreUpdateEventListener, JACCPreInsertEventListener). I believe a simple check like if ( properties.containsKey( AvailableSettings.JACC_ENABLED ) ) { ... } should be performed before adding them. In my case these listeners cause exceptions like these to be thrown in a few situations: java.lang.IllegalArgumentException: unknown handler key at javax.security.jacc.PolicyContext.getContext(PolicyContext.java:280) at org.hibernate.secure.JACCPermissions$PolicyContextActions$2.getContextSubject(JACCPermissions.java:111) at org.hibernate.secure.JACCPermissions.getContextSubject(JACCPermissions.java:120) at org.hibernate.secure.JACCPermissions.checkPermission(JACCPermissions.java:59) at org.hibernate.secure.JACCPreLoadEventListener.onPreLoad(JACCPreLoadEventListener.java:53) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:149) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898) ...so I have to manually remove these listeners.
    via by Eduardo Born,
  • Hibernate always registers JACC event listeners regardless of whether JACC has been enabled or not (by defining the property hibernate.jacc.enabled in the configurations). The JACC even listeners cause exceptions to be thrown in several situations when Hibernate is not running as part of a container. The most common exception I've seen so far is the "java.lang.IllegalArgumentException: unknown handler key" Hibernate should only register the JACC listeners when JACC is enabled. The fix seems to be in the EventListenerConfigurator class. A simple check for the hibernate.jacc.enabled property should be done before adding any of the JACC event listeners (JACCPreDeleteEventListener, JACCPreLoadEventListener, JACCPreUpdateEventListener, JACCPreInsertEventListener). I believe a simple check like if ( properties.containsKey( AvailableSettings.JACC_ENABLED ) ) { ... } should be performed before adding them. In my case these listeners cause exceptions like these to be thrown in a few situations: java.lang.IllegalArgumentException: unknown handler key at javax.security.jacc.PolicyContext.getContext(PolicyContext.java:280) at org.hibernate.secure.JACCPermissions$PolicyContextActions$2.getContextSubject(JACCPermissions.java:111) at org.hibernate.secure.JACCPermissions.getContextSubject(JACCPermissions.java:120) at org.hibernate.secure.JACCPermissions.checkPermission(JACCPermissions.java:59) at org.hibernate.secure.JACCPreLoadEventListener.onPreLoad(JACCPreLoadEventListener.java:53) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:149) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898) ...so I have to manually remove these listeners.
    via by Eduardo Born,
    • java.lang.IllegalArgumentException: unknown handler key at javax.security.jacc.PolicyContext.getContext(PolicyContext.java:280) at org.hibernate.secure.JACCPermissions$PolicyContextActions$2.getContextSubject(JACCPermissions.java:111) at org.hibernate.secure.JACCPermissions.getContextSubject(JACCPermissions.java:120) at org.hibernate.secure.JACCPermissions.checkPermission(JACCPermissions.java:59) at org.hibernate.secure.JACCPreLoadEventListener.onPreLoad(JACCPreLoadEventListener.java:53) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:149) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,