显示标签为“weblogic”的博文。显示所有博文
显示标签为“weblogic”的博文。显示所有博文

2014年2月17日星期一

Steps To Solve “bind an object under the name HibernateSessionFactory in the JNDI tree” error | Weblogic

If you are getting errors like below in logs while deploying application or in general then try below mentioned steps to make it working.
<14-Dec-2010 10:41:01 CET> <error> <cluster> <BEA-000123> <Conflict start: Youtried to bind an object under the name in the JNDI tree HibernateSessionFactory. Theobject from 4004698486404642S: hrofserver01: ckm : is not HPOF01_1-clusterable, andyou have tried to bind more than two ounces or more servers from. Such objects canonly be deployed from one server.>
< 14-Dec-2010 10:41:01 CET> <error> <cluster> <BEA-000123> <Conflict start: Youtried to bind an object under the name in the JNDI tree HibernateSessionFactory.From the object-2465366582483676621S: hrofserver02: [7010.7010, -1, -1, -1, -1, -1]ckm: HPOF02_1 is non-clusterable, and you have tried to bind more than two ounces ormore from servers. Such objects can only be deployed from one server.> ”
OR error like below in server logs:
####<Nov 12, 2011 8:34:05 AM CET> <Error> <Cluster> <sun879> <M2> <[ACTIVE] ExecuteThread: ’5′ for queue: ‘weblogic.kernel.Default (self-tuning)’> <> <> <> <1289918045285> <BEA-000123> <Conflict start: You tried to bind an object under the name HibernateSessionFactory in the JNDI tree. The object from 4449434054399910424S:hpof.Server.com:[8001,8001,-1,-1,-1,-1,-1]:hpof.Server.com:8001,hpof1.Server.com:8001:MYEAPAPP:M2 is non-clusterable, and you have tried to bind more than once from two or more servers. Such objects can only be deployed from one server.>
In persistance.xml when the below property is added you will face this issue
<property name="hibernate.session_factory_name">hibernate.SessionFactory</property>
<!-- JNDI bound Session Factory Name -->
Unlike EJB entity beans, Hibernate itself is not clusterable so your application may be doing a JNDI lookup on a cluster JNDI tree which does not exist,
so it will only be pinned to one of your server as stated in the log message.

Please add the below property to persistance.xml to resolve this issue.
<property name="hibernate.jndi.weblogic.jndi.replicateBindings">false</property>

<!-- because SessionFactory is not clusterable -->
By adding this option, there won’t be any cluster communication on the hibernate object and the cluster features won’t be activated.
After updating the xml you have to clean the tmp folder and cache folder and need to do a complete bounce to make it working.

BEA-149500:An exception occurred while registering the MBean null

<Error> <JMX> <BEA-149500> <An exception occurred while registering the MBean null.
java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : com.bea:ServerRuntime=AdminServer,Name=portal,Type=ApplicationRuntime new:weblogic.j2ee.J2EEApplicationRuntimeMBeanImpl@13e959da existing weblogic.j2ee.J2EEApplicationRuntimeMBeanImpl@135ebbc5
        at weblogic.management.jmx.ObjectNameManagerBase.registerObject(ObjectNameManagerBase.java:168)
        at weblogic.management.mbeanservers.internal.WLSObjectNameManager.lookupObjectName(WLSObjectNameManager.java:131)
        at weblogic.management.jmx.modelmbean.WLSModelMBeanFactory.registerWLSModelMBean(WLSModelMBeanFactory.java:87)
        at weblogic.management.mbeanservers.internal.RuntimeMBeanAgent$1.registered(RuntimeMBeanAgent.java:105)
        at weblogic.management.provider.core.RegistrationManagerBase.invokeRegistrationHandlers(RegistrationManagerBase.java:180)
        Truncated. see log file for complete stacktrace

以上错误的原因是新加的一个数据源名称和我们一个项目的名称相同,导致weblogic不能识别2个同名的实例名
并不影响系统的运行,若不想看到这个错误,包项目名称换成别的。h

2012年9月4日星期二

weblogic org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.internal.ast.HqlToken

在WEB-INF目录下建一个weblogic.xml文件,文件中写入如下代码: 


<?xml version="1.0" encoding="UTF-8"?>    
  
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">    
  
<weblogic-web-app>    
  
  <container-descriptor>    
  
    <prefer-web-inf-classes>true</prefer-web-inf-classes>    
  
  </container-descriptor>    
  
</weblogic-web-app>   

说明:prefer-web-inf-classes=true是WebLogic's classloader在有重名类时,优先加载Web应用中WEB-INF内的类
也可以
set PRE_CLASSPATH=D:\oracle\weblogic\wlserver_10.3\server\lib\antlr-2.7.7.jar
http://azurelover.blog.51cto.com/2990964/548988

cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'

Caused by: org.xml.sax.SAXException: zip:D:/oracle/weblogic/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/examsystem-showcase/eymnvq/war/WEB-INF/lib/_wl_cls_gen.jar!/META-INF/orm.xml [Location: Line: 3, C: 138]: org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
        at org.apache.openjpa.lib.meta.XMLMetaDataParser.getException(XMLMetaDataParser.java:656)

 

将orm.xml
改成
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/ormhttp://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
</entity-mappings>

java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode

Caused By: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode;
at org.hibernate.ejb.util.LogHelper.logPersistenceUnitInfo(LogHelper.java:39)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:516)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:352)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:332)

 

 

设置setDomainEnv
windows
@rem Enable JPA 2.0 functionality on WebLogic Server 
set PRE_CLASSPATH=D:\oracle\weblogic\modules\javax.persistence_1.1.0.0_2-0.jar;D:\oracle\weblogic\modules\com.oracle.jpa2support_1.0.0.0_2-1.jar

linux
PRE_CLASSPATH=/oracle/weblogic/modules/javax.persistence_1.0.0.0_2-0-0.jar;/oracle/weblogic/modules/com.oracle.jpa2support_1.0.0.0_2-0.jar
export PRE_CLASSPATH