Fórum

Problems with User Guide: Custom Java Tools in the Script Engine

thumbnail
André Bunse, modificado 12 Anos atrás.

Problems with User Guide: Custom Java Tools in the Script Engine

Junior Member Postagens: 85 Data de Entrada: 16/03/12 Postagens Recentes
Referring to Custom Java tools in the script engine

i create a hook plugin and follow all steps, only change was another namespacing of the package.

Hook is deployed and ready to use, but bean locator can't locate it.

Is there a convention packages must begin with "com.liferay" in this case?


Edit: Hmm it seems to be an other problem, changing to "com.liferay" doesn't work too emoticon

Edit 2:

When i set "Enclosing type" on class creation figured out in the screenshot 13.3
Eclipse only modify the interface and doesn't create a new implementation class,
so i skip setting of enclosing type, but bean is not defined anyway emoticon


TIA
André
thumbnail
David H Nebinger, modificado 12 Anos atrás.

RE: Package naming convention?

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
No, it's not a package naming issue.

Did you include the listener as mentioned in the link?

Recently there was another post in a different thread that indicated w/ 6.1 you had to add the context-param stuff for Spring to load your applicationContext.xml (that it was not pulled in by default anymore), so you might want to try that too.
thumbnail
André Bunse, modificado 12 Anos atrás.

RE: Package naming convention?

Junior Member Postagens: 85 Data de Entrada: 16/03/12 Postagens Recentes
hi David,

thx for the info, right now i have no settings for context-param done

i search for the thread and give it a try


Keep on coding
André
thumbnail
André Bunse, modificado 12 Anos atrás.

RE: Package naming convention?

Junior Member Postagens: 85 Data de Entrada: 16/03/12 Postagens Recentes
i try some different ways, without success

i changed my "web.xml" to

<!--?xml version="1.0"?--> 

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  
	<context-param>
	   <param-name>contextConfigLocation</param-name>
	   <param-value>/WEB-INF/applicationContext.xml</param-value>
	</context-param>
	
	<listener>
	   <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<listener>
		<listener-class>com.liferay.portal.kernel.servlet.HookContextListener</listener-class>
	</listener>
  
</web-app>

this ends in an error when deploy

21:10:35,696 INFO  [HookAutoDeployListener:49] Hook for C:\VIP\liferay\bundles\liferay-portal-6.1.0-
ce-ga1\deploy\belt-hook-6.1.0.1.war copied successfully. Deployment will start in a few seconds.
18.03.2012 21:10:36 org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/belt-hook]
21:10:36,935 INFO  [PluginPackageUtil:1099] Reading plugin package for belt-hook
21:10:36,939 INFO  [HookHotDeployListener:1101] Hook for belt-hook was unregistered
18.03.2012 21:10:37 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\VIP\liferay\bundles\liferay-portal-6.1.0-ce-ga1\tomcat-
7.0.23\webapps\belt-hook
18.03.2012 21:10:37 org.apache.catalina.core.StandardContext startInternal
SCHWERWIEGEND: Error listenerStart
18.03.2012 21:10:37 org.apache.catalina.core.StandardContext startInternal
SCHWERWIEGEND: Context [/belt-hook] startup failed due to previous errors

when i change the listener class to

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

the deployment works

18.03.2012 21:17:08 org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/belt-hook]
18.03.2012 21:17:08 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\VIP\liferay\bundles\liferay-portal-6.1.0-ce-ga1\tomcat-
7.0.23\webapps\belt-hook
21:17:08,225 INFO  [PluginPackageUtil:1099] Reading plugin package for belt-hook
21:17:08,286 INFO  [HookHotDeployListener:1901] Registering hook for belt-hook
21:17:08,290 INFO  [HookHotDeployListener:978] Hook for belt-hook is available for use

but when i try to access the following error appears

21:17:08,290 INFO  [HookHotDeployListener:978] Hook for belt-hook is available for use
21:19:27,143 ERROR [EditServerAction:391] org.springframework.beans.factory.NoSuchBeanDefinitionExce
ption: No bean named 'abu.liferay.belt.Utils' is defined
Line 1: myUtil = com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate("belt-hook", "abu.life
ray.belt.Utils")
Line 2:
Line 3: println(myUtil.getUserDetail())

really annoying, but


Keep on coding ;)
André
thumbnail
André Bunse, modificado 12 Anos atrás.

RE: Package naming convention?

Junior Member Postagens: 85 Data de Entrada: 16/03/12 Postagens Recentes
It's done emoticon

Liferay issue LPS 5330

renaming param name to portalContextConfigLocation did the job

"web.xml"
<!--?xml version="1.0"?--> 


    
<web-app>

    <context-param>
        <param-name>portalContextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>

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

</web-app>


thx David for pointing to the right direction

Edit: Renamed thread name "Package naming convention?"

Keep on coding
André