Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
venka reddy
Re: Overridding class in ext
December 20, 2012 2:09 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

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?
Apoorva Prakash
RE: Re: Overridding class in ext
December 20, 2012 2:24 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

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
venka reddy
RE: Re: Overridding class in ext
December 20, 2012 3:27 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

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.
Apoorva Prakash
RE: Re: Overridding class in ext
December 20, 2012 7:23 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

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
venka reddy
RE: Re: Overridding class in ext
December 21, 2012 3:39 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

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.
Apoorva Prakash
RE: Re: Overridding class in ext
December 21, 2012 4:29 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

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
Yogesh Garg
RE: Re: Overridding class in ext
December 21, 2012 4:55 AM
Answer

Yogesh Garg

Rank: Junior Member

Posts: 51

Join Date: November 10, 2008

Recent Posts

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.
Apoorva Prakash
RE: Re: Overridding class in ext
December 21, 2012 5:02 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

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
Yogesh Garg
RE: Re: Overridding class in ext
December 21, 2012 5:52 AM
Answer

Yogesh Garg

Rank: Junior Member

Posts: 51

Join Date: November 10, 2008

Recent Posts

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.
venka reddy
Re: Overridding class in ext
December 21, 2012 7:01 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

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.
Yogesh Garg
RE: Re: Overridding class in ext
December 21, 2012 8:15 AM
Answer

Yogesh Garg

Rank: Junior Member

Posts: 51

Join Date: November 10, 2008

Recent Posts

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.
venka reddy
RE: Re: Overridding class in ext
December 21, 2012 7:59 PM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

Hi yogesh,

Thanks for reply,

I will try it and inform you the status.