fuwang

           

          2006年12月15日

          Configuring WebLogic 8.1 and Hibernate 3.0

          Configuring WebLogic 8.1 and Hibernate 3.0

          Prakash Malani's Blog | July 21, 2005??04:00 PM | Comments (25)


          Recently, I was asked for step-by-step instructions for configuring Hibernate with WebLogic on bartsandbox. As you may already know, Hibernate is a very popular open source Object Relational Mapping (ORM) tool. Follow these steps to configure Hibernate with WebLogic 8.1.


          • First you create a domain. I created a WebLogic Workshop (WLW) domain, because I am going to use WLW to create and implement the application.
          • Either add hibernate...\lib\antlr-2.7.5H3.jar to the PRE_CLASSPATH or set the query.factory_class property in hibernate.cfg.xml file to user 2.x's query factory.
          • The WLW domain also starts a PointBase database instance. I am going to use this built in instance. I created a new user and schema. I populated the schema with some sample data.
          • In the server instance, you configure a connection pool and a data source. .
          • Create the application. I am going to use WebLogic Workshop to create an application.
          • Where should you put the libraries (jar files) required to successfully run Hibernate? Place the libraries in APP-INF/lib folder of the application. This includes hibernate.jar and additional 3rd party libraries. Refer to table 3-1 of the Hibernate Reference.
          • You create a Java project in WLW. This Java project contains the domain classes that map to the database. WLW compiles this project and puts the resultant jar file into the APP-INF/lib directory. In the Java project code the domain class. You create the Hibernate mapping file as well as the Hibernate configuration file. Additionally, you create the HibenateUtil class by copying the implementation from the Hibernate Reference. The Hibernate configuration file contains the JNDI name of the data source.
          • You create an EJB project (i.e., a module). This project contains session beans. You code a session bean that manipulates the domain class.
          • You create a Web or Web Service project (i.e., a module). This project contains components to interactively test the session beans.

          The complete, working, and self-contained sample application is available here. This includes the schema and all the Hibernate configuration files. (Note: Free membership to bartsandbox is required.)

          In the next few blog entries, I will enhance this basic configuration. In meantime, try out the above steps. Comments, questions, and feedback are most welcome.

          Best regards,
          +prakash

          -----
          My blog (http://dev2dev.bea.com/blog/pmalani/)
          Answers to J2EE, Java, UML, Process, and Patterns! (http://www.bartssandbox.com/)
          Los Angeles BEA Users Group (http://groups.yahoo.com/group/LABEAUG/)


          Comments

          Comments are listed in date ascending order (oldest first) | Post Comment

          • Hi Prakash,

            managed to run the sample application without much problem. It's very useful to have a sample that I can dissect around instead of the usual html article. Thanks!

            There's something that puzzling here. I refer you to Weblogic+Hibernate problem. Though I removed the ant-antlr-1.6.3.jar from APP-INF and re-built the application, I could not reproduce the problem.

            So it seems that the problem happens when you deploy the .ear, you'll run into this class-loading problem. Have you had this problem?

            Posted by: dontrango on July 24, 2005 at 12:49 AM

          • I am very glad that you got the example working.

            Ah... The way to reproduce the problem you describe "CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken" is the following. Don't change anything in the application. Now, execute a query. In updated example, the query is "from Person" inside of the getPersons() method. Hibernate query uses ANTLR and so does WebLogic. ANTRL does Class.forName() instead of using the context class-loader. Therefore, you get the above exception.

            There are at least two ways to solve this problem. One is to use the older query factory that does not use ANTLR. The second is to use put the patched version of ANTLR that ships with Hibernate. Put the patched version of ANTLR in the WebLogic PRE_CLASSPATH.

            I updated to blog entry above to reflect this. Also, I updated the sample application to illustrate this as well.

            Comments, questions, and feedback are most welcome...

            Best regards,
            +prakash

            Posted by: pmalani on July 25, 2005 at 03:44 PM

          • I am glad you found the sample application useful. I hope you will share your experiences in integrating Spring. I will update my blog as well as the sample application with Spring support. So, please stay tuned...

            Thanks for pointing out about getPerson2() method. This relies upon leveraging JNDI for session factory. Stay, tuned for my blog entry (very soon now) that talks about JNDI, JTA, JCA, and JMX. If you find any other anomalies, please don't hesitate to let me know...

            Wishing you the best,
            +prakash

            -----
            My blog (http://dev2dev.bea.com/blog/pmalani/)
            Answers to J2EE, Java, UML, Process, and Patterns! (http://www.bartssandbox.com/)
            Los Angeles BEA Users Group (http://groups.yahoo.com/group/LABEAUG/)

            Posted by: pmalani on July 28, 2005 at 03:01 PM

          • I am very new to this. the example package does not contain the index.jsp in the Webservice WEB-INF directory Please can you provide How i can call the werb service that call the collection of get persons

            Posted by: sbellare on July 29, 2005 at 04:22 PM

          • Assuming all the set-up is done and the server is running, I use the Workshop Test Browser to test it. Open up the DomainManagerService.jws in Workshop and hit the play button. This will lauch the Workshop Test Browser with the following URL: http://localhost:7001/WebServiceProject/test/service/DomainManagerService.jws?.EXPLORE=.TEST You can always go directly to this URL in any browser. From here, I can test the methods of the web-serivce including getPerson() method.

            Best regards,
            +prakash

            -----
            My blog (http://dev2dev.bea.com/blog/pmalani/)
            Answers to J2EE, Java, UML, Process, and Patterns! (http://www.bartssandbox.com/)
            Los Angeles BEA Users Group (http://groups.yahoo.com/group/LABEAUG/)

            Posted by: pmalani on August 01, 2005 at 03:43 PM

          • I am also new to hibernate. I was hoping to stay with 2.x because of the dev tools. Is there any reason this wouldn't work with 2.x ?? thanks

            Posted by: rickyd on August 30, 2005 at 09:45 AM

          • Hibernate 2.x configuration will probably be very similar. What kinds of dev tools you are talking about?

            Hibernate 3.x has been out for some time. I would highly recommend it versus 2.x.

            Best regards,
            +prakash

            -----
            My blog (http://dev2dev.bea.com/blog/pmalani/)
            Answers to J2EE, Java, UML, Process, and Patterns! (http://www.bartssandbox.com/)
            Los Angeles BEA Users Group (http://groups.yahoo.com/group/LABEAUG/)

            Posted by: pmalani on August 30, 2005 at 03:23 PM

          • I was referring to the hbm2java and middlegen tools. I haven't found those for the 3.x version.

            Posted by: rickyd on August 31, 2005 at 07:33 AM

          • Hey just wondering if you were going to also explain how to get Hibernate 3.0 working in Weblogic 9.0 in the future?

            Thanks,

            Mark Wolfe

            Posted by: markwolfe on October 03, 2005 at 10:31 PM

          • Hi Prakash, I'm using WebLogic 9.0 with Hibernate 3.0. I followed your suggestion and placed antlr-2.7.5H3.jar in the PRE_CLASSPATH directory to run my Struts/Hibernate application. But I still got this error: "CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken" which crashes the server. I tried to access your sample, but the notice Yahoo Groups gives me is that I must wait for membership acceptance. My team and I have been working on this problem now for quite a while and will appreciate any and all assistance. Thank you in advance. Regards, Ethelyn

            Posted by: eholmes2@cox.net on November 08, 2005 at 11:16 AM

          • Hi Prakash, Never mind, but I solved the problem by placing antlr-2.7.5H3.jar in a directory I created under my domain server directory and then modifying the classpath in setDomainEnv.cmd. The antlr jarfile must appear in the classpath before the weblogic jarfiles. Thanks, anyway. - Ethelyn

            Posted by: eholmes2@cox.net on November 08, 2005 at 03:59 PM

          • Another workaround for the Hibernate issue "CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken" is to set the Hibernate property "hibernate.query.factory_class" to "org.hibernate.hql.classic.ClassicQueryTranslatorFactory" (in your Spring configuration or in hibernate.properties). http://www.onthoo.com/blog/programming/2005/04/hibernate-moving-day.html)

            Posted by: drujensen on December 13, 2005 at 09:49 AM

          • Hi I am new to hibernate.Please let me know of links working examples of hibernate with weblogic 8.1.I have registered at bartsandbox to get code for sample application,waiting for its approval. Thanks in advance Raju

            Posted by: rkampli123 on March 16, 2006 at 03:14 AM

          • Hi Prakash, I have successfully build an WLW 8.1 application running hibernate 3.1.2 But I have to insert a new WLW project, then use it include and compile the hibernate source code. (Of course, I need to fix some code in order to make them able to be go through the jdk142_05, which is necessary for WLW 8.1) I have also tried to include the following JARs, without insert this new project. antlr.jar cglib.jar asm.jar asm-attrs.jars commons-collections.jar commons-logging.jar hibernate3.jar jta.jar dom4j.jar log4j.jar Then I go the following error: =========================================== javax.ejb.TransactionRolledbackLocalException: EJB Exception: : java.lang.ExceptionInInitializerError Caused by: java.lang.InternalError: erroneous handlers at util.HibernateUtil.getSessionFactory()Lorg.hibernate.SessionFactory;(HibernateUtil.java:53) at security.data.UserProfileStore.store(Ljava.lang.String;Lcom.pccw.esb.security.XUserProfile;)Ljava.lang.String;(UserProfileStore.java:43) . . . . =========================================== (where the UserProfileStore.jara is my homemade application) Have u ever encountered similar error before? Or do u have any suggestion so that I can look into?

            Posted by: rnmanhon on March 20, 2006 at 10:37 PM

          • seem my error start from EhCacheProvider. Error start here ----> Caused by: java.lang.InternalError: erroneous handlers at org.hibernate.cache.EhCacheProvider.start(Ljava.util.Properties;)V(EhCacheProvider.java:??? ) at org.hibernate.impl.SessionFactoryImpl.(Lorg.hibernate.cfg.Configuration;Lorg.hibernat e.engine.Mapping;Lorg.hibernate.cfg.Settings;Lorg.hibernate.event.EventListeners;)V(SessionFactoryImpl .java:172) at org.hibernate.cfg.Configuration.buildSessionFactory()Lorg.hibernate.SessionFactory;(Configu ration.java:1176)

            Posted by: rnmanhon on March 20, 2006 at 10:53 PM

          • Oh, Prakash, My problem is solved after I add back the ehcache-1.1.jar to the Library directory under WLW 8.1. So all JAR that need are: antlr.jar, cglib.jar, asm.jar, asm-attrs.jars, commons-collections.jar, commons-logging.jar, hibernate3.jar, jta.jar, dom4j.jar, log4j.jar, ehcache-1.1.jar

            Posted by: rnmanhon on March 20, 2006 at 11:18 PM

          • Thanks Prakash. Your blog helped me fix the ClassNotFoundException with the hibernate install.

            Posted by: kihatti on April 19, 2006 at 10:43 PM

          • Hi Prakash: I am using Weblogic 7sp4 and trying to integrate with struts 1.1,Hibernate 3.05, and Spring 1.25. I inserted the code below in my C:\bea\weblogic700\common\bin\Commenv.cmd file. Here is how I set my classpath in Commenv.cmd set COMM_WEBLOGIC_CLASSPATH=C:\bea\weblogic700\server\lib\antlr-2.7.5H3.jar;%COMM_JAVA_HOME%\lib\tools.jar;%COMM_WL_HOME%\server;%COMM_WL_HOME%\server\lib\weblogic_sp.jar;%COMM_WL_HOME%\server\lib\weblogic.jar Is this correct. Or is there another way to set classpath for weblogic 7 sp4. Yours, Desperate

            Posted by: jadeite100 on May 29, 2006 at 09:36 AM

          • Hi Prakash: Can you please tell me how to set Hibernate property "hibernate.query.factory_class" to "org.hibernate.hql.classic.ClassicQueryTranslatorFactory" in my Spring's ApplicationContext-app.xml. Thank You. Yours, Desperate.

            Posted by: jadeite100 on May 29, 2006 at 09:41 AM

          • Hi Prakash: I got my web application to work with weblogic 7 sp4, struts 1.1,Hibernate 3.05, and Spring 1.25. I am currently using weblogic 7 sp4 and I have a myserver that has several domain and each domain has several applications. In the startWeblogic.cmd, I have the following code: @rem Call Weblogic Server call "C:\bea\weblogic700\server\bin\startWLS.cmd" In the startWLS.cmd, I have the following: set CLASSPATH=%WL_HOME%\server\lib\antlr-2.7.5H3.jar;%JAVA_HOME%\lib\tools.jar;%WL_HOME%\server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;%CLASSPATH%; My problem is that mydomain called Achievers has several web applications. For the Blanks.war file, I needed to put the following in front of the classpath: %WL_HOME%\server\lib\antlr-2.7.5H3.jar I needed to do it in such a way that it only affects the application called "Blank.war". It cannot affect other applications. Is there a way to do that in Weblogic 7 sp4. Yours, Desperate

            Posted by: jadeite100 on May 29, 2006 at 12:55 PM

          • If you put the jar in the server CLASSPATH, then it affects all the applications. I don't know of way to control so that it will only affect one application.
            Best regards,
            +prakash
            -----
            My blog (http://dev2dev.bea.com/blog/pmalani/)
            Answers to J2EE, Java, UML, Process, and Patterns! (http://www.bartssandbox.com/)
            Los Angeles BEA Users Group (http://groups.yahoo.com/group/LABEAUG/)
            Java Enterprise in a Nutshell (http://www.oreilly.com/catalog/javaentnut3/)

            Posted by: pmalani on June 02, 2006 at 07:21 PM

          • jadeite: I don't know you exact requirement , but creation of managed server for each application may help you, shared domain.

            Posted by: sanjay_kumar.prabhakar@novartis.com on June 13, 2006 at 03:41 PM

          • Hi, I am getting a NullPointerException in hibernate 3.1.2 and 3.1.3 API stack when I do the following to retrieve the list of already persisted ParentTest instances. Criteria crit = getSession().createCriteria(ParentTest.class); crit.list(); I am on WebLogic Integration Server 8.5 (WLI 8.5) and using HSQL DB 1.8.0. Any idea as to what may be causing this issue? Any help would be greatly appreciated as I already spent 2 days on this... Thanks. Below is the source code for ParentTest, Customer and hibernate mapping file. package ca.aol.backlog.core; import ca.aol.backlog.core.Customer; public class ParentTest { //id is required by Hibernate private Long id = null; private String name = null; private Customer customer; ParentTest() { super(); // TODO Auto-generated constructor stub } public ParentTest(String name) { this.name = name; } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } package ca.aol.backlog.core; public class Customer { // id is required by Hibernate private Long id = null; private String name = null; private boolean disabled = false; Customer() { super(); // TODO Auto-generated constructor stub } public Customer(String name) { this.name = name; } public Long getId() { return id; } private void setId(Long id) { this.id = id; } public String getName() { return name; } /** * Once set customer name cannot be modified * @param name */ private void setName(String name) { this.name = name; } public boolean isDisabled() { return disabled; } public void setDisabled(boolean disabled) { this.disabled = disabled; } } Here is the full stack trace. java.lang.NullPointerException at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372) at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121) at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:891) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:859) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266) at org.hibernate.type.EntityType.resolve(EntityType.java:303) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842) at org.hibernate.loader.Loader.doQuery(Loader.java:717) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1552) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at ca.aol.backlog.dao.hibernate.GenericHibernateDAO.findByCriteria(GenericHibernateDAO.java:97) at ca.aol.backlog.dao.hibernate.GenericHibernateDAO.findAll(GenericHibernateDAO.java:61) at ca.aol.backlog.ui.action.test.ShowAllParentAction.execute(ShowAllParentAction.java:23) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at ca.aol.backlog.web.filter.HibernateThreadFilter.doFilter(HibernateThreadFilter.java:47) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6987) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183) Below is my hibernate configuration file. /jdbc/MyHSQL weblogic.jndi.WLInitialContextFactory t3://127.0.0.1:7001 org.hibernate.dialect.HSQLDialect thread org.hibernate.cache.NoCacheProvider true

            Posted by: burakm on June 21, 2006 at 04:28 PM

          • Hi Prakash,

            I am trying to add Caching with hibernate to a Enterprise Application deployed on WLS 8.1.5. I have tried using EHCache on the hibernate3 and the one available separatly. But eveytime i get is following. EHCache is present in the application Lib gave me the same result. Then I have added EHCache to the Weblogic start up classpath as well but haing the same result.
            I have the follwoing lines in the hibernate cfg file.

            net.sf.hibernate.cache.EhCacheProvider ehcache.xml

            ehcache is in the same dir as that of cfg file.

            INFO 20 Jul 2006 11:53:24,493 [11:53:24] (SettingsFactory.java:createCacheProvider:325) - Cache provider: net.sf.hibernate.cache.EhCacheProvider ERROR 20 Jul 2006 11:53:24,509 [11:53:24] (HibernateUtil.java::64) - Initial SessionFactory creation failed. org.hibernate.HibernateException: could not instantiate CacheProvider: net.sf.hibernate.cache.EhCacheProvider at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:330) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:219) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174) at com.hp.bep.component.utils.HibernateUtil.(HibernateUtil.java:59) at com.hp.bep.component.utils.HibernateUtil.getUtil(HibernateUtil.java:77) at com.hp.bep.business.service.session.partservice.PartServiceManagerBean.getSession(PartServiceManagerBean.java:476) at com.hp.bep.business.service.session.partservice.PartServiceManagerBean.getPartServiceItemListfromDB(PartServiceManagerBean.java:261) at com.hp.bep.business.service.session.partservice.PartServiceManagerBean.getPartServiceItemList(PartServiceManagerBean.java:237) at com.hp.bep.business.service.session.partservice.PartServiceManagerBean.renderPartUI(PartServiceManagerBean.java:184) at com.hp.bep.business.service.session.partservice.PartServiceManagerBean_2s69py_EOImpl.renderPartUI(PartServiceManagerBean_2s69py_EOImpl.java:102) at com.hp.bep.presentation.testing.TestBEPAstroGetPartServices.testBEP_PartServiceManagerBean_renderPartUI_05(TestBEPAstroGetPartServices.java:1445) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153) at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119) at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93) at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:117) at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java) at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101) at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:117) at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:117) at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.hp.bep.presentation.common.filters.AuthenticationFilter.doFilter(AuthenticationFilter.java:106) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6987) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

            Caused by: java.lang.ClassNotFoundException: net.sf.hibernate.cache.EhCacheProvider at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:199) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:224) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108) at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:327) ... 43 more

            Posted by: debashish_saha on July 20, 2006 at 12:14 AM

          • Hi I am using the weblogic along with EJB and hibernate I am getting following error EJB Exception: : java.lang.InternalError: erroneous handlers at org.hibernate.cache.EhCacheProvider.start(Ljava.util.Properties;)V(EhCacheProvider.java:???) at org.hibernate.impl.SessionFactoryImpl.(Lorg.hibernate.cfg.Configuration;Lorg.hibernate.engine.Mapping;Lorg.hibernate.cfg.Settings;Lorg.hibernate.event.SessionEventListenerConfig;)V(SessionFactoryImpl.java:157) at org.hibernate.cfg.Configuration.buildSessionFactory()Lorg.hibernate.SessionFactory;(Configuration.java:1043) at com.puc.util.HibernateUtil.getSession()Lorg.hibernate.Session;(HibernateUtil.java:15) at com.puc.dao.user.UserDAO.validate(Lcom.puc.transferobject.UserTO;)Z(UserDAO.java:18) at com.puc.session.user.User.validate(Lcom.puc.transferobject.UserTO;)Z(User.java:86) at com.puc.session.user.User_3c57l6_EOImpl.validate(Lcom.puc.transferobject.UserTO;)Z(User_3c57l6_EOImpl.java:150) at com.puc.session.user.User_3c57l6_EOImpl_CBV.validate(Lcom.puc.transferobject.UserTO;)Z(Unknown Source) at jrockit.reflect.NativeMethodInvoker.invoke0(Ljava.lang.Object;ILjava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source) at jrockit.reflect.NativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source) at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source) at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source) at com.bea.wlw.runtime.core.control.EJBControlImpl.invoke(Ljava.lang.reflect.Method;[Ljava.lang.Object;)Ljava.lang.Object;(EJBControlImpl.jcs:665) at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(DispMethod.java:377) at com.bea.wlw.runtime.core.container.Invocable.invoke(Ljava.lang.Object;Ljava.lang.String;Lcom.bea.wlw.runtime.core.dispatcher.DispMethod;[Ljava.lang.Object;)Ljava.lang.Object;(Invocable.java:423) at com.bea.wlw.runtime.core.container.Invocable.invoke(Lcom.bea.wlw.runtime.core.dispatcher.DispMethod;[Ljava.lang.Object;)Ljava.lang.Object;(Invocable.java:396) at com.bea.wlw.runtime.core.container.Invocable.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.dispatcher.InvokeResult;(Invocable.java:248) at com.bea.wlw.runtime.jcs.container.JcsContainer.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.dispatcher.InvokeResult;(JcsContainer.java:85) at com.bea.wlw.runtime.core.bean.BaseContainerBean.invokeBase(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.dispatcher.InvokeResult;(BaseContainerBean.java:224) at com.bea.wlw.runtime.core.bean.SLSBContainerBean.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.dispatcher.InvokeResult;(SLSBContainerBean.java:103) at com.bea.wlwgen.StatelessContainer_ly05hg_ELOImpl.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.dispatcher.InvokeResult;(StatelessContainer_ly05hg_ELOImpl.java:207) at com.bea.wlwgen.GenericStatelessSLSBContAdpt.invokeOnBean(Ljava.lang.Object;Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.dispatcher.InvokeResult;(GenericStatelessSLSBContAdpt.java:62) at com.bea.wlw.runtime.core.bean.BaseDispatcherBean.runAsInvoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.request.Response;(BaseDispatcherBean.java:153) at com.bea.wlw.runtime.core.bean.BaseDispatcherBean.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.request.Response;(BaseDispatcherBean.java:54) at com.bea.wlw.runtime.core.bean.SyncDispatcherBean.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.request.Response;(SyncDispatcherBean.java:168) at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.request.Response;(SyncDispatcher_k1mrl8_EOImpl.java:100) at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Lcom.bea.wlw.runtime.core.dispatcher.DispFile;Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.request.Response;(Dispatcher.java:161) at com.bea.wlw.runtime.core.dispatcher.ServiceHandleImpl.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Ljava.lang.Object;(ServiceHandleImpl.java:436) at com.bea.wlw.runtime.core.dispatcher.WlwProxyImpl._invoke(Lcom.bea.wlw.runtime.core.request.ExecRequest;)Ljava.lang.Object;(WlwProxyImpl.java:326) at com.bea.wlw.runtime.core.dispatcher.WlwProxyImpl.invoke(Ljava.lang.Object;Ljava.lang.reflect.Method;[Ljava.lang.Object;)Ljava.lang.Object;(WlwProxyImpl.java:315) at $Proxy8.validate(Lcom.puc.transferobject.UserTO;)Z(Unknown Source) at Login.LoginController.login(LLogin.LoginController$LoginForm;)Lcom.bea.wlw.netui.pageflow.Forward;(LoginController.jpf:99) ; nested exception is: java.lang.InternalError: erroneous handlers caused by: : java.lang.InternalError: erroneous handlers

            Posted by: manasshinde on July 21, 2006 at 01:08 AM

          • Configuring WebLogic 8.1 and Hibernate 3.0 - Part II

            Prakash Malani's Blog | July 29, 2005??03:02 PM | Comments (5)


            ?

            My previous blog entry described step-by-step instructions on configuring WebLogic 8.1 with Hibernate 3.0. The response and interest in the entry has been tremendous! In this blog entry, I evaluate advanced configuration where Hibernate leverages WebLogic's implementation of Java Naming and Directory Interface (JNDI), Java Transaction API (JTA), Java Connector Architecture (JCA), and Java Management eXtensions (JMX).

            Let me start with JNDI. Just by naming the SessionFactory in the hibernate.cfg.xml file, Hibernate makes the SessionFactory available in the JNDI. Alas! This does not work for WebLogic. As described here WebLogic JNDI and Hibernate do not play well together. There are multiple workarounds. The workarounds manually bind the SessionFactory with in the JNDI either via a WebLogic startup class or a start-up servlet. However, I was not able to get the SessionFactory instance reliably back from the JNDI. Therefore, a reasonable compromise is to add an accessor for the SessionFactory to the HibernateUtil utility class.

            In order to configure Hibernate to use JTA, I configured transaction.factory_class in the hibernate.cfg.xml file. There are two possible options: org.hibernate.transaction.JTATransactionFactory and org.hibernate.transaction.CMTTransactionFactory. The documentation recommends using the JTATransactionFactory for a bean with Bean Managed Transaction Demarcation (BMTD) and CMTTransactionFactory for a bean with Container Managed Transaction Demarcation (CMTD). The JTATransactionFactory seems more generic of the two transaction factories. It seems to support beans with BMTD as well as CMTD. Therefore, I configured JTATransactionFactory. Additionally, to lookup a transaction in a container-specific way, I configured transaction.manager_lookup_class in the hibernate.cfg.xml file. With this configuration, I do not need to use the Hibernate Transaction API at all as illustrated in the DomainManagerBean.updateWorkPhone() method.

            JCA support for Hibernate is experimental and currently not fully baked for WebLogic. In the future, I can imagine that Hibernate is packaged as Resource ARchive (RAR) file. The Hibernate RAR file is deployed as a resource adapter. The adapter makes the Session available in the JNDI. All the configuration elements are done with the resource adapter (xml file) instead of the hibernate.cfg.xml file or by some other means. Why configure Hibernate using JCA into WebLogic? JCA is designed to encapsulate legacy system's connections, transactions, etc. and make them available in the J2EE world. However, Hibernate is designed from group up to play well in the J2EE world. Therefore, the traditional resource adapter benefits are not fully realized. Once Hibernate is configured as a resource adapter, the coupling of specific applications to Hibernate is weakened a little. Multiple different applications can leverage the same Hibernate resource adapter. The benefits of this configuration will be even more pronounced with the standardization of persistence APIs of Enterprise JavaBeans (EJBs), Hibernate, and Java Data Objects (JDO) with current ongoing EJB 3.0 effort. Theoretically, hot (re)deploying the adapter and changing the persistence implementation is possible.

            Hibernate ships with JMX Management Bean (MBean) implementation. I did not see a way to deploy Hibernate into WebLogic using JMX. What are the benefits of leveraging JMX with Hibernate and WebLogic? I see at least two benefits. One is deployment as well as re-deployment. But, more importantly is being able to monitor Hibernate and obtain statistics. Runtime monitoring from a JMX console is essential for health and caring of a deployed application.

            Please try out these new additional configurations. I have updated the sample application, and it is available here. (Note: Free membership to bartsandbox is required.) I look forward to hearing your experiences on leveraging WebLogic's implementation of JNDI, JTA, JCA, and JMX with Hibernate. Comments, feedback, and questions are most welcome.

            In the future blog, entries I will discuss Spring integration with WebLogic 8.1 as well as Hibernate 3.0. So please stay tuned...

            Best regards,
            +prakash

            -----
            My blog (http://dev2dev.bea.com/blog/pmalani/)
            Answers to J2EE, Java, UML, Process, and Patterns! (http://www.bartssandbox.com/)
            Los Angeles BEA Users Group (http://groups.yahoo.com/group/LABEAUG/)


            ?

            Comments

            Comments are listed in date ascending order (oldest first) | Post Comment

            • I appologize if this question has already been answered. I don't want to use WLW but I do want to use weblogic 8.1sp4. Could you explain how to get Hibernate 3.0 running with WL 8.1sp4 from the linux console, talking to a mysql db. I've got the JDBC pool running, JNDI setup but not tested, Hibernate 3.0 running with ~70% of its JUnit test being successful. If there are specific reasons why you are ".. not comfortable with the dependencies from Java or EJB projects (modules into a Web project (module)." could you please explain them? Cheers, Seth

              Posted by: sethatklipmart on August 17, 2005 at 09:06 AM

            • nevermind. We are going with Spring.

              Posted by: sethatklipmart on August 17, 2005 at 12:08 PM

            • Has anybody been able to deploy hibernate 3.0 to WebLogic 9.0 using the same theory above? Im really interested in finding a way to use the JMX API's to do both deploy's and remote mgmt. Thanks in advance!!

              Posted by: robert.heise on October 13, 2005 at 05:55 PM

            • I am trying to bind the Hibernate 3.0.5 SessionFactory to the Weblogic 8.1 JNDI on the cluster. For this I did the following. 1. Wrote a startup class to instantiate a SessionFactory like this. SessionFactory sessionFactory = new Configuration().configure(cfgFile) .buildSessionFactory(); where cfgfile is a user passed parameter to the startup class and is by default hibernate.cfg.xml. 2. My hibernate.cf.xml looks like this. t3://localhost:7001 weblogic.jndi.WLInitialContextFactory jdbc/myDataSource true org.hibernate.dialect.PointbaseDialect org.hibernate.transaction.CMTTransactionFactory org.hibernate.transaction.WeblogicTransactionManagerLookup 3. I configured the startup class in the Deployment section of Admin Console. Results 1. If this startup class is targeted to one server like the admin server, it binds the SessionFactory to the JNDI tree in the admin server. 2. If this startup class is targeted to the cluster then the startup code runs fine without any fatal exception on all the managed servers but does not bind the SessionFactory to the JNDI name specified in the hibernate.cfg.xml file on either of the managed servers. The only difference I see between the execution of this startup code on a single server as opposed to on a cluster is that I see the following warning message logged by one of the Hibernate classes. "WARN SessionFactoryObjectFactory:101 -InitialContext did not implement EventContext" Has anyone faced a simple problem while starting to bind the SessionFactory to the Weblogic Cluster?

              Posted by: rn056569 on November 16, 2005 at 05:24 PM

            • I am using Weblogic 9.0 and Hibernate 3.0. I have developed a session bean which invokes hibernate object. EJB had been deployed successfully. When the EJB tries to get hold of Hibernate session factory , nothing happens. Also I have defined a datasource in weblogic server by giving JNDI name Could u pl tell me what I have to do to make this work
              Regards
              seshadri

              Posted by: SESHADRI on November 18, 2005 at 12:19 AM

          posted @ 2006-12-15 02:55 扶王 閱讀(1024) | 評論 (0)編輯 收藏

          hibernate3.x的hql不能在weblogic8.1上正確解析的解決方法

          hibernate3.x的hql不能在weblogic8.1上€正確解析的解決方法
          轉載1
          hibernate3.0后hql采用了antlr(ANother Tool for Language Recogition)機制,由于Weblogic默認啟動另外版本的antlr并且不能在啟動后加載其他的antlr包。所以只能在weblogic啟動時強制加載自己的antlr包。weblogic的啟動參數是在startWeblogic.cmd中設置的。我修改該文件:添加 @REM Set hibernate classpath set HIBERNATE_LIB=C:\bea\user_projects\domains\mydomain\applications\embed\WEB-INF\lib 在set CLASSPATH的最前面加上 set CLASSPATH=%HIBERNATE_LIB%\antlr-2.7.6rc1.jar 參考資料如下:錯誤原因: If you get CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken - Hibernate 3.x includes a new query parser that doesn't run on Weblogic - the reason is a packaging error of ANTLR in Weblogic's boot classpath. Read the section in the Hibernate3 Migration Guide. Hibernate建議 Hibernate3 uses ANTLR for the new query parser. Unfortunately BEA Weblogic includes a version of ANTLR in the system classpath which will be loaded before any application libraries and, because Weblogic doesn't seem to support proper class loader isolation, will not see the Hibernate classes in the application's context. BEA seems to solve this issue by prefixing package names, but the distributed ANTLR doesn't have this prefix. Another source for this issue is the usage of Class.forName() in ANTLR itself. Until both parties have solved these issues we can only provide workarounds: Place all your Hibernate and dependent libraries on the application server's boot classpath or use the old query parser as described above.

          轉載2

          在運行過程中出現
          ClassNotFoundException: org.hibernate.hql.ast.HqlToken 錯誤weblogic異常退出。
          原因:
          Hibernate3.0 采用新的基于ANTLR的HQL/SQL查詢翻譯器,在Hibernate的配置文件中,hibernate.query.factory_class屬性用來選擇查詢翻譯器。
          (1)選擇Hibernate3.0的查詢翻譯器:
          hibernate.query.factory_class= org.hibernate.hql.ast.ASTQueryTranslatorFactory
          (2)選擇Hibernate2.1的查詢翻譯器
          hibernate.query.factory_class= org.hibernate.hql.classic.ClassicQueryTranslatorFactory
          為了使用3.0的批量更新和刪除功能,只能選擇(1)否則不能解釋批量更新的語句,當使用的時候出現了不支持條件輸入中文的情況。選擇(2)可以支持輸入中文,但沒法解釋批量更新語句了
          hibernate3中需要用到antlr,然而這個包在weblogic.jar中已經包含了antrl類庫,就會產生一些類加載的錯誤,無法找到在war或者ear中的hibernate3.jar。
          出現這個錯誤之后,antlr會調用System.exit(),這樣weblogic就會中止服務。
          解決方法:
          1.是在hibernate.properties文件中增加屬性:hibernate.query.factory_class,屬性的值是org.hibernate.hql.classic.ClassicQueryTranslatorFactory,這樣就可以解決問題了。
          但是部分功能會有問題,譬如
          但本系在批量刪除和更新會有問題,本系統不采用
          2.將antlr-2.7.5H3.jar到Weblogic的pre_Classpath :用WinRar或Winzip打開C:\bea\weblogic81\server\lib\weblogic.jar 刪除里面的antlr目錄, 然后再antlr-2.7.5H3.jar放在weblogic.jar的同一目錄(注:替換之后沒做做過嚴格測試,尚不知是否有后遺癥)
          3. 1、拷貝Hibernate3里帶的包antlr-2.7.5H3.jar到%WL_HOME%\server\lib下
          2、修改% mydomain% \ startWebLogic.cmd :
          在set CLASSPATH之前加上下面一句:
          set PRE_CLASSPATH=%WL_HOME%\server\lib\antlr-2.7.5H3.jar;
          在set CLASSPATH之后加上下面一句:
          set CLASSPATH=%PRE_CLASSPATH%;%CLASSPATH%

          posted @ 2006-12-15 02:51 扶王 閱讀(926) | 評論 (0)編輯 收藏

          2006年11月8日

          maximo太不可控了

          ??????? 在無demo的開發庫中新建了一個表,然后用應用程序設計器定制了一個界面,保存后運行,點擊進入任何一個app,竟然都報mshtml.dll的錯誤,導致瀏覽器自動關閉。這個錯誤把我害慘了。上次發生這個錯誤時,我以為是自己的IE出了問題,就在網上不停的搜,下補丁、重裝IE等方法都用盡了,都沒能解決。最后還是重裝XP系統后,陰差陽錯給解決的。這次我可不想重裝XP了。我嘗試連demo庫,一點問題都沒有。看樣子是我在新建表上新建app時導致maximo出錯了。我用那一串sql把這個新建的app刪掉,然后重啟weblogic,竟然奇跡般的好了。

          ??????? 感覺maximo有點牽一發而動全身,一個新建的app竟然把整個maximo給弄癱瘓了。現在還沒找到出錯的原因,不知道誰能給解決,總不能一出錯就刪app吧。

          posted @ 2006-11-08 12:06 扶王 閱讀(436) | 評論 (0)編輯 收藏

          2006年9月6日

          使用BigDecimal為何會導致NoSuchMethodError

          用jasperreports1.2.3時,只要一用到BigDecimal類型的variable,就報錯:
          java.lang.NoSuchMethodError: java.math.BigDecimal <init> ( I)V
          可能是jdk版本的問題.升級到jdk1.5就好了,用jdk1.4.2.03還不行.

          posted @ 2006-09-06 08:45 扶王 閱讀(1079) | 評論 (0)編輯 收藏

          2006年8月13日

          Quartz的cron表達式(轉)

          Quartz的cron表達式


          一個cron表達式有至少6個(也可能7個)有空格分隔的時間元素。

          按順序依次為

          秒(0~59)

          分鐘(0~59)

          小時(0~23)

          天(月)(0~31,但是你需要考慮你月的天數)

          月(0~11)

          天(星期)(1~7 1=SUN 或 SUN,MON,TUE,WED,THU,FRI,SAT)

          7.年份(1970-2099)

          其中每個元素可以是一個值(如6),一個連續區間(9-12),一個間隔時間(8-18/4)(/表示每隔4小時),一個列表(1,3,5),通配符。由于"月份中的日期"和"星期中的日期"這兩個元素互斥的,必須要對其中一個設置?.

          0 0 10,14,16 * * ? 每天上午10點,下午2點,4點
          0 0/30 9-17 * * ??? 朝九晚五工作時間內每半小時
          0 0 12 ? * WED 表示每個星期三中午12點

          有些子表達式能包含一些范圍或列表

          例如:子表達式(天(星期))可以為 “MON-FRI”,“MON,WED,FRI”,“MON-WED,SAT”

          “*”字符代表所有可能的值

          因此,“*”在子表達式()里表示每個月的含義,“*”在子表達式(天(星期))表示星期的每一天

          ?

          “/”字符用來指定數值的增量

          例如:在子表達式(分鐘)里的“0/15”表示從第0分鐘開始,每15分鐘

          ?????? ? 在子表達式(分鐘)里的“3/20”表示從第3分鐘開始,每20分鐘(它和“3,23,43”)的含義一樣


          “?”字符僅被用于天(月)和天(星期)兩個子表達式,表示不指定值

          當2個子表達式其中之一被指定了值以后,為了避免沖突,需要將另一個子表達式的值設為“?”

          ?

          “L” 字符僅被用于天(月)和天(星期)兩個子表達式,它是單詞“last”的縮寫

          但是它在兩個子表達式里的含義是不同的。

          在天(月)子表達式中,“L”表示一個月的最后一天

          在天(星期)自表達式中,“L”表示一個星期的最后一天,也就是SAT

          如果在“L”前有具體的內容,它就具有其他的含義了

          例如:“6L”表示這個月的倒數第6天,“FRIL”表示這個月的最一個星期五

          注意:在使用“L”參數時,不要指定列表或范圍,因為這會導致問題

          轉自http://www.aygfsteel.com/xfan/archive/2006/06/14/52801.html?和
          ??????? http://kliweik.spaces.live.com/Blog/cns!1p_cOaBNr-K7UR23IQIXmE0g!105.entry

          posted @ 2006-08-13 05:03 扶王 閱讀(944) | 評論 (0)編輯 收藏

          2006年8月12日

          cvs處理二進制文件的問題

          做的jasperreports報表文件,在我本機運行正常。通過cvs上傳到服務器,別人再下載下來就不能用了。
          不知道折騰了多久,才發現別人下下來的文件大小與我的不一樣,多了100多字節。不知道cvs怎么處理2進制的。為什么報表文件不行,jar包卻可以呢?

          posted @ 2006-08-12 09:52 扶王 閱讀(662) | 評論 (0)編輯 收藏

          僅列出標題  

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 平塘县| 长垣县| 博乐市| 读书| 白银市| 马公市| 怀来县| 衡东县| 叙永县| 德江县| 乃东县| 吴忠市| 图木舒克市| 永德县| 青海省| 喜德县| 龙山县| 余干县| 嘉荫县| 南涧| 小金县| 邹城市| 洞头县| 叶城县| 灵宝市| 沿河| 夏津县| 武义县| 景洪市| 孝义市| 建水县| 曲沃县| 老河口市| 盘锦市| 波密县| 黔东| 手游| 武川县| 涞源县| 东城区| 井陉县|