Forums de discussion
UnSupported Operation Exception
devi nimmagadda, modifié il y a 12 années.
UnSupported Operation Exception
Regular Member Publications: 109 Date d'inscription: 09/12/10 Publications récentes
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 SampleIndexer.java 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.addModifiedDate(modifiedDate);
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 = -----
com.liferay.portal.kernel.search.SearchException: java.lang.UnsupportedOperationException
at com.liferay.portal.kernel.search.BaseIndexer.getDocument(BaseIndexer.java:61)
at com.ext.portlet.sample.util.SampleIndexer.doReindex(SampleIndexer.java:126)
at com.liferay.portal.kernel.search.BaseIndexer.reindex(BaseIndexer.java:71)
at com.ext.portlet.sample.service.impl.SampleEntryLocalServiceImpl.addIndex(SampleEntryLocalServiceImpl.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
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 SampleIndexer.java 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.addModifiedDate(modifiedDate);
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 = -----
com.liferay.portal.kernel.search.SearchException: java.lang.UnsupportedOperationException
at com.liferay.portal.kernel.search.BaseIndexer.getDocument(BaseIndexer.java:61)
at com.ext.portlet.sample.util.SampleIndexer.doReindex(SampleIndexer.java:126)
at com.liferay.portal.kernel.search.BaseIndexer.reindex(BaseIndexer.java:71)
at com.ext.portlet.sample.service.impl.SampleEntryLocalServiceImpl.addIndex(SampleEntryLocalServiceImpl.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
Brian Scott Schupbach, modifié il y a 11 années.
RE: UnSupported Operation Exception
Expert Publications: 329 Date d'inscription: 23/10/08 Publications récentes
Hello,
I'm getting the exact same error. If you could let me know how you corrected your issue, I would greatly appreciate it.
Thanks,
Brian
I'm getting the exact same error. If you could let me know how you corrected your issue, I would greatly appreciate it.
Thanks,
Brian
Sandeep Nair, modifié il y a 11 années.
RE: UnSupported Operation Exception
Liferay Legend Publications: 1744 Date d'inscription: 06/11/08 Publications récentes
Hi,
Can you try the following to get ExpandoBridge
Can you try the following to get ExpandoBridge
ExpandoBridge expandoBridge =
ExpandoBridgeFactoryUtil.getExpandoBridge(
companyId, SampleEntry.class.getName(),
classPK);
Brian Scott Schupbach, modifié il y a 11 années.
RE: UnSupported Operation Exception
Expert Publications: 329 Date d'inscription: 23/10/08 Publications récentes
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...
@Override
public ExpandoBridge getExpandoBridge(){
//I added this to return null because it was throwing an exception without it.
return null;
}
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...
@Override
public ExpandoBridge getExpandoBridge(){
//I added this to return null because it was throwing an exception without it.
return null;
}