Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

create portlet

  Asked By: Bastet    Date: Jun 15    Category: Java    Views: 1789
  

i want to create a hibernate-spring portlet for liferay portal based on JSR 286
standard.

but I dont know exactly, the structure of this portlet and the step of create
it.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Anna Hill     Answered On: Jun 15

Try this sample. I found it the best practice for liferay  JSR168-286 or whatever portlets, 'cause most of its portlets is based  on this architecture.

www.liferay.com/.../2030606?_98_redirect=%2Fweb%2Fguest%2Fdownloads%2Fcommunity_plugins%2F-%2Fsoftware_catalog%2Fproducts%3F_98_tabs1TabsScroll%3D%26_98_keywords%3DStruts%26_98_type%3D

and Try Netbeans IDE, it makes the things simpler.

if you need more help, send an email to me. I'm kinda expert about liferay.

 
Answer #2    Answered By: Alexander Fields     Answered On: Jun 15

Is there any body knows why these exceptions occurred in deploying liferay portlet  which uses hibernate-spring service of liferay  .
it is worth to note that it hasnt any problem in liferay5.1.1-tomcat-5.5 server in windows and works fine completely but throws exceptions in linux with similar configuration .


Apr 22, 2009 2:08:26 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jdk1.5.0_12/jre/lib/i386/server:/usr/java/jdk1.5.0_12/jre/lib/i386:/usr/java/jdk1.5.0_12/jre/../lib/i386
Apr 22, 2009 2:08:27 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-9090
Apr 22, 2009 2:08:27 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-443
Apr 22, 2009 2:08:27 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1882 ms
Apr 22, 2009 2:08:28 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 22, 2009 2:08:28 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
Apr 22, 2009 2:08:28 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Loading jar:file:/home/backup/temporary-migration-4.2.5.1/liferay-portal-tomcat-5.5-5.1.1/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
Loading file:/home/backup/temporary-migration-4.2.5.1/liferay-portal-tomcat-5.5-5.1.1/webapps/ROOT/WEB-INF/classes/system-ext.properties
14:08:30,246 INFO [[/]:647] Initializing Spring root WebApplicationContext
Loading jar:file:/home/backup/temporary-migration-4.2.5.1/liferay-portal-tomcat-5.5-5.1.1/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
Loading file:/home/backup/temporary-migration-4.2.5.1/liferay-portal-tomcat-5.5-5.1.1/webapps/ROOT/WEB-INF/classes/portal-ext.properties
AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@152e961)
LogAbandoned: true
RemoveAbandoned: true
RemoveAbandonedTimeout: 60
14:08:45,507 INFO [DynamicDialect:81] Determining dialect for MySQL 5
14:08:45,536 INFO [DynamicDialect:109] Using dialect org.hibernate.dialect.MySQLDialect
14:08:50,966 INFO [PortalImpl:228] portal  lib url /home/backup/temporary-migration-4.2.5.1/liferay-portal-tomcat-5.5-5.1.1/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/util/PortalImpl.class
14:08:50,969 INFO [PortalImpl:263] Portal lib directory /home/backup/temporary-migration-4.2.5.1/liferay-portal-tomcat-5.5-5.1.1/webapps/ROOT/WEB-INF/lib/
Starting Liferay Portal 5.1.1 (Calvin / Build 5101 / August 11, 2008)
14:09:14,910 INFO [ServerDetector:76] Detected server tomcat
14:09:15,063 INFO [HotDeployUtil:76] Initializing hot deploy manager 18524058
14:09:15,587 INFO [AutoDeployDir:76] Auto deploy scanner started for /root/liferay/deploy
14:09:16,674 INFO [LuceneServlet:68] Indexing Lucene on startup
14:09:17,791 INFO [PortletHotDeployListener:201] Registering portlets for PrayerTimes5.1
14:09:18,290 INFO [PortletHotDeployListener:208] 1 portlets for PrayerTimes5.1 are ready for registration
14:09:18,338 INFO [PortletHotDeployListener:284] 1 portlets for PrayerTimes5.1 registered successfully
14:09:19,497 INFO [[/chat-portlet]:647] Initializing Spring root WebApplicationContext
14:09:22,718 FATAL [ConnectionProviderFactory:76] Could not instantiate connection provider
java.lang.ClassCastException: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:73)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at com.liferay.portal.spring.util.SpringUtil.initContext(SpringUtil.java:75)
at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:83)
at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.portalInit(PortalClassLoaderServletContextListener.java:81)
at com.liferay.portal.kernel.util.PortalInitableUtil.init(PortalInitableUtil.java:48)
at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:66)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
14:09:23,132 ERROR [PortalClassLoaderServletContextListener:60] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/data-source-spring.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Could not instantiate connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/data-source-spring.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Could not instantiate connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at com.liferay.portal.spring.util.SpringUtil.initContext(SpringUtil.java:75)
at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:83)
at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.portalInit(PortalClassLoaderServletContextListener.java:81)
at com.liferay.portal.kernel.util.PortalInitableUtil.init(PortalInitableUtil.java:48)
at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:66)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
14:10:36,315 WARN [PortletLocalServiceImpl:155] Portlet not found for 527 65
java.lang.NullPointerException
at com.sps.portal.visitorTracker.service.VisitorLocalServiceUtil.saveOrUpdateVisitor(VisitorLocalServiceUtil.java:87)
at com.sps.portal.service.PersisterService.persistAll(PersisterService.java:62)
at com.sps.portal.service.PersisterService$1.run(PersisterService.java:32)

 
Answer #3    Answered By: Vivian Ruiz     Answered On: Jun 15

Yes you have two version of hibernate classes loaded in your server, you have an instance of one of the loaded org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider class and cast it to another load of this class, which exists in another hibernate jar file.

try to use one version of libaries, sometimes the library in samples are older than the server libraries or vice verse. use them same and preferably a shared library for both.

 
Didn't find what you were looking for? Find more on create portlet Or get search suggestion and latest updates.




Tagged: