是否可以让Glassfish JAAS领域与一个已安装的应用程序共享某些类?

时间:2021-08-04 18:03:58

In my company, we're developping an application which stores its data in a Neo4j DB using a semi-custom persistence layer. Using that persistence layer, we declared our security layer using classical classes : User, Group, Privilege and so on.

在我的公司,我们正在开发一个应用程序,它使用半自定义持久层将其数据存储在Neo4j数据库中。使用该持久层,我们使用经典类声明了我们的安全层:User,Group,Privilege等。

These elements are naturally persisted to our Neo4J DB.

这些元素自然地存在于我们的Neo4J DB中。

Unfortunatly, we now want to declare our custom JAAS realm, usign that Neo4J DB as back-end. To write that realm in the fastest possible fashion, we decided to use our application code in that realm (by the grace of a maven <dependency/>).

不幸的是,我们现在想宣布我们的自定义JAAS领域,将Neo4J DB作为后端。为了以尽可能最快的方式编写该领域,我们决定在该领域中使用我们的应用程序代码(通过maven 的优雅)。

Unfortunatly, we have discovered that, when we deploy our JAAS realm, application code fail to load wih various

不幸的是,我们发现,当我们部署JAAS领域时,应用程序代码无法加载各种各样的

java.lang.RuntimeException: EJB Container initialization error 
Exception while loading the app : EJB Container initialization error 

Maybe is it linked to the fact that we deploy our JAAS realm in ${domaindir}/lib ?

也许它与我们在$ {domaindir} / lib中部署JAAS领域的事实有关?

Anyway, is there a solution to have one glassfish JAAS realm share some code with one application deployed in domain ?

无论如何,是否有一个解决方案让一个glassfish JAAS领域与域中部署的一个应用程序共享一些代码?

1 个解决方案

#1


0  

You say that the JAAS classes are deployed to /domain/lib (which seems correct me). I assume that your application classes are deployed as a WAR or EAR.

你说JAAS类被部署到/ domain / lib(这似乎是正确的)。我假设您的应用程序类被部署为WAR或EAR。

If your implementation of the JAAS realm depends on classes that are in the WAR/EAR, you get classloading issues because of classloader hierarchy. The /domain/lib classloader cannot access classes in your WAR/EAR.

如果JAAS领域的实现依赖于WAR / EAR中的类,则由于类加载器层次结构而导致类加载问题。 / domain / lib类加载器无法访问WAR / EAR中的类。

You should extract the depending classes to a separate jar and put them in /domain/lib too.

您应该将依赖类提取到单独的jar中,并将它们放在/ domain / lib中。

See here for more info about the classloader hierarchy: http://docs.oracle.com/cd/E18930_01/html/821-2418/beadf.html

有关classloader层次结构的更多信息,请参见此处:http://docs.oracle.com/cd/E18930_01/html/821-2418/beadf.html

#1


0  

You say that the JAAS classes are deployed to /domain/lib (which seems correct me). I assume that your application classes are deployed as a WAR or EAR.

你说JAAS类被部署到/ domain / lib(这似乎是正确的)。我假设您的应用程序类被部署为WAR或EAR。

If your implementation of the JAAS realm depends on classes that are in the WAR/EAR, you get classloading issues because of classloader hierarchy. The /domain/lib classloader cannot access classes in your WAR/EAR.

如果JAAS领域的实现依赖于WAR / EAR中的类,则由于类加载器层次结构而导致类加载问题。 / domain / lib类加载器无法访问WAR / EAR中的类。

You should extract the depending classes to a separate jar and put them in /domain/lib too.

您应该将依赖类提取到单独的jar中,并将它们放在/ domain / lib中。

See here for more info about the classloader hierarchy: http://docs.oracle.com/cd/E18930_01/html/821-2418/beadf.html

有关classloader层次结构的更多信息,请参见此处:http://docs.oracle.com/cd/E18930_01/html/821-2418/beadf.html