英文:
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/
我所做的:
- 我创建了一个新的Java项目
- 在我的项目中添加了一个新的lib文件夹。
- 从$glassfish-installation-folder\glassfish\modules中将security.jar(也尝试过security-ee.jar)复制到lib文件夹
- 我在我的.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:
- I created a new java project
- Added a new lib folder to my project.
- Copied the security.jar(also tried with security-ee.jar) from $glassfish-installation-folder\glassfish\modules to lib folder
- I added this line to my .classpath file: <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>
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论