users@glassfish.java.net

[gf-users] Re: GF v4 coustum realm

From: Tomaz Majerhold <tomaz.majerhold_at_arnes.si>
Date: Fri, 30 May 2014 11:15:10 +0200

Ok, I look to osgi and in my GF in server log I see:

Registered Module: [OSGiModuleImpl:: Bundle =
[si.arnes.glassfish.ArnesRoleRealm [400]], State = [NEW]]
Bundle-SymbolicName: si.arnes.glassfish.ArnesRoleRealm

then when I trying to define custom Realm:

Name : RoleRealm
class: si.arnes.glassfish.ArnesRoleRealm

com.sun.enterprise.security.auth.realm.BadRealmException:
java.lang.ClassNotFoundException: si.arnes.glassfish.ArnesRoleRealm not
found by org.glassfish.main.security [320]

in my jar is si.arnes.glassfish.arnesrolerealm.RoleRealm so I also try:

Name : RoleRealm
class: si.arnes.glassfish.arnesrolerealm.RoleRealm

again error:
com.sun.enterprise.security.auth.realm.BadRealmException:
java.lang.ClassNotFoundException:
si.arnes.glassfish.arnesrolerealm.RoleRealm not found by
org.glassfish.main.security


So I'm totaly lost, beacuse I done it for GF v 3.1.2 and it works, so
mybe is there a BUG in GF v4.

Regards, Tomaž

Dne 30.5.2014 9:24, piše Tomaz Majerhold:
> So my MANIFEST.MF file is:
>
> Manifest-Version: 1.0
> Bnd-LastModified: 1401357152289
> Build-Jdk: 1.7.0_25
> Built-By: Tomaz
> Bundle-Activator: si.arnes.glassfish.rolerealm.Activator
> Bundle-ManifestVersion: 2
> Bundle-Name: true-realm
> Bundle-SymbolicName: true-realm
> Bundle-Version: 2.0.0.SNAPSHOT
> Created-By: Apache Maven Bundle Plugin
> Export-Package: si.arnes.glassfish.truerealm;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.
>
> Regards, Tomaž
>
> Tool: Bnd-2.1.0.20130426-122213
>
> Dne 30.5.2014 8:38, piše Tomaz Majerhold:
>> Thank you, I have done that, I post it on forum
>>
>> https://www.java.net/forum/topic/glassfish/glassfish/glassfish-4-custom-realm
>>
>> My first post was not so exactly written, but on forum I post it in
>> more details, but still getting the same error
>>
>> Martin Gainty, thak you for this link
>> https://netbeans.org/kb/docs/javaee/maven-osgiservice-cdi.html#Exercise_2a
>> I will take a look .
>>
>> Regards, Tomaz
>>
>> Dne 29.5.2014 16:19, piše Martin Gainty:
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>> Date: Thu, 29 May 2014 09:44:40 +0200
>>> From: tomaz.majerhold_at_arnes.si
>>> To: users_at_glassfish.java.net
>>> Subject: [gf-users] Re: GF v4 coustum realm
>>>
>>> If I'm searching in GF 4 directory for this class, I find it:
>>>
>>> GF_HOME\modules\RoleRealm-2.0.jar
>>>
>>> and also in osgi-cache:
>>>
>>> domains\domain1\osgi-cache\felix\bundle393\version0.0
>>>
>>> So whay the hell I'm getting this error
>>> MG>apologies but I don't speak hindi
>>>
>>> java.lang.ClassNotFoundException:
>>> si.arnes.glassfish.rolerealm.RoleRealm not found by
>>> org.glassfish.main.security [320]
>>> MG>the easiest way to get this working is to build a OSGI bundle
>>> MG>then you will want to export out the classes you need later on
>>> (si.arnes.glassfish.rolerealm.RoleRealm )
>>> MG>confirm these classes are exported by interrogating the
>>> export-package in \META-INF\MANIFEST.MF
>>> MG>then to import those in later on just import those classes and
>>> your import in the calling jar your
>>> MG>META-INF\MANIFEST.MF will contain import-package for the just
>>> exported package
>>> MG>By using IDE (netbeans/eclipse) your IDE will generate the
>>> Activator.java necessary to alert
>>> MG>Felix framework that you wish to participate in Felix lifecycle
>>> MG>https://netbeans.org/kb/docs/javaee/maven-osgiservice-cdi.html#Exercise_2a
>>>
>>> Regards, Tomaz
>>> MG>Regards Martin
>>>
>>> Dne 29.5.2014 9:18, piše Tomaz Majerhold:
>>>
>>> 1) GF 4 which osgi version is using in my custom realm I'm using:
>>>
>>> <dependency>
>>> <groupId>org.osgi</groupId>
>>> <artifactId>org.osgi.core</artifactId>
>>> <version>5.0.0</version>
>>> <scope>provided</scope>
>>> </dependency>
>>>
>>> 2) GF 4 which security version is using in my custom realm I'm
>>> using:
>>>
>>> <dependency>
>>> <groupId>org.glassfish.main.security</groupId>
>>> <artifactId>security</artifactId>
>>> <version>4.0</version>
>>> <type>jar</type>
>>> <scope>provided</scope>
>>> </dependency>
>>>
>>> 3) GF 4 which version of AppservPasswordLoginModule is usingin
>>> my custom realm I'm using:
>>>
>>> <dependency>
>>> <groupId>org.glassfish.appclient</groupId>
>>> <artifactId>gf-client</artifactId>
>>> <version>3.2-b06</version>
>>> <scope>provided</scope>
>>> </dependency>
>>>
>>> Any idea why I'm getting this error:
>>> java.lang.ClassNotFoundException:
>>> si.arnes.glassfish.rolerealm.RoleRealm not found by
>>> org.glassfish.main.security [320]
>>>
>>>
>>>
>>> Regards, Tomaz
>>>
>>>
>>> Dne 23.5.2014 13:57, piše Tomaz Majerhold:
>>>
>>> Are big changes of custom realm, I'm gettig this error:
>>>
>>> java.lang.ClassNotFoundException:
>>> si.arnes.glassfish.rolerealm.RoleRealm not found by
>>> org.glassfish.main.security
>>>
>>>
>>> in my logi.conf:
>>>
>>> roleRealm {
>>> si.arnes.glassfish.rolerealm.RolePasswordLoginModule required;
>>> };
>>>
>>>
>>> in modules i have:
>>>
>>> role-realm.jar
>>>
>>> which RolePasswordLoginModule extends AppservPasswordLoginModule
>>> and RoleRealm extends AppservRealm
>>>
>>>
>>> what is wrong here in GF v4, bacuse in GF v3 it work fine??
>>>
>>> Regards, Tomaz
>>>
>>>
>>>
>>
>