Fórum

Help with first Ext plugin.

thumbnail
Cameron McBride, modificado 13 Anos atrás.

Help with first Ext plugin.

Expert Postagens: 269 Data de Entrada: 08/02/11 Postagens 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:
package com.sample.hook;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.liferay.portal.security.auth.AutoLogin;
import com.liferay.portal.security.auth.AutoLoginException;

public class TestAutoLogin implements AutoLogin {

    public String[] login(HttpServletRequest arg0, HttpServletResponse arg1)
            throws AutoLoginException {
        String[] credentials = null;
        System.out.println("##### HERE ######");

        return credentials;
    }
}


Finally I added the hook into my portal-ext.properties file:
auto.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:
16:58:32,183 INFO  [PortalImpl:278] Global lib directory /C:/liferay/dev-liferay-portal-6.0.6/tomcat-6.0.29/lib/ext/
16: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/
16:58:53,767 ERROR [InstancePool:100] Unable to load com.sample.hooks.TestAutoLogin with the portal class loader or the current context class loader
java.lang.ClassNotFoundException: com.sample.hooks.TestAutoLogin
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
	at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:92)
	at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:59)
	at com.liferay.portal.kernel.util.InstancePool.get(InstancePool.java:33)
	at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.<init>(AutoLoginFilter.java:82)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at java.lang.Class.newInstance0(Class.java:355)
	at java.lang.Class.newInstance(Class.java:308)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
	at org.apache.catalina.core.StandardService.start(StandardService.java:519)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
	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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Starting Liferay Portal Community Edition 6.0.6 CE (Bunyan / Build 6006 / February 17, 2011)</init></init>


Have I missed some step on deploying the ext plugin?
thumbnail
Cameron McBride, modificado 13 Anos atrás.

RE: Help with first Ext plugin.

Expert Postagens: 269 Data de Entrada: 08/02/11 Postagens 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.
Siby Mathew, modificado 11 Anos atrás.

RE: Help with first Ext plugin.

Expert Postagens: 268 Data de Entrada: 04/03/11 Postagens 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, modificado 11 Anos atrás.

RE: Help with first Ext plugin.

Junior Member Postagens: 76 Data de Entrada: 16/01/13 Postagens 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, modificado 11 Anos atrás.

RE: Help with first Ext plugin.

Expert Postagens: 268 Data de Entrada: 04/03/11 Postagens 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, modificado 11 Anos atrás.

RE: Help with first Ext plugin.

Junior Member Postagens: 76 Data de Entrada: 16/01/13 Postagens 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
anil kumar, modificado 13 Anos atrás.

RE: Help with first Ext plugin.

New Member Postagens: 6 Data de Entrada: 01/02/10 Postagens 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, modificado 11 Anos atrás.

RE: Help with first Ext plugin.

Junior Member Postagens: 76 Data de Entrada: 16/01/13 Postagens 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:
package com.sample.hook;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.liferay.portal.security.auth.AutoLogin;
import com.liferay.portal.security.auth.AutoLoginException;

public class TestAutoLogin implements AutoLogin {

    public String[] login(HttpServletRequest arg0, HttpServletResponse arg1)
            throws AutoLoginException {
        String[] credentials = null;
        System.out.println("##### HERE ######");

        return credentials;
    }
}


Finally I added the hook into my portal-ext.properties file:
auto.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:
16:58:32,183 INFO  [PortalImpl:278] Global lib directory /C:/liferay/dev-liferay-portal-6.0.6/tomcat-6.0.29/lib/ext/
16: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/
16:58:53,767 ERROR [InstancePool:100] Unable to load com.sample.hooks.TestAutoLogin with the portal class loader or the current context class loader
java.lang.ClassNotFoundException: com.sample.hooks.TestAutoLogin
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
	at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:92)
	at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:59)
	at com.liferay.portal.kernel.util.InstancePool.get(InstancePool.java:33)
	at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.<init>(AutoLoginFilter.java:82)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at java.lang.Class.newInstance0(Class.java:355)
	at java.lang.Class.newInstance(Class.java:308)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
	at org.apache.catalina.core.StandardService.start(StandardService.java:519)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
	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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Starting Liferay Portal Community Edition 6.0.6 CE (Bunyan / Build 6006 / February 17, 2011)</init></init>


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