Foren

CReating hello world portlet using tomcat

Dorothy Taylor, geändert vor 8 Jahren.

CReating hello world portlet using tomcat

New Member Beiträge: 19 Beitrittsdatum: 03.10.08 Neueste Beiträge
I am new to Liferay and and trying to deploy the default hello-world-portlet, that comes with the plugins, on tomcat. Below are the details of the setup and the error. Pls suggest how to fix it:
Environment Details
Eclipse IDE, Tomcat v7, Windows OS

Tomcat Settings in IDE
Refer attached

Folder Structure
Refer Attached

Contents of manually created build.<<username>>.properties file
app.server.dir=D:/Code_Home/bundles/lportal-6.2-ga4/tomcat-7.0.42

When I execute ant.deploy, the hello-world-portlet-6.2.0.1.war gets created in D:\Code_Home\plugins\bundles\deploy.
Then, I manually copied this war file into the hot deploy directory D:\Code_Home\bundles\lportal-6.2-ga4\deploy

This resulted in the following error in tomcat console:
10:05:31,563 ERROR [localhost-startStop-2][HotDeployImpl:230] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for hello-world-portlethello-world-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for hello-world-portlethello-world-portlet
	at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
	at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:128)
	at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:227)
	at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
	at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)
	at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
	at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
	at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
	at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)
	at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)
	at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
	at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1113)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1671)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Error: Unresolved compilation problems: _	The import javax.portlet cannot be resolved_	The import javax.portlet cannot be resolved_	The import javax.portlet cannot be resolved_	The import javax.portlet cannot be resolved_	The import javax.portlet cannot be resolved_	The import javax.portlet cannot be resolved_	GenericPortlet cannot be resolved to a type_	PortletException cannot be resolved to a type_	The method getInitParameter(String) is undefined for the type HelloYouPortlet_	The method getInitParameter(String) is undefined for the type HelloYouPortlet_	RenderRequest cannot be resolved to a type_	RenderResponse cannot be resolved to a type_	PortletException cannot be resolved to a type_	PortletPreferences cannot be resolved to a type_	RenderRequest cannot be resolved to a type_	RenderResponse cannot be resolved to a type_	PortletException cannot be resolved to a type_	PortletRequestDispatcher cannot be resolved to a type_	The method getPortletContext() is undefined for the type HelloYouPortlet_ [Sanitized]
	at com.liferayinaction.portlet.HelloYouPortlet.<init>(HelloYouPortlet.java:5)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at com.liferay.portlet.PortletBagFactory.getPortletInstance(PortletBagFactory.java:418)
	at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:121)
	at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:370)
	at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:125)
	... 23 more</init>


Pls suggest on the below:
1. Do we need to manually copy the war file? Am i doing this right?
2. Why teh portlet does not deploy?
thumbnail
David H Nebinger, geändert vor 8 Jahren.

RE: CReating hello world portlet using tomcat

Liferay Legend Beiträge: 14914 Beitrittsdatum: 02.09.06 Neueste Beiträge
Okay, first you need your build.<username>.properties file that indicates where your bundle is. "ant deploy" normally copies directly to the deploy directory so you don't have to do any manual copying.

Second, are you using the Liferay IDE? It has bindings to the Liferay environment that should prove helpful.

Third I 'd check whether a) your war file has the portlet jar in it's WEB-INF/lib (it really shouldn't) and that the portlet jar is actually in the target tomcat's lib/ext directory.
thumbnail
Meera Prince, geändert vor 8 Jahren.

RE: CReating hello world portlet using tomcat

Liferay Legend Beiträge: 1111 Beitrittsdatum: 08.02.11 Neueste Beiträge
Dorothy Taylor, geändert vor 8 Jahren.

RE: CReating hello world portlet using tomcat

New Member Beiträge: 19 Beitrittsdatum: 03.10.08 Neueste Beiträge
Actually I replaced my lportal-6.2-ga4 (liferay portal with tomcat) with a fresh copy and now I can see my hello world portlet. However, still I need to copy the war file manually only in the hot deploy folder emoticon
thumbnail
Meera Prince, geändert vor 8 Jahren.

RE: CReating hello world portlet using tomcat

Liferay Legend Beiträge: 1111 Beitrittsdatum: 08.02.11 Neueste Beiträge
Hi Create new properties file with following name

build.SysteUserName.properties in the your plugins SDK and configure your server information as follow

Example file name: build.DorothyTaylor..properties if your system user name is DorothyTaylor

app.server.tomcat.lib.global.dir=C\:\\LiferayWorkSpace\\bundles\\tomcat-7.0.42\\lib\\ext
app.server.tomcat.deploy.dir=C\:\\LiferayWorkSpace\\bundles\\tomcat-7.0.42\\webapps
app.server.parent.dir=C\:\\LiferayWorkSpace\\bundles
app.server.tomcat.dir=C\:\\LiferayWorkSpace\\bundles\\tomcat-7.0.42
app.server.type=tomcat
app.server.tomcat.portal.dir=C\:\\LiferayWorkSpace\\bundles\\tomcat-7.0.42\\webapps\\ROOT


Note please modify as for your tomacat path in your local mechene.

Regards,
Meera Prince