当前位置: 首页 > 知识库问答 >
问题:

无法使CDI在Weblogic 12c、hibernate 5.2.4、hibernate validator/CDI 5.3.1中工作

羿博延
2023-03-14

我的环境:weblogic 12c

使用jpa2.1补丁设置:SET PRE\u CLASSPATH=%MW\u HOME%\oracle\u common\modules\javax。持久性2.1。jar;%MW\U HOME%\wlserver\modules\com。神谕weblogic。jpa21support_1.0.0.0_2-1。罐子

我的ear/APP-INF/lib包含:

hibernate-release-5.2.4.Final/lib/required/*.jar 
hibernate-validator-5.3.1/dist/*.jar and hibernate-validator-5.3.1/dist/lib/required/*

我的persistence.xml:

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
  http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
  version="2.1">
<persistence-unit name="myPersistenceUnit" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>myDataSource</jta-data-source>

我可以使用persistence.xml,并且entityManager可以毫无问题地注入到我的会话bean中。但是,当我在ejb-jar/META-INF中添加beans.xml(以使用CDI)时,我得到:

org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435 Normal scoped bean class org.hibernate.validator.internal.engine.ValidatorImpl is not proxyable because it has no no-args constructor - ValidatorBean [id=org.hibernate.validator.internal.cdi.ValidatorBean_default]. 

我的weblogichtml" target="_blank">应用程序。xml包含:

<prefer-application-packages>       
 <package-name>antlr.*</package-name>
 <package-name>org.hibernate.*</package-name>
 <package-name>org.hibernate.validator.*</package-name>
 <package-name>org.hibernate.validator.internal.cdi.*</package-name>        
 <package-name>javax.validation.*</package-name>
 <package-name>javax.validation.spi.*</package-name>
<package-name>javax.validation.bootstrap.*</package-name>

完成堆栈跟踪:

Exception 0 :
org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435 Normal scoped bean class org.hibernate.validator.internal.engine.ValidatorImpl is not proxyable because it has no no-args constructor - ValidatorBean [id=org.hibernate.validator.internal.cdi.ValidatorBean_default].
    at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:214)
    at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:180)
    at org.jboss.weld.util.Proxies.getUnproxyableTypesExceptionInt(Proxies.java:195)
    at org.jboss.weld.util.Proxies.getUnproxyableTypesException(Proxies.java:169)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:151)
    at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:388)
    at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:371)
    at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
    at com.oracle.injection.provider.weld.WeldInjectionContainer.start(WeldInjectionContainer.java:110)
    at com.oracle.injection.integration.CDIAppDeploymentExtension.initCdi(CDIAppDeploymentExtension.java:76)
    at com.oracle.injection.integration.CDIAppDeploymentExtension.activate(CDIAppDeploymentExtension.java:49)
    at weblogic.application.internal.flow.AppDeploymentExtensionFlow.activate(AppDeploymentExtensionFlow.java:37)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:587)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:339)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:846)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1275)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:442)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:176)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

    at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:398)
    at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:371)
    at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
    at com.oracle.injection.provider.weld.WeldInjectionContainer.start(WeldInjectionContainer.java:110)
    at com.oracle.injection.integration.CDIAppDeploymentExtension.initCdi(CDIAppDeploymentExtension.java:76)
    at com.oracle.injection.integration.CDIAppDeploymentExtension.activate(CDIAppDeploymentExtension.java:49)
    at weblogic.application.internal.flow.AppDeploymentExtensionFlow.activate(AppDeploymentExtensionFlow.java:37)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:587)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:339)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:846)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1275)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:442)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:176)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

我错过了什么?我怎么得到豆子。xml/CDI在这种环境中工作?

共有1个答案

上官自明
2023-03-14

我安装了Weblogic补丁17754607和23744018(Weblogic Server 12.1.3.0.161018)。

并删除:hibernate-validator-5.3.1/dist/*。jar来自我的ear/APP-INF/lib。

Oracle提供的验证罐运行良好-我现在能够使用CDI。

 类似资料:
  • 我正在使用下面的命令检查12C中Weblogic服务器的状态,该命令在10.x Weblogic中正常工作 java weblogic.admin-URL t3:/$IP:$端口getstate-username$username-password$password 我将类路径设置如下导出classpath=$WL_HOME/server/lib/weblogic.jar

  • 我有一个有状态的会话作用域(CDI)EJB,它保存有关用户会话的信息。 现在,我想从一个 我从webapp直接访问EJB(使用注入)到我为JSF使用的bean中(它们也是CDI管理的bean)。 我面临的问题是,似乎与JSF bean处于不同的“会话范围”。创建了两个实例;一个从JSF实例化,另一个从HttpSessionListener实例化。 我尝试通过注入实例注入bean 这个bug报告建议

  • 我正在尝试使用Glassfish 4.0的最新升级版运行一个特别简单的测试用例。我已经尝试将META-INF/beans.xml放在所有可能的排列中,包括它自己在WEB-INF/lib中的jar 我得到的最好的结果是以下错误,后面列出了布局来源: 布局: < code>beans.xml的源: 的源代码: < code>Test.java的源代码: 的来源:

  • 我在我的pc上使用CDI作为jsf的支持bean编写了一个应用程序,该应用程序工作得非常好。 现在我在一台新的pc上设置了所有的东西,安装了glassfish 4.1,通过将安装的jre作为jdk7从glassfish文件夹中设置eclipse kepler。 当我在我的pc上为应用程序创建一个war,并将其部署到另一台pc上的glassfish服务器上时,一切都很好。 它根本无法识别。像CDI是

  • 问题内容: 这是Websphere上@StartupEJB的用户上下文的后续操作 我有以下情况: EJB 1: EJB 2: 简而言之:我有一个EJB,它需要一个角色“ SomeRole”,以及一个用于使用该角色的启动EJB 。 据我了解,这应该工作。 但是,我得到以下异常(类和角色名称已更改为与我的示例匹配): 就我而言,这只是误解吗? 我正在使用WebSphere 8.0.0.9 问题答案:

  • 它有一个servlet和一个JAX-RS资源POJO,两者都运行良好。接下来,我在与servlet和JAX-RS POJO相同的包中创建了一个类: 当我访问POJO的rest路径时,我在Glassfish日志中得到消息: