Fórum

Extending two services with one hook

Mike Oliver, modificado 12 Anos atrás.

Extending two services with one hook

New Member Postagens: 21 Data de Entrada: 04/07/11 Postagens Recentes
I want to use a service override hook to extend two services:
com.liferay.portal.service.UserLocalService;
com.liferay.portal.service.OrganizationLocalService

I have extended the Wrappers for both.

my liferay-hook.xml is as follows:

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


<hook>
	<service>
		<service-type>com.liferay.portal.service.UserLocalService</service-type>
		<service-impl>com.corent.liferay.service.MTSUserLocalServiceWrapper</service-impl>
	</service>
	<service>
		<service-type>com.liferay.portal.service.OrganizationLocalService</service-type>
		<service-impl>com.corent.liferay.service.MTSOrganizationLocalServiceWrapper</service-impl>
	</service>
</hook>


Build and ant deploy are without exception.

However hot deploy or restart yields:


00:56:25,577 INFO  [HookHotDeployListener:742] Hook for MTSUserHook-hook was unregistered
00:56:25,696 INFO  [HookHotDeployListener:394] Registering hook for MTSUserHook-hook
00:56:25,699 ERROR [HotDeployUtil:112] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering hook for MTSUserHook-hook
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering hook for MTSUserHook-hook
	at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:45)
...
Caused by: com.liferay.portal.kernel.xml.DocumentException: Error on line 10 of document  : The markup in the document following the root element must be well-formed. Nested exception: The markup in the document following the root element must be well-formed.
	at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:372)
	... 15 more



The xml looks well formed to me, so I am stumped. What am I missing?
Mike Oliver, modificado 12 Anos atrás.

RE: Extending two services with one hook

New Member Postagens: 21 Data de Entrada: 04/07/11 Postagens Recentes
tried everything from starting from an empty liferay-hook.xml to one service, and back to two services but it wouldn't go away.

So I looked in the /dist/ war file for the hook, and the liferay-hook.xml was fine.

So I looked in the /webapps/ hook folder and liferay-hook.xml was bad.

Apparently ant deploy expands the war file ok, but leaves the liferay-hook.xml as it was.

I removed the hook web app and /dist/ war file to be complete, then did an ant build and ant deploy and the exception went away.

If this happens to someone else I hope this saves them some time.
Mike Oliver, modificado 12 Anos atrás.

RE: Extending two services with one hook

New Member Postagens: 21 Data de Entrada: 04/07/11 Postagens Recentes
Same topic different problem.

I wanted to override the getUsers() method in UserLocalService so I can syhnchronize users with another application.

All the other methods in my hook are working, but I don't see


@Override
public List<user> getUsers(int start, int end) throws SystemException{
...
    return users;
}
</user>


Getting called at all, not even in the Control Panel when you click Users or View All in the User Admin Portlet.

Is there some other service I need to override?

Does seven cogs hook already override getusers?
thumbnail
Amos Fong, modificado 12 Anos atrás.

RE: Extending two services with one hook

Liferay Legend Postagens: 2047 Data de Entrada: 07/10/08 Postagens Recentes
Hi Mike,

I believe in control panel > users it uses the search() method rather than the getUsers(). Try looking at user_search_results_index.jspf or user_search_results_database.jspf
Mike Oliver, modificado 12 Anos atrás.

RE: Extending two services with one hook

New Member Postagens: 21 Data de Entrada: 04/07/11 Postagens Recentes
Thanks I will try that. I did a search of the sources and didn't find anyplace that called that service, so this makes sense. emoticon
Laxman Rana, modificado 12 Anos atrás.

RE: Extending two services with one hook

Junior Member Postagens: 38 Data de Entrada: 01/03/12 Postagens Recentes
@ Mike Oliver
hi....can u help me in this question...
http://www.liferay.com/community/forums/-/message_boards/message/13048133