Skip to main content

Custom Realms and Classpath

4 replies [Last post]
cowwoc
Offline
Joined: 2003-08-24

Hi,

I followed the steps at http://blogs.sun.com/pblaha/entry/develop_custom_realm_in_netbeans but instead of using their lib directory (which does not work) I placed my jar file in /glassfish/domains/domain1/lib/ext instead. Unfortunately I now get:

java.lang.ClassNotFoundException: com.sun.appserv.security.AppservRealm

I don't want to have to copy my jar file into /glassfish/lib because I will then have to copy the JDBC driver jar as well as any other dependencies into the global classpath. I tried copying appserv-rt.jar into /glassfish/domains/domain1/lib/ext but it then complained about yet another missing dependency. I don't want to copy all of /glassfish/lib into my domain-specific lib.

How can I configure a custom realm such that the realm JAR is in the domain-specific lib directory and the glassfish libraries remain in the global lib directory?

Thank you,
Gili

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
joergwassmer
Offline
Joined: 2004-09-20

I had the same problem.
Solved it by modifying the domain.xml like following:

cowwoc
Offline
Joined: 2003-08-24

This works, but it's no different from copying the Realm JAR into the global lib directory. I don't want to pollute the global classpath.

yolite
Offline
Joined: 2010-02-01

I'm looking for a solution as well that will not require adding the classpath like the solution above (never know where exactly the WAR is installed...). Did you find anything using Glassfish 2?

cowwoc
Offline
Joined: 2003-08-24

By the way, I believe this works perfectly in Glassfish v3 Prelude. I remember placing the Realm jar in /glassfish/domains/domain1/lib and it worked fine. I am expecting Glassfish 2.1 to work the same.

Gili