Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
devi nimmagadda
UnSupported Operation Exception
July 7, 2011 10:19 PM

devi nimmagadda

Rank: Regular Member

Posts: 109

Join Date: December 9, 2010

Recent Posts

Hi all,

can anybody know about this exception.

I am adding search capability to my portlet , I am getting exception in my indexer class . The code I have written in is :

protected Document doGetDocument(Object obj) throws Exception {

System.out.println("doGetDocument calling in SampleIndexer class ");

SampleEntry entry = (SampleEntry)obj;

long sampleId = entry.getSampleId();

String sampleName = entry.getSampleName();

String sampleLoc = entry.getSampleLoc();

String sampleType = entry.getSampleType();

Date modifiedDate = entry.getModifiedDate();

System.out.println("SampleEntry obj primary key = -----");

ExpandoBridge expandoBridge = entry.getExpandoBridge();

System.out.println("creating Document here --------");
Document document = new DocumentImpl();

document.addUID(PORTLET_ID, sampleId);


document.addKeyword(Field.PORTLET_ID, PORTLET_ID);
document.addText(Field.USER_NAME, sampleName);
document.addText(Field.TITLE, sampleLoc);
document.addText(Field.CONTENT, sampleType);
document.addKeyword(Field.ENTRY_CLASS_NAME, SampleEntry.class.getName());
document.addKeyword(Field.ENTRY_CLASS_PK, sampleId);

ExpandoBridgeIndexerUtil.addAttributes(document, expandoBridge);
System.out.println("document == "+document);
return document;

But I am getting exception when getExpandoBridge() calling.

Exception stack trace is :

document creation here
doGetDocument calling in SampleIndexer class
SampleEntry obj primary key = ----- java.lang.UnsupportedOperationException
at com.ext.portlet.sample.util.SampleIndexer.doReindex(
at com.ext.portlet.sample.service.impl.SampleEntryLocalServiceImpl.addIndex(

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
Brian Scott Schupbach
RE: UnSupported Operation Exception
March 1, 2013 2:06 PM

Brian Scott Schupbach

Rank: Expert

Posts: 329

Join Date: October 23, 2008

Recent Posts


I'm getting the exact same error. If you could let me know how you corrected your issue, I would greatly appreciate it.


Sandeep Nair
RE: UnSupported Operation Exception
March 1, 2013 2:32 PM

Sandeep Nair

Rank: Liferay Legend

Posts: 1732

Join Date: November 5, 2008

Recent Posts


Can you try the following to get ExpandoBridge

1ExpandoBridge expandoBridge =
2                ExpandoBridgeFactoryUtil.getExpandoBridge(
3                    companyId, SampleEntry.class.getName(),
4                    classPK);
Brian Scott Schupbach
RE: UnSupported Operation Exception
March 1, 2013 2:47 PM

Brian Scott Schupbach

Rank: Expert

Posts: 329

Join Date: October 23, 2008

Recent Posts

Thanks, Sandeep... but no luck.

I still get the exception. I actually was able to avoid the exception if I add the below method in my BaseModelImpl. However, although it doesn't throw an exception, my custom asset still does not show up in search...

public ExpandoBridge getExpandoBridge(){

//I added this to return null because it was throwing an exception without it.

return null;

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!