掲示板

Re: Overridding class in ext

11年前 に venka reddy によって更新されました。

Re: Overridding class in ext

Regular Member 投稿: 231 参加年月日: 11/03/23 最新の投稿
HI,

I have to customize Encryptor.java(util-java/src) . How can i override that class in ext.

Previously i had customized the classes which is at(Portal-Impl/src) . But how can i customize the classes which is at util-java/src?
thumbnail
11年前 に Apoorva Prakash によって更新されました。

RE: Re: Overridding class in ext

Liferay Master 投稿: 658 参加年月日: 10/06/15 最新の投稿
venka reddy:
HI,

I have to customize Encryptor.java(util-java/src) . How can i override that class in ext.

Previously i had customized the classes which is at(Portal-Impl/src) . But how can i customize the classes which is at util-java/src?



Hello Venka,

I think the method is same.

If you see this wiki, you'll find ext-util-java in the "Anatomy of the Ext Plugin" section.

In addition, it clearly mentions the following:
Other: ext-util-bridges, ext-util-java and ext-util-taglib are only needed in advanced scenarios in which you need to customize the classes of three libraries provided with Liferay: util-bridges.jar, util-java.jar and util-taglib.jar respectively. In most scenarios, you can just ignore these directories.


Hope this will Work...

Thanks and Regards,
Apoorva Prakash
11年前 に venka reddy によって更新されました。

RE: Re: Overridding class in ext

Regular Member 投稿: 231 参加年月日: 11/03/23 最新の投稿
Hi Prakash,

Thanks for reply.

I have followed the scenrio as ,

Located the below source folder in my ext
docroot/WEB-INF/ext-util-java/src

Created the com.liferay.util package and created the class Encryptor.java.

Stopped the server and deploy the project and restarted the server.


I have followed the above said , but it does not reflect the the changes i have done in methods.
thumbnail
11年前 に Apoorva Prakash によって更新されました。

RE: Re: Overridding class in ext

Liferay Master 投稿: 658 参加年月日: 10/06/15 最新の投稿
venka reddy:
Hi Prakash,

Thanks for reply.

I have followed the scenrio as ,

Located the below source folder in my ext
docroot/WEB-INF/ext-util-java/src

Created the com.liferay.util package and created the class Encryptor.java.

Stopped the server and deploy the project and restarted the server.


I have followed the above said , but it does not reflect the the changes i have done in methods.


Hello Venka,

Redeployment of EXT is a bit tricky thing. See this.

Hope this will help.

Thanks and Regards,
Apoorva Prakash
11年前 に venka reddy によって更新されました。

RE: Re: Overridding class in ext

Regular Member 投稿: 231 参加年月日: 11/03/23 最新の投稿
Hi Prakash,

Thanks for reply,

Is the procedure i am invoking correct?

I have gone through the link you have provided. You have written nice articles specially ehcache in liferay.
thumbnail
11年前 に Apoorva Prakash によって更新されました。

RE: Re: Overridding class in ext

Liferay Master 投稿: 658 参加年月日: 10/06/15 最新の投稿
venka reddy:
Hi Prakash,

Thanks for reply,

Is the procedure i am invoking correct?

I have gone through the link you have provided. You have written nice articles specially ehcache in liferay.


Hello Venka,

you haven't mentioned anything about your calling procedure, and basically you have to import the correct package... In your case it will be the package of the class you are creating...

Hope this will help...

Thanks and Regards,
Apoorva Prakash
11年前 に Yogesh Garg によって更新されました。

RE: Re: Overridding class in ext

Junior Member 投稿: 51 参加年月日: 08/11/10 最新の投稿
Hi Venka,
I got the same issue when I started with ext and I was also wondering why my class is not overwritten but that was not the case.
The way I resolved is putting lot of messages in my overriding class using
" _log.info" because the log level is set to INFO in general and _log.debug does not work. You will see the logs in catalina.out file
This way you can get to know whether your file is overwritten and which functions call you are able to get it.


Thanks,
Yogesh.
thumbnail
11年前 に Apoorva Prakash によって更新されました。

RE: Re: Overridding class in ext

Liferay Master 投稿: 658 参加年月日: 10/06/15 最新の投稿
Yogesh Garg:
Hi Venka,
I got the same issue when I started with ext and I was also wondering why my class is not overwritten but that was not the case.
The way I resolved is putting lot of messages in my overriding class using
" _log.info" because the log level is set to INFO in general and _log.debug does not work. You will see the logs in catalina.out file
This way you can get to know whether your file is overwritten and which functions call you are able to get it.


Thanks,
Yogesh.


Hello Yougesh,

First of all a class in never overwritten, ext allows overriding of classes with the help of class loader...

And you can use log.info() by enabling it from control panel, log levels settings...

I still wonder, how you resolved the problem with the help of "putting lot of messages"!

Thanks and Regards,
Apoorva Prakash
11年前 に Yogesh Garg によって更新されました。

RE: Re: Overridding class in ext

Junior Member 投稿: 51 参加年月日: 08/11/10 最新の投稿
Hi Apoorva,
The way I understansd is the issue Venka have is -
He is not getting the functionality he expected with his class file and therefore he thinks whether his ext plugin is deployed correctly or not.

What I did is put "log messages" in the java class we write for ext pluing. If we get those messages on the console we are atleast sure that our ext plugin is deployed correctly.
Then we can go for what we want to achieve.
My idea behind putting lot of messages is to make sure that he is sure that he deployed his ext correctly. Once he is sure then he can look for the second step.

Thanks,
Yogesh.
11年前 に venka reddy によって更新されました。

Re: Overridding class in ext

Regular Member 投稿: 231 参加年月日: 11/03/23 最新の投稿
Hi Yogesh,

I understood your intention what your saying.

I put some SOP statements other than logs to ensure my class is overridden. I didn't get any SOP related output.

Could you provide steps you have followed to override this Encryptor.java(util-java/src) or any other classes.
11年前 に Yogesh Garg によって更新されました。

RE: Re: Overridding class in ext

Junior Member 投稿: 51 参加年月日: 08/11/10 最新の投稿
Hi Venka,

I have to overwrite other class. The steps I follow is the same as given in the guide to create and deploy an ext.
If you have overide a util class you have to create the same package as orignal in ext-util for you it is com.liferay.util.Encryptor.java
In my case the issue what I was thinking that my ext was not deployed but it was infact deployed but my logic was incorrect so I was getting the same behaviour. I found that by putting the log messages after every line.

When you change anything to your ext and want to redeploy it. It is a bit tricky.
What I do is remove all the .jar from WEB-INF/lib folder which has -ext. Also remove the xml with -ext from the classes folder. The jar are also there in ext folder remove it from there too and also remove the ext from webapps folder and restart the tomcat.

Please let me know if that helps.

Thanks,
Yogesh.
11年前 に venka reddy によって更新されました。

RE: Re: Overridding class in ext

Regular Member 投稿: 231 参加年月日: 11/03/23 最新の投稿
Hi yogesh,

Thanks for reply,

I will try it and inform you the status.