{"id":32,"date":"2011-04-14T14:11:00","date_gmt":"2011-04-14T14:11:00","guid":{"rendered":"https:\/\/www.srivittal.com\/wp\/?p=32"},"modified":"2021-08-31T10:12:45","modified_gmt":"2021-08-31T09:12:45","slug":"liferay-portal-6-0-6-com-liferay-portal-nosuchcompanyexception-no-company-exists-with-the-primary-key-1","status":"publish","type":"post","link":"https:\/\/www.srivittal.com\/wp\/?p=32","title":{"rendered":"Liferay Portal 6.0.6 com.liferay.portal.NoSuchCompanyException: No Company exists with the primary key 1"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left;\">I installed a brand new copy of MySQL 5.1 on my mac at home. Downloaded the latest copy of Liferay Portal on Tomcat 6.0.6 and configured the portal-ext.properties to use MySQL as the database.<\/p>\n<p>Started the server which promptly created all the necessary tables and started successfully. Access the default liferay URL on http:\/\/localhost:8080 and bang! got a large exception on the console of the following form<\/p>\n<p><span style=\"background-color: black; color: white;\">13:26:17,337 ERROR [CompanyThreadLocal:54] com.liferay.portal.NoSuchCompanyException: No Company exists with the primary key 1<\/span><br \/><span style=\"background-color: black; color: white;\">com.liferay.portal.NoSuchCompanyException: No Company exists with the primary key 1<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at com.liferay.portal.service.persistence.CompanyPersistenceImpl.findByPrimaryKey(CompanyPersistenceImpl.java:436)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at com.liferay.portal.service.base.CompanyLocalServiceBaseImpl.getCompany(CompanyLocalServiceBaseImpl.java:325)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at java.lang.reflect.Method.invoke(Method.java:597)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:44)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at $Proxy17.getCompany(Unknown Source)<\/span><br \/><span style=\"background-color: black; color: white;\">&nbsp;&nbsp;&nbsp; at com.liferay.portal.service.CompanyLocalServiceUtil.getCompany(CompanyLocalServiceUtil.java:166)<\/span><\/p>\n<p><span style=\"background-color: black; color: white;\"><span style=\"background-color: black;\"><span style=\"color: black;\"><\/span><\/span><\/span><br \/><span style=\"background-color: black; color: white;\"><span style=\"background-color: black;\"><span style=\"color: black;\"><span style=\"background-color: white;\">I have deleted some lines for the sake of clarity. Went through the forums but no luck. People were talking about patches and versions which did not make any sense. Finally found that it was due to cookies in my browser. I had previously logged into an older version of Liferay and although I logged out, somehow these cookies still persisted. Removed the cookies, restarted the server and I&#8217;m back in Business.<\/span><\/span><\/span><\/span><br \/><span style=\"background-color: black; color: white;\"><span style=\"background-color: black;\"><span style=\"color: black;\"><span style=\"background-color: white;\">&nbsp;<\/span>&nbsp;<\/span><\/span> <\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I installed a brand new copy of MySQL 5.1 on my mac at home. Downloaded the latest copy of Liferay Portal on Tomcat 6.0.6 and configured the portal-ext.properties to use MySQL as the database. Started the server which promptly created all the necessary tables and started successfully. Access the default liferay URL on http:\/\/localhost:8080 and &hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,53,26,13],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-exception","category-liferay","category-mac-osx","category-portal","entry entry-center"],"_links":{"self":[{"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":1,"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":193,"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions\/193"}],"wp:attachment":[{"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.srivittal.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}