开发者

Weblogic No unique bean of type [javax.persistence.EntityManager]

I am new to EJB3 and working on an exisitng code.

We are using weblogic10.3 and the below code works fine

@Stateless(mappedName="ProcessIssacIncomingMessage")
@TransactionManagement(value=TransactionManagementType.CONTAINER)
@TransactionAttribute(value=TransactionAttributeType.REQUIRED)
@EjbRef(name="Database" jnod-name="Database")

public class IncomingMessageBean implements IncomingMessageRemote, IncomingMessageLocal {
...
@Ejb
private Database<Object> databaseBean;

in 10.3 weblogic.jar has the package weblogic.ejbgen.EjbRef

We now switching over to weblogic10.3.1 and weblogic.jar no longer comes with weblogic.ejbgen package.

So, I changed the code to this (not yet tested in 10.3.1)

@Stateless(mappedName="ProcessIssacIncomingMessage")
@TransactionManagement(value=TransactionManagementType.CO开发者_StackOverflowNTAINER)
@TransactionAttribute(value=TransactionAttributeType.REQUIRED)
@EjbRef(name="Database" jnod-name="Database")  --- removed this line


public class IncomingMessageBean implements IncomingMessageRemote, IncomingMessageLocal {
...
@Ejb(mappedName="Database") -- added the mapped name here.
private Database<Object> databaseBean;

For backward compatibility. After running the code in wl10.3 I get the error

Error is - javax.ejb.EJBTransactionRolledbackException: EJB Exception: : com.bea.core.repackaged.springframework.beans.factory.BeanCreationException: Dependency injection failure: can't find the bean definition about class interface javax.persistence.EntityManager; nested exception is com.bea.core.repackaged.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManager] is defined: No beans of type javax.persistence.EntityManager; owner=com.bea.core.repackaged.springframework.context.support.GenericApplicationContext: display name

Could anyone help, what / how I should refactor the code. OR what is missing here? Such that my code is compatible with both 10.3 and 10.3.1 without using @EjbRef


I figured that the source code was not for 10.3 but some earlier version of weblogic, where in EjbRef was provided by weblogic in weblogic.jar. But as it seems after some version probably 10.3.x onwards weblogic.ejbgen.EjbRef was refactored to a different jar other than weblogic.jar

I did a explode of all jars in server/lib folder and found that same package is available in wls-api.jar

My problem is resolved now. Before I could find this, I had already removed the dependency on the code from using any weblogic specific jar files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜