我正在使用 NetBeans 6.8 和 Glassfish Enterprise Server 2.1.1 ((v2.1 Patch06)(9.1_02 Patch12))(构建 b31g-fcs)。
我创建了一个 servlet 并使用 Netbeans 代码生成功能来实现使用 TopLink (JPA1) 的持久性。
当我尝试使用以下代码创建实体管理器时:
EntityManagerFactory entityManagerFactory=Persistence.createEntityManagerFactory("xyzPU");
EntityManager entityManager=entityManagerFactory.createEntityManager();
我收到以下可怕的异常:
异常 [TOPLINK-7106](Oracle TopLink Essentials - 2.1(Build b31g-fcs (10/19/2009))):oracle.toplink.essentials.exceptions.ValidationException 异常描述:字符串加密过程中遇到错误。 内部异常:java.security.ProviderException:更新()失败 oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:240) oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93) oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:138) oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:132) oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91) ETC...
为了弄清楚发生了什么,我将上面的 2 行代码放入一个带有 main() 方法的新类中(与之前代码所在但在 servlet 之外的相同包)并且一切正常。因此,库导入、配置文件等应该没有问题。此外,我还尝试使用另一个版本的 glassfish(我猜只是一个更轻的版本)运行 servlet,它也运行良好。
谁能解释我发生了什么事?可能与 Glassfish Enterprise Server Edition 的某些设置/配置以及 servlet 环境有关吗?我应该怎么办?