Foren

Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

lokesh gorrela, geändert vor 7 Jahren.

Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 173 Beitrittsdatum: 09.03.16 Neueste Beiträge
Hi Guys,
Overriden CaptchaMVCResourceCommand.java through modules in liferay 7 portal code.After that i try to deployed that module by gradle tool, I get the below error. Any one know this below error please give replay.


:modules:login.custom.captch:compileJava
:modules:login.custom.captch:buildCSS UP-TO-DATE
:modules:login.custom.captch:processResources
:modules:login.custom.captch:transpileJS SKIPPED
:modules:login.custom.captch:configJSModules SKIPPED
:modules:login.custom.captch:classes
:modules:login.custom.captch:jar[In component <name not yet determined>, method serveResource, cannot recognize the signature of the descriptor: (Ljavax/portlet/ResourceRequest;Ljavax/portlet/ResourceResponse;)Z, No interface specified on serveResource]

FAILURE: Build failed with an exception.

* What went wrong:
Could not copy MANIFEST.MF to 'D:\liferayupdatedsetup7\OSGI\modules\login.custom.captch\build\tmp\jar\MANIFEST.MF'.
> Build has errors
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Thanks
Regards
Lokesh
thumbnail
Andy Wu, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 195 Beitrittsdatum: 05.05.15 Neueste Beiträge
do you resolve your problem ?
lokesh gorrela, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 173 Beitrittsdatum: 09.03.16 Neueste Beiträge
Hello Andy Wu
My problem is resolved with you provided solution.But i faced one problem. After deployed a bundle i get a build success. I moved the jar file into deploy folder.After moving , some times i get below issue.After restart the server , re depoly the bunlde and move the jar file once agian into deploy floder that time this issue is resolved. Why this issue is getting i con't understand.

03:48:28,018 ERROR [localhost-startStop-1][create_account_ext:97] [create.account.vidyayug.EducationYugCreateAccountMVCActionCommand(1950)] Circular reference detected, getService returning null
03:48:28,283 ERROR [localhost-startStop-1][create_account_ext:97] [create.account.vidyayug.EducationYugCreateAccountMVCActionCommand(1950)] Cannot create component instance due to failure to bind reference MVCActionCommand
03:48:28,285 ERROR [localhost-startStop-1][create_account_ext:97] [create.account.vidyayug.EducationYugCreateAccountMVCActionCommand(1950)] Failed creating the component instance; see log for reason
03:48:43,682 ERROR [localhost-startStop-1][blogs_demo_ext:97] [blogs.demo.CustomBlogsMVCActionCommand(1705)] Circular reference detected, getService returning null
03:48:43,934 ERROR [localhost-startStop-1][blogs_demo_ext:97] [blogs.demo.CustomBlogsMVCActionCommand(1705)] Cannot create component instance due to failure to bind reference MVCActionCommand
03:48:43,935 ERROR [localhost-startStop-1][blogs_demo_ext:97] [blogs.demo.CustomBlogsMVCActionCommand(1705)] Failed creating the component instance; see log for reason


Thanks
Regards
Lokesh.
thumbnail
Andy Wu, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 195 Beitrittsdatum: 05.05.15 Neueste Beiträge
hey can you describe you steps to reproduce the error ? I am a little confused.
thumbnail
Mohammad Danish, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 187 Beitrittsdatum: 05.03.12 Neueste Beiträge
Andy,

I cant find the reply that you had posted. Can you please post the same back on this thread?
thumbnail
Andy Wu, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 195 Beitrittsdatum: 05.05.15 Neueste Beiträge
sorry , which thread ?
thumbnail
Mohammad Danish, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 187 Beitrittsdatum: 05.03.12 Neueste Beiträge
Hi Wu,

I am also not able to ovveride the ActionCommand in liferay 7. https://web.liferay.com/community/forums/-/message_boards/message/79259853.

Can you please help me out here?

Thanks
Raghuveer Kanakamedala, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

New Member Beiträge: 5 Beitrittsdatum: 29.07.13 Neueste Beiträge
Circular reference detected, getService returning null

To avoid this error, Undeploy the module that consists MVCCommand override and redeploy it.
Sanju Eapen, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

New Member Beiträge: 7 Beitrittsdatum: 07.09.16 Neueste Beiträge
Hello friends, I am also getting the same error with circular reference as following:
23:59:29,653 ERROR [Thread-114][user-account-hook:97] [com.bright.liferay.modules.useraccount.CreateAccountActionHook(2369)] Circular reference detected, getService returning null
23:59:30,204 ERROR [Thread-114][user-account-hook:97] [com.bright.liferay.modules.useraccount.CreateAccountActionHook(2369)] Cannot create component instance due to failure to bind reference MvcActionCommand
23:59:30,207 ERROR [Thread-114][user-account-hook:97] [com.bright.liferay.modules.useraccount.CreateAccountActionHook(2369)] Failed creating the component instance; see log for reason


I am developing a MVCActionCommand override to the action /login/create_account and following is the component part:
@Component(
property =
{
"javax.portlet.name=com_liferay_login_web_portlet_LoginPortlet",
"mvc.command.name=/login/create_account",
"service.ranking:Integer=100"
}, service = MVCActionCommand.class)


Following is the Reference part:
@Reference(target = "(&(mvc.command.name=/login/create_account)" +
"(javax.portlet.name=com_liferay_login_web_portlet_LoginPortlet))")
public void setMvcActionCommand(MVCActionCommand mvcActionCommand) {
this.mvcActionCommand = mvcActionCommand;
}


Can anyone please tell me why this error is occurring? Which log to check (as mentioned in "Failed creating the component instance; see log for reason ")?
thumbnail
Andy Wu, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 195 Beitrittsdatum: 05.05.15 Neueste Beiträge
hi Sanju ,could you upload your sample code , so we can reproduce your problem and also please share which version portal you are using and jdk version and os version and bit and so on , thanks .
Sanju Eapen, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

New Member Beiträge: 7 Beitrittsdatum: 07.09.16 Neueste Beiträge
Thanks Andy. I am working on Liferay CE 7 GA3 hosted on ubuntu machine (64 bit) and the java version is 1.8.0_101

I have three modules in a liferay workspace:
a. login-jsp-hook which overrides login.jsp and create_account.jsp. Here is the bnd.bnd content:
Bundle-Name: login-jsp-hook
Bundle-SymbolicName: login.jsp.hook
Bundle-Version: 1.0.0
Fragment-Host: com.liferay.login.web;bundle-version="1.0.7"

b. Oauth-hook which has a custom Authenticator which will be used with property 'auth.pipeline.pre'

c. User-account-hook which has a custom BaseMVCActionCommand which overrides mvc command '/login/create_account' of portlet 'com_liferay_login_web_portlet_LoginPortlet'

The issue with circular reference is happening intermittently when one of the modules are deployed using the 'blade deploy' command. It usually does not happen when all three modules are deployed at once.

I have also attached the sample files.

Thank you very much for looking into this issue.
thumbnail
Andy Wu, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 195 Beitrittsdatum: 05.05.15 Neueste Beiträge
hey Sanju Eapen , I can reproduce your problem .
a and b project is ok without problem.
But about c , I can see you want to make another MVCActionCommand to hook on original /login/create_account from com.liferay.login.web , and just do some log.
But the problem is , you used @Reference to inject a service into CreateAccountActionHook.java , but CreateAccountActionHook itself is also a MVCActionCommand service component ,and has higher service ranking , so when osgi container resolve and run the bundle , it will register a service with the same mvc.command.name and javax.portlet.name as the one from com.liferay.login.web and with higher service.ranking , then the container will inject CreateAccountActionHook into itself ! So there was "Circular reference detected".
The logic is wrong , when you go to create account page and fill some fields and click "Save" button , you expect it will call your command , but when you deploy your hook project , you expect it will call system original service , so it is contradictive.

So my suggestion is , add more condition when using reference annotation: such as

@Reference(
target =
"(&(mvc.command.name=/login/create_account)" +
"(javax.portlet.name=com_liferay_login_web_portlet_LoginPortlet)" +
"(component.name=com.liferay.login.web.internal.portlet.action.CreateAccountMVCActionCommand))"
)

and in this way , it will never cause such problem
Sanju Eapen, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

New Member Beiträge: 7 Beitrittsdatum: 07.09.16 Neueste Beiträge
Hi Andy, Thanks a lot for resolving the issue and also providing clarity on the usage of Reference annotation.
thumbnail
Andy Wu, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 195 Beitrittsdatum: 05.05.15 Neueste Beiträge
you are welcome . emoticon
Thirumal Reddy, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Regular Member Beiträge: 216 Beitrittsdatum: 03.12.15 Neueste Beiträge
Hi,
How to access portal-impl classes in MVCActionCommand overriden classes(ex: PropsValues)

Thanks,
Thirumal.
thumbnail
Gregory Amerson, geändert vor 7 Jahren.

RE: Overriden CaptchaMVCResourceCommand.java in liferay 7 portal code

Liferay Legend Beiträge: 1123 Beitrittsdatum: 16.02.10 Neueste Beiträge
Which class exactly are you trying to access? If it is in portal-impl, you will have to make sure that package is being exported by system bundle. You can verify this in the gogo shell by issuing this command:

$ b 0

And see the list of exported portal-impl packages.