Skip to main content

glassfish 4 & custom realm

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
sysmat
Offline
Joined: 2012-05-10

I'm trying to add custom realm as I do it for glassfish 3.1.2, but I'm getting error:
java.lang.ClassNotFoundException: si.arnes.glassfish.rolerealm.RoleRealm not found by org.glassfish.main.security [320]

------------
Environment:
Installed Version: GlassFish Server Open Source Edition 4.0 (build 89)
java 1.7

------------
1) maven:


org.osgi
org.osgi.core
5.0.0
provided


org.glassfish.main.security
security
4.0
jar
provided


org.glassfish.appclient
gf-client
3.2-b06
provided

2) OSGI Activator implements BundleActivator

3) RolePasswordLoginModule extends AppservPasswordLoginModule which override authenticateUser()

4) RoleRealm extends AppservRealm which have @Service(name = "RoleRealm") and overide methods

5) I packaging as bundle with Activator so my MANIFEST.MF:
Manifest-Version: 1.0
Bnd-LastModified: 1401357162759
Build-Jdk: 1.7.0_25
Built-By: Tomaz
Bundle-Activator: si.arnes.glassfish.rolerealm.Activator
Bundle-ManifestVersion: 2
Bundle-Name: RoleRealm
Bundle-SymbolicName: si.arnes.glassfish.role-realm
Bundle-Version: 2.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: si.arnes.glassfish.rolerealm;uses:="com.sun.appserv.secu
rity,com.sun.enterprise.security.auth.realm,javax.security.auth.login,o
rg.jvnet.hk2.annotations,org.osgi.framework";version="2.0.0.SNAPSHOT"
Import-Package: com.sun.appserv.security;version="[3.2,4)",com.sun.enter
prise.security.auth.realm;version="[4.0,5)",javax.security.auth,javax.s
ecurity.auth.login,org.glassfish.security.common;version="[4.0,5)",org.
jvnet.hk2.annotations;version="[2.1,3)",org.osgi.framework;version="[1.
7,2)"
Tool: Bnd-2.1.0.20130426-122213

6) In my jar in META-INF folder I have:

inhabitants\default file that contain:
class=si.arnes.glassfish.rolerealm.RolePasswordLoginModule,index=com.sun.enterprise.security.auth.realm.Realm:RoleRealm

services\javax.security.auth.spi.LoginModule file that contain:
si.arnes.glassfish.rolerealm.RolePasswordLoginModule

7) in login.conf I put:
roleRealm {
si.arnes.glassfish.rolerealm.RolePasswordLoginModule required;
};

8) My jar I put in modules folder my jar, but when I'm define realm

but I'm getting:
java.lang.ClassNotFoundException: si.arnes.glassfish.rolerealm.RoleRealm not found by org.glassfish.main.security [320]

Regards, Tomaz