Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Althaf Hussain Shaik
Liferay JUnit Project
December 13, 2012 11:04 PM
Answer

Althaf Hussain Shaik

Rank: Junior Member

Posts: 61

Join Date: May 3, 2012

Recent Posts

I am Following the below link to run Liferay Junit Test, Iam getting the foll.exceptions:

http://www.liferay.com/community/wiki/-/wiki/Main/How+to+use+JUnit+to+test+service+in+portlets


1) I am attaching the screen shot for refference in which MyAction.java is missing in this link
2) Any thing we have to write code for impl class which is generated by service builder?

META-INF/portlet-hbm.xml
>>>> configuration hibernate
06:45:05,462 INFO [DialectDetector:71] Determine dialect for MySQL 5
06:45:05,518 INFO [DialectDetector:136] Found dialect org.hibernate.dialect.MySQLDialect
06:45:05,519 INFO [DBFactoryImpl:56] Using dialect null
06:45:05,542 ERROR [DBFactoryImpl:65] java.lang.NullPointerException
java.lang.NullPointerException
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at com.liferay.portal.kernel.util.InstanceFactory.newInstance(InstanceFactory.java:52)
at com.liferay.portal.kernel.util.InstanceFactory.newInstance(InstanceFactory.java:27)
at com.liferay.portal.kernel.util.InstanceFactory.newInstance(InstanceFactory.java:68)
at com.liferay.portal.dao.db.DBFactoryImpl.getDB(DBFactoryImpl.java:59)
at com.liferay.portal.kernel.dao.db.DBFactoryUtil.getDB(DBFactoryUtil.java:25)
at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.newConfiguration(PortalHibernateConfiguration.java:125)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:549)
at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.buildSessionFactory(PortalHibernateConfiguration.java:65)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:630)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:441)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:982)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:878)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:484)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedMap(BeanDefinitionValueResolver.java:378)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:161)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:630)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:441)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:982)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:878)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:484)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)

Regards,
Althaf Hussain.
Attachment

Attachments: JUnit-LR.png (129.0k)
Althaf Hussain Shaik
RE: Liferay JUnit Project
December 14, 2012 1:19 AM
Answer

Althaf Hussain Shaik

Rank: Junior Member

Posts: 61

Join Date: May 3, 2012

Recent Posts

Hi All,

No body tried JUnit Test so far for Liferay. If so give me some suggestions , i am not able to figure out that exception. Any senior guy help me out for this . Then what is the use of formus.
Althaf Hussain Shaik
RE: Liferay JUnit Project
December 14, 2012 1:27 AM
Answer

Althaf Hussain Shaik

Rank: Junior Member

Posts: 61

Join Date: May 3, 2012

Recent Posts

Hi All,

Please atleast go through the exception and give me the suggestion. As it is very urgent and critical for me.
Oliver Bayer
RE: Liferay JUnit Project
December 14, 2012 1:47 AM
Answer

Oliver Bayer

Rank: Liferay Master

Posts: 875

Join Date: February 18, 2009

Recent Posts

Hi Althaf,

looking at the following exception I think it's a misconfiguration of the database connection and not directly a problem of your junit test portlet.
Althaf Hussain:

>>>> configuration hibernate
06:45:05,462 INFO [DialectDetector:71] Determine dialect for MySQL 5
06:45:05,518 INFO [DialectDetector:136] Found dialect org.hibernate.dialect.MySQLDialect
06:45:05,519 INFO [DBFactoryImpl:56] Using dialect null
06:45:05,542 ERROR [DBFactoryImpl:65] java.lang.NullPointerException
java.lang.NullPointerException

HTH Oli
Kailas Lokhande
RE: Liferay JUnit Project
January 3, 2013 9:57 PM
Answer

Kailas Lokhande

Rank: New Member

Posts: 10

Join Date: November 6, 2012

Recent Posts

Extentd your HibernateConfigurationClass with PortalHibernateConfiguration instead of PortletHibernateConfiguration . This will solve your problem.