Glassfish 4, Eclipse IDE 2019-03 – CustomRealm: AppservPasswordLoginModule cannot be resolved to a type

huangapple go评论55阅读模式
英文:

Glassfish 4, Eclipse IDE 2019-03 - CustomRealm: AppservPasswordLoginModule cannot be resolved to a type

问题

我想通过重写安全类来实现自定义领域,但是我遇到了一个错误:
无法将AppservPasswordLoginModule解析为类型
无法解析com.sun.appserv的导入

我按照这篇教程的步骤进行操作:https://computingat40s.wordpress.com/how-to-create-a-custom-realm-in-glassfish-3-1-2-2/

我所做的:

  1. 我创建了一个新的Java项目
  2. 在我的项目中添加了一个新的lib文件夹。
  3. 从$glassfish-installation-folder\glassfish\modules中将security.jar(也尝试过security-ee.jar)复制到lib文件夹
  4. 我在我的.classpath文件中添加了这行:<classpathentry kind="lib" path="lib/security.jar" />
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="lib" path="lib/security.jar" />
	<classpathentry kind="output" path="bin"/>
</classpath>

我还尝试使用Eclipse GUI将jar文件添加到构建路径
注: 我没有使用MAVEN,我也尝试过在其他答案中提到的清理项目

在完成这些步骤后,当我想要用AppservPasswordLoginModule扩展MyCustomModule时,Eclipse会抛出一个错误:点击此处查看图片描述

英文:

I would like to implement a Custom Realm by overriding the security classes but I'm getting an error:
AppservPasswordLoginModule cannot be resolved to a type
The import com.sun.appserv cannot be resolved

I followed the steps from this tutorial: https://computingat40s.wordpress.com/how-to-create-a-custom-realm-in-glassfish-3-1-2-2/

What I did:

  1. I created a new java project
  2. Added a new lib folder to my project.
  3. Copied the security.jar(also tried with security-ee.jar) from $glassfish-installation-folder\glassfish\modules to lib folder
  4. I added this line to my .classpath file: <classpathentry kind="lib" path="lib/security.jar" />
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;classpath&gt;
	&lt;classpathentry kind=&quot;con&quot; path=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot;/&gt;
	&lt;classpathentry kind=&quot;src&quot; path=&quot;src&quot;/&gt;
	&lt;classpathentry kind=&quot;lib&quot; path=&quot;lib/security.jar&quot; /&gt;
	&lt;classpathentry kind=&quot;output&quot; path=&quot;bin&quot;/&gt;
&lt;/classpath&gt;

I also tried to add the jar to build path using Eclipse GUI
NOTES: I'm not using MAVEN, I also tried to clean the project as it was mentioned in other answers

After making this steps Eclipse throws me an arror when I want to extend MyCustomModule with AppservPasswordLoginModule:
enter image description here

答案1

得分: 0

我找到了必须添加到JAVA构建路径的JAR文件:glassfish-ee-api.jar


我通过创建一个新的库来解决了这个问题,我从$glassfish-installation-folder\glassfish\modules中复制了所有的JAR文件。

英文:

UPDATE!

I found the JAR that must be added to JAVA build path: glassfish-ee-api.jar


I solved the problem by creating a new library where I copied all the JARS from $glassfish-installation-folder\glassfish\modules
Photo

huangapple
  • 本文由 发表于 2023年2月8日 20:45:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75385999.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定