Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Cameron McBride
Help with first Ext plugin.
7 de Março de 2011 09:06
Resposta

Cameron McBride

Ranking: Expert

Mensagens: 273

Data de entrada: 8 de Fevereiro de 2011

Mensagens recentes

My goal is to create the simplest class that implements AutoLogin and see that it works. It moves me towards my end goal and let's me know that my eclipse environment is set up right.

I have eclipse set up and I can start and stop my liferay 6.0.6 server using sql server 2005 in eclipse without issues.

Next I create a ext plugin in eclipse. I deleted the portal-ext.properties that comes by default since it will overwrite my real one on deployment.

I created one single class file:
 1package com.sample.hook;
 2
 3import javax.servlet.http.HttpServletRequest;
 4import javax.servlet.http.HttpServletResponse;
 5
 6import com.liferay.portal.security.auth.AutoLogin;
 7import com.liferay.portal.security.auth.AutoLoginException;
 8
 9public class TestAutoLogin implements AutoLogin {
10
11    public String[] login(HttpServletRequest arg0, HttpServletResponse arg1)
12            throws AutoLoginException {
13        String[] credentials = null;
14        System.out.println("##### HERE ######");
15
16        return credentials;
17    }
18}


Finally I added the hook into my portal-ext.properties file:
1auto.login.hooks=com.sample.hooks.TestAutoLogin


Before deploying I right clicked my server in Eclipse and picked Add/Remove. I moved my plugin from the left side to the right side.

Finally I start the server and I can see my plugin being deployed. It also shows up now in the webapps directory.

I get the following error on start:
 116:58:32,183 INFO  [PortalImpl:278] Global lib directory /C:/liferay/dev-liferay-portal-6.0.6/tomcat-6.0.29/lib/ext/
 216:58:32,183 INFO  [PortalImpl:298] Portal lib directory /C:/liferay/dev-liferay-portal-6.0.6/tomcat-6.0.29/webapps/ROOT/WEB-INF/lib/
 316:58:53,767 ERROR [InstancePool:100] Unable to load com.sample.hooks.TestAutoLogin with the portal class loader or the current context class loader
 4java.lang.ClassNotFoundException: com.sample.hooks.TestAutoLogin
 5    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
 6    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
 7    at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:92)
 8    at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:59)
 9    at com.liferay.portal.kernel.util.InstancePool.get(InstancePool.java:33)
10    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.<init>(AutoLoginFilter.java:82)
11    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
12    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
13    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
14    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
15    at java.lang.Class.newInstance0(Class.java:355)
16    at java.lang.Class.newInstance(Class.java:308)
17    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
18    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
19    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
20    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
21    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
22    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
23    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
24    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
25    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
26    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
27    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
28    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
29    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
30    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
31    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
32    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
33    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
34    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
35    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
36    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
37    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
38    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
39    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
40    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
41    at java.lang.reflect.Method.invoke(Method.java:597)
42    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
43    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
44Starting Liferay Portal Community Edition 6.0.6 CE (Bunyan / Build 6006 / February 17, 2011)


Have I missed some step on deploying the ext plugin?
Cameron McBride
RE: Help with first Ext plugin.
7 de Março de 2011 10:12
Resposta

Cameron McBride

Ranking: Expert

Mensagens: 273

Data de entrada: 8 de Fevereiro de 2011

Mensagens recentes

A quick update to this, I tried adding a new portlet in eclipse and not only did it deploy I didnt even have to restart the server. I can now add my new "test" portlet to my liferay pages.

Just need to get the ext plugin working or any other way to deploy my own AutoLogin class out there.

Update 2:
I've also tried creating a hook and the only class file I added was my class from above. After deploying it says the hook is loaded but still gives the class not found error from above.
anil kumar
RE: Help with first Ext plugin.
7 de Março de 2011 23:11
Resposta

anil kumar

Ranking: New Member

Mensagens: 6

Data de entrada: 1 de Fevereiro de 2010

Mensagens recentes

Hi,
check out the below link,
http://www.liferay.com/c/document_library/get_file?p_l_id=5630538&groupId=4615837&folderId=4933105&name=DLFE-40607.swf
Ram A
RE: Help with first Ext plugin.
29 de Janeiro de 2013 08:04
Resposta

Ram A

Ranking: Junior Member

Mensagens: 76

Data de entrada: 16 de Janeiro de 2013

Mensagens recentes

Cameron McBride:
My goal is to create the simplest class that implements AutoLogin and see that it works. It moves me towards my end goal and let's me know that my eclipse environment is set up right.

I have eclipse set up and I can start and stop my liferay 6.0.6 server using sql server 2005 in eclipse without issues.

Next I create a ext plugin in eclipse. I deleted the portal-ext.properties that comes by default since it will overwrite my real one on deployment.

I created one single class file:
 1package com.sample.hook;
 2
 3import javax.servlet.http.HttpServletRequest;
 4import javax.servlet.http.HttpServletResponse;
 5
 6import com.liferay.portal.security.auth.AutoLogin;
 7import com.liferay.portal.security.auth.AutoLoginException;
 8
 9public class TestAutoLogin implements AutoLogin {
10
11    public String[] login(HttpServletRequest arg0, HttpServletResponse arg1)
12            throws AutoLoginException {
13        String[] credentials = null;
14        System.out.println("##### HERE ######");
15
16        return credentials;
17    }
18}


Finally I added the hook into my portal-ext.properties file:
1auto.login.hooks=com.sample.hooks.TestAutoLogin


Before deploying I right clicked my server in Eclipse and picked Add/Remove. I moved my plugin from the left side to the right side.

Finally I start the server and I can see my plugin being deployed. It also shows up now in the webapps directory.

I get the following error on start:
 116:58:32,183 INFO  [PortalImpl:278] Global lib directory /C:/liferay/dev-liferay-portal-6.0.6/tomcat-6.0.29/lib/ext/
 216:58:32,183 INFO  [PortalImpl:298] Portal lib directory /C:/liferay/dev-liferay-portal-6.0.6/tomcat-6.0.29/webapps/ROOT/WEB-INF/lib/
 316:58:53,767 ERROR [InstancePool:100] Unable to load com.sample.hooks.TestAutoLogin with the portal class loader or the current context class loader
 4java.lang.ClassNotFoundException: com.sample.hooks.TestAutoLogin
 5    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
 6    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
 7    at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:92)
 8    at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:59)
 9    at com.liferay.portal.kernel.util.InstancePool.get(InstancePool.java:33)
10    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.<init>(AutoLoginFilter.java:82)
11    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
12    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
13    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
14    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
15    at java.lang.Class.newInstance0(Class.java:355)
16    at java.lang.Class.newInstance(Class.java:308)
17    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
18    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
19    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
20    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
21    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
22    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
23    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
24    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
25    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
26    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
27    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
28    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
29    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
30    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
31    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
32    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
33    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
34    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
35    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
36    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
37    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
38    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
39    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
40    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
41    at java.lang.reflect.Method.invoke(Method.java:597)
42    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
43    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
44Starting Liferay Portal Community Edition 6.0.6 CE (Bunyan / Build 6006 / February 17, 2011)


Have I missed some step on deploying the ext plugin?



Hi Cameron,

have you found the solution for this class loader error.
I also have the similar issue.i created a hook for Auto login and i deployed it in Liferay 6.0.6.then it is giving the same error.

Please help me to fix this issue.


Thanks and Regards
Ram A
Siby Mathew
RE: Help with first Ext plugin.
29 de Janeiro de 2013 08:40
Resposta

Siby Mathew

Ranking: Expert

Mensagens: 261

Data de entrada: 4 de Março de 2011

Mensagens recentes

Hi Cameron/Ram...
I know its an old post...but the package name configured is actually wrong :
Configured : com.sample.hooks
Actual : com.sample.hook

Thanks,
Siby
Ram A
RE: Help with first Ext plugin.
30 de Janeiro de 2013 02:38
Resposta

Ram A

Ranking: Junior Member

Mensagens: 76

Data de entrada: 16 de Janeiro de 2013

Mensagens recentes

Siby Mathew:
Hi Cameron/Ram...
I know its an old post...but the package name configured is actually wrong :
Configured : com.sample.hooks
Actual : com.sample.hook

Thanks,
Siby



Thanks Siby for reply.
i have autologin configured in my application.it has portal-hook.properties.
The property auto.login.hooks=com.sample.MyAutoLoginFilter is configured in this property file.

And similarly the same property is placed in portal-ext.properties file.

is it needed in both the places.
because i am getting the below error when i am trying to login to the application.
11:34:03,781 ERROR [AutoLoginFilter:231] Current URL /web/guest/ generates exception: null
11:34:03,783 ERROR [AutoLoginFilter:231] Current URL /web/guest/ generates exception: null
11:35:04,727 ERROR [AutoLoginFilter:231] Current URL /web/guest/ generates exception: null

PLease help me to resolve this.

Thanks in advance
Ram A
Siby Mathew
RE: Help with first Ext plugin.
30 de Janeiro de 2013 03:10
Resposta

Siby Mathew

Ranking: Expert

Mensagens: 261

Data de entrada: 4 de Março de 2011

Mensagens recentes

Hi Ram,
The hookable properties need to be kept only in one file and this filename has to be referred inside <portal-properties> tag inside liferay-hook.xml
If you still have problems, please share the AutoLoginFilter code.

Thanks,
Siby
Ram A
RE: Help with first Ext plugin.
8 de Fevereiro de 2013 23:18
Resposta

Ram A

Ranking: Junior Member

Mensagens: 76

Data de entrada: 16 de Janeiro de 2013

Mensagens recentes

Siby Mathew:
Hi Ram,
The hookable properties need to be kept only in one file and this filename has to be referred inside <portal-properties> tag inside liferay-hook.xml
If you still have problems, please share the AutoLoginFilter code.

Thanks,
Siby



Thanks Siby for reply.

i deleted the property "auto.login.hooks" from portal-ext.properties.

The error was gone and it is working fine.

Thanks and Regards
Ram A