Foren

RE: Service Builder Excep

thumbnail
Milen Dyankov, geändert vor 11 Jahren.

RE: Service Builder Excep

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
Could not reserve enough space for object heapError: A fatal exception has occurred. Program will exit

usually means your JDK is trying to reserve more memory than your machine currently has available. It could be that
  • you have too many applications running and consuming too much memory so nothing is left for the JVM.
  • you have set -Xmx to a value higher then your system's available memory.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Service Builder Excep

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
In build-common-plugin.xml file we have to change reduce jvmarg value to
<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx512m" />
then it will work.

thanks milen.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Service Builder Excep

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen

HaveU tried Liferay JUnit example in the below link

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

Example in this link is missing some thing which i am not getting because i am new to this JUnit ., and i am trying sincerely to execute this example by following the steps.

I have implemented the example as it is but i am getting the foll. excep:

META-INF/mail-hbm.xml
META-INF/portal-hbm.xml
META-INF/ext-hbm.xml
META-INF/portlet-hbm.xml
>>>>jack configuration hibernate
>>>>jack configuration hibernate
>>>>jack configuration hibernate
>>>>jack configuration hibernate
12:14:46,112 INFO [main][DialectDetector:71] Determine dialect for MySQL 5
12:14:46,135 INFO [main][DialectDetector:136] Found dialect org.hibernate.dialect.MySQLDialect
12:14:46,135 INFO [main][DBFactoryImpl:56] Using dialect null
12:14:46,138 ERROR [main][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)

I have posted this excep 2-3 times but i am not getting any proper solution.

Please help me out.

Regards,
Althaf Hussain.
thumbnail
Milen Dyankov, geändert vor 11 Jahren.

RE: Service Builder Excep

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
Hmm, I haven't used this but it seems something is wrong with your hibernate / database configuration. DialectDetector can figure out you are using MySQL but later on DBFactoryImpl can not. It tries to get it form hibernate.dialect property which is not set by default and thus the NullPointerException.

Try to manually set
hibernate.dialect=org.hibernate.dialect.MySQLDialect
and see if this helps. If it does, you may want to debug the execution ant try to figure out why it's not discovered by default.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Service Builder Excep Liferay Junit Version

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen,

The example of Liferay Junit wt i am working is in version liferay6.0.6 , but i am trying to execute the same example in Liferay 6.1.1.
1 ) It will not work when the versions get differed?
2) Is there any difference in the foll. files while configuring in the two different versions of liferay :
META-INF/ext-spring.xml,
hibernate-spring.xml,
infrastructure-spring.xml,
portlet-hbm.xml,
portlet-spring.xml ,

If so please let me know.

Regards,
Althaf Hussain.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Service Builder Excep

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Please can any one who implemented Liferay JUnit functionality. Kindly post the example for reference as it is very critical for me to implement.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Service Builder Excep

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi

When I try to deploy my Liferay JUnit portlet I am getting the foll. exception. can any body explain me abt the issue...

Dec 17, 2012 11:09:43 AM org.apache.catalina.startup.HostConfig checkResources
INFO: Reloading context [/TestJunit-portlet]
11:09:43,813 INFO [ExtHotDeployListener:205] Extension environment for TestJunit-portlet will not be undeployed
11:09:43,813 INFO [PortletHotDeployListener:404] Unregistering portlets for TestJunit-portlet
11:09:43,814 INFO [PortletHotDeployListener:435] 1 portlet for TestJunit-portlet was unregistered
Loading file:/C:/Liferay/liferay-portal-6.0.6/tomcat-6.0.29/webapps/TestJunit-portlet/WEB-INF/classes/service.properties
11:09:44,012 ERROR [PortletApplicationContext:80] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Class that bean class [com.jack.service.persistence.PortletHibernateTestConfiguration] depends on not found
Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]
Bean 'liferayHibernateSessionFactory'; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/spring/hibernate/PortalHibernateConfiguration
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Class that bean class [com.jack.service.persistence.PortletHibernateTestConfiguration] depends on not found
Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]
Bean 'liferayHibernateSessionFactory'; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/spring/hibernate/PortalHibernateConfiguration
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:291)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:494)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:396)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:365)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.processBeanDefinition(DefaultBeanDefinitionDocumentReader.java:258)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:153)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at com.liferay.portal.spring.context.PortletApplicationContext.loadBeanDefinitions(PortletApplicationContext.java:69)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:71)
at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:91)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:52)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)

Waiting .....for reply
thumbnail
Milen Dyankov, geändert vor 11 Jahren.

RE: Service Builder Excep

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
Can you please explain what exactly are you doing?

The exception above shows clearly that some classes are missing (not available on your classpath) and there can be many reasons why this can happen. From your original post it seams that you are using Plugins SDK and ServiceBuilder. Later on you state that you are trying to deploy a 6.0.6 plugin to Liferay 6.1.x. This will not work unless you rebuild it with 6.1.x Plugins SDK. On the other hand depending on what APIs you use you may need to modify your code as well.

I'll try to help you as much as I can but I need to understand what exactly are you doing.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

Liferay JUnit Complete Project Docs

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen,

I have prepared the complete documentation, Please find the attachment and kindly resolve the issue. U can contact me to this althafprof@gmail.com also.

I just want to run the JUnit test to this particular attached project. PFA and do the needfull.




Regards,
Althaf Hussain
thumbnail
Milen Dyankov, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
Well, by provide the details, I didn't actually meant send me the whole project ;) I'm sorry but I don't really have the time to set it all up, test it and hope to get the same exception. So let me ask these 2 simple questions:
- Are you using 6.1.0 GA1 or 6.1.1 GA2 ?
- Are you absolutely sure the Plugins SDK version matches the portal version?
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen,

I am using the foll. version:

liferay-portal-tomcat-6.0.6-20110225

liferay-plugins-sdk-6.0.6-20110225

There is no problem with the version i think so, because i am using the same versions. The problem is with configuration files may be, because when i try to deploy the project it is getting deployed with the exceptions. Is there any solution for this simple project to resolve . But i am not getting proper support in the net. That is the only reason i am asking u repeatedly.

Regards,
Althaf Hussain.
thumbnail
Milen Dyankov, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
Do you have portal-impl.jar on your classpath?
Also please see if this wiki page http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+Testing+Infrastructure can give you some ideas.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
I have deleted portal-impl.jar from my web-inf/lib because it is already available in server . once i put the portal-impl.jar in web-inf/lib and i deploy then it is giving the msg to delete that jar file. Any ways thanks for your support.
thumbnail
Milen Dyankov, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
Do you have the Spring context listener set up in you web.xml file ? If not, try adding this:

<listener>
   <listener-class>com.liferay.portal.kernel.spring.context.PortletContextLoaderListener</listener-class>
</listener>
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
In web.xml i haven`t done any thing. okay i will try.

Thanks............a lot
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen,

I have added listener tag in web.xml

<listener>
<listener-class>com.liferay.portal.kernel.spring.context.PortletContextLoaderListener</listener-class>
</listener>

still it is showing the foll.exception:

Dec 18, 2012 2:53:21 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Reloading context [/TestPortlet-portlet]
14:53:21,833 INFO [ExtHotDeployListener:205] Extension environment for TestPortlet-portlet will not be undeployed
Loading file:/C:/Liferay/liferay-portal-6.0.6/tomcat-6.0.29/webapps/TestPortlet-portlet/WEB-INF/classes/service.properties
14:53:22,402 ERROR [PortletApplicationContext:80] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Class that bean class [com.test.testportlet.service.impl.EmployeeLocalServiceImpl] depends on not found
Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]
Bean 'com.test.testportlet.service.EmployeeLocalService'; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/service/PersistedModelLocalService
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Class that bean class [com.test.testportlet.service.impl.EmployeeLocalServiceImpl] depends on not found
Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]
Bean 'com.test.testportlet.service.EmployeeLocalService'; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/service/PersistedModelLocalService
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)

Can u please suggest me wt will be the issue...

Thanks,
Althaf Hussain
thumbnail
Milen Dyankov, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
The PersistedModelLocalService is only available since version 6.1.x. How come that your 6.0.6 plug-in is trying to use it?
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Complete Project Docs

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen

Can u please give me a quick reply. My portlet is deploying successfully before ...suddenly it is not getting deployed and it is showing the foll. exceptions

06:04:15,308 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:177] Processing JUnitPortlet-portlet-6.1.1.1.war
06:04:15,309 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][PortletAutoDeployListener:77] Copying portlets for D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\deploy\JUnitPortlet-portlet-6.1.1.1.war
06:04:15,310 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:763] Deploying JUnitPortlet-portlet-6.1.1.1.war
06:04:15,354 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:859] Updating JUnitPortlet from version 6.1.1.1 to version 6.1.1.1
Expanding: D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\deploy\JUnitPortlet-portlet-6.1.1.1.war into D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\20121221060415354
Copying 1 file to D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\20121221060415354\WEB-INF
Copying 1 file to D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\20121221060415354\WEB-INF\classes
Copying 1 file to D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\20121221060415354\WEB-INF\classes
Copying 1 file to D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\20121221060415354\WEB-INF\jsp
06:04:15,914 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:2083] Modifying Servlet 2.4 D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\20121221060415354\WEB-INF\web.xml
Copying 123 files to D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\JUnitPortlet-portlet
Copying 1 file to D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\JUnitPortlet-portlet
Deleting directory D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\20121221060415354
06:04:16,650 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][PortletAutoDeployListener:87] Portlets for D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\deploy\JUnitPortlet-portlet-6.1.1.1.war copied successfully. Deployment will start in a few seconds.
Dec 21, 2012 6:04:25 AM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/JUnitPortlet-portlet]
Dec 21, 2012 6:04:25 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/JUnitPortlet-portlet] created a ThreadLocal with key of type [com.liferay.portal.kernel.util.CentralizedThreadLocal.ThreadLocalMapThreadLocal] (value [com.liferay.portal.kernel.util.CentralizedThreadLocal$ThreadLocalMapThreadLocal@140b96f]) and a value of type [com.liferay.portal.kernel.util.CentralizedThreadLocal.ThreadLocalMap] (value [com.liferay.portal.kernel.util.CentralizedThreadLocal$ThreadLocalMap@4e47e1]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Dec 21, 2012 6:04:25 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\NewProjectLR\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\JUnitPortlet-portlet

What`s wrong with this..... . It is getting Strucked here in the process of deployment.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Test Case

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen,

1) Finally, I have deployed my Liferay Junit project successfully. But when I try to run the test case with run as junit in the below class the setup and teardown methods are executing perfectly fine but the third method testGetUsers() giving exceptions.

2) i have to create users for that ?

3) If there are no users then it has to show " Unable to retrieve the users" this msg right ?

Any way suggest me wt was the issue.....

package com.test;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalService;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.util.InitUtil;

public class UserServiceTest {

private UserLocalService userService = null;

@Before
public void setUp() {
try {
System.out.println(">>>SET UP");
InitUtil.initWithSpring();

userService = UserLocalServiceUtil.getService();
} catch (Exception ex) {
ex.printStackTrace();
fail("Init failed...");
}
}

@After
public void tearDown() throws Exception {
System.out.println(">>>TEAR DOWN...");
userService = null;
}

@Test
public void testGetUsers() {
try {
List<User> users = userService.getUsers(-1, -1);

// check if you've got a positive user count.
assertTrue(users.size() > 0);

System.out.println("Number of User:" + users.size());

for (User user : users) {
System.out.println("User: " + user.getFullName());
}

} catch (Exception e) {
e.printStackTrace();
fail("Unable to retrieve the users");
}
}
}

The exception i am getting is below:

java.lang.NoClassDefFoundError: com/liferay/util/SystemProperties
at com.liferay.portal.util.InitUtil.init(InitUtil.java:57)
at com.liferay.portal.util.InitUtil.initWithSpring(InitUtil.java:134)
at com.test.UserServiceTest.setUp(UserServiceTest.java:25)
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:597)
at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:122)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:86)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: com.liferay.util.SystemProperties
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 23 more
thumbnail
Milen Dyankov, geändert vor 11 Jahren.

RE: Liferay JUnit Test Case

Expert Beiträge: 310 Beitrittsdatum: 30.10.12 Neueste Beiträge
Well this is the third time (if I'm not mistaken) when you ask for help with the exact same exception: java.lang.NoClassDefFoundError
I have no choice but give you the exact same answer: you are missing classes on your classpath (oh and the exception does clearly state which one). As much as I'd like to help you out here, I don't know what's on your classpath nor your java and/or your application server settings.
The good news is, classloading issues are quite common in Java EE world and there is plenty of information out there. Here are top 3 result from my quick Google search:

Please Google for more, perhaps invest in a good Java book and also make sure to check you application server's documentation (particularly classloading related one). Once you understand how classloading works please check Liferay's documentation and source code to figure out where the missing classes are located, how they are meant to be used and which libraries you need to have on your classpath.

I'm sorry about giving you such a generic answer and not actually solving your particular problem, but I have the feeling that even if I was able to do so, it would only lead to the next java.lang.NoClassDefFoundError. Trust me, I know how frustrating those kind of problems can be and the only way to overcome this is to really get to know how things work internally.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Test Case

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Now I am getting some other exception when i try to run the testcase in junit..


java.lang.AssertionError: Init failed...
at org.junit.Assert.fail(Assert.java:93)
at com.test.EmployeeServiceTest.setUp(EmployeeServiceTest.java:36)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Test Case

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen

Can u please tell me wt was the issue

>>>SET UP
Loading jar:file:/C:/Users/althaf_hussain/Desktop/jars01/portal-impl.jar!/system.properties
Dec 26, 2012 12:33:39 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
INFO: No server detected
java.lang.NullPointerException
at com.liferay.portal.kernel.util.PropsUtil.get(PropsUtil.java:32)
at com.liferay.util.log4j.Log4JUtil._getLiferayHome(Log4JUtil.java:211)
at com.liferay.util.log4j.Log4JUtil._getURLContent(Log4JUtil.java:220)
at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:67)
at com.liferay.portal.util.InitUtil.init(InitUtil.java:89)
at com.liferay.portal.util.InitUtil.initWithSpring(InitUtil.java:134)
at com.test.UserServiceTest.setUp(UserServiceTest.java:31)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
>>>TEAR DOWN...
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Test Case

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen
I changed the jar portal-impl.jar to portal-impl-6.1.0.jar, if i use portal-impl.jar it is showing the exception like class not found exception which i have posted before. If I use portal-impl.6.1.0.jar the exception has been changed to Null pointer excep. and it is calling the setup() method and init has been failed.
I am working wth the example which has been successfully done 6.1.0 but i am trying to execute in 6.1.1.., Please tell me the dependencies which i have to use...


>>>SET UP
Loading jar:file:/C:/Users/althaf_hussain/Desktop/jars01/portal-impl-6.1.0.jar!/system.properties
>>>TEAR DOWN...
Dec 26, 2012 2:01:57 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
INFO: No server detected
java.lang.NullPointerException
at com.liferay.portal.kernel.util.PropsUtil.get(PropsUtil.java:32)
at com.liferay.util.log4j.Log4JUtil._getLiferayHome(Log4JUtil.java:211)
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Test Case

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen,

Can U please give me a quick reply regarding the exception which i have posted. Why this Null Pointer Exception is coming, I tried a lot but i am not able to resolve wt the exact problem is.....

PLZ help me abt this, as it is very urgent for me.....

>>>SET UP
Loading jar:file:/C:/Users/althaf_hussain/Desktop/jars01/portal-impl-6.1.0.jar!/system.properties
>>>TEAR DOWN...
Dec 27, 2012 8:21:46 AM com.liferay.portal.kernel.log.Jdk14LogImpl info
INFO: No server detected
java.lang.NullPointerException
at com.liferay.portal.kernel.util.PropsUtil.get(PropsUtil.java:32)
at com.liferay.util.log4j.Log4JUtil._getLiferayHome(Log4JUtil.java:211)
at com.liferay.util.log4j.Log4JUtil._getURLContent(Log4JUtil.java:220)
at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:67)
at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:57)
at com.liferay.portal.util.InitUtil.init(InitUtil.java:94)
at com.liferay.portal.util.InitUtil.initWithSpring(InitUtil.java:159)
at com.liferay.portal.util.InitUtil.initWithSpring(InitUtil.java:140)
at com.test.UserServiceTest.setUp(UserServiceTest.java:31)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
madhukara patel, geändert vor 9 Jahren.

RE: Liferay JUnit Test Case

New Member Beiträge: 8 Beitrittsdatum: 08.10.14 Neueste Beiträge
I am facing same problem , please help someone how to resolve error.

Thanks in advance.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

RE: Liferay JUnit Test Case

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen,

Do u have any idea abt Apache Thrift?
How to use Apache Thrift in Liferay?

Regards,
Althaf Hussain.
thumbnail
Althaf Hussain, geändert vor 11 Jahren.

Remote Server Ip

Junior Member Beiträge: 60 Beitrittsdatum: 03.05.12 Neueste Beiträge
Hi Milen,

How to call a remote server IP in our own created client in Liferay.

Regards,
Althaf Hussain.