Help on introducing custom field and passing across layer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help on introducing custom field and passing across layer

Ezhil

Hi,

We have integrated Carrot2 Search Engine with Solr and able to get search results.

I need to implement user based search (access control).

For demo purpose, I am planning to implement access control after getting search results from Solr.

To introduce custom field, I have followed forum response.

 - Referred ExampleDocumentSource, there scope of custom variable (modulo ) is used only in that class. Not referred in other classes.

 -But, I need to pass logged in user credential across Carrot2 layer (eg. till RemoteXmlSimpleSearchEngineBase)

 
Based on the responses from carrot2 forum I have done below steps

-In QueryProcessorServlet->doGet()

        final String userId = (String) requestParameters.get("userId");

        requestParameters.put("userId", queryParamuserId);

I am able to get logged in user in QueryProcessorServlet class.

When I try to add below piece of code in document source class (SolrDocumentSource)

@Input

@Processing

@Attribute(key = "userId")

@Internal

String userId;

Exception throws

java.lang.NoClassDefFoundError: Could not initialize class org.carrot2.webapp.model.WebappConfig

                org.carrot2.webapp.QueryProcessorServlet.init(QueryProcessorServlet.java:87)

                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

When I remove above piece of code (from QueryProcessorServlet), existing flow works fine. But i need to refer logged in user.

Is there anything else I have to do as part of this? Could you please provide your valuable input resolve this issue.

Awaiting for your favorable response.  Thanks in advance.

Thanks and Regards,

Ezhilmuthu, T


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Carrot2-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/carrot2-developers
Reply | Threaded
Open this post in threaded view
|

Re: Help on introducing custom field and passing across layer

Stanislaw Osinski
Administrator
Hi,

Apologies for a delayed reply.

@Input

@Processing

@Attribute(key = "userId")

@Internal

String userId;

Exception throws

java.lang.NoClassDefFoundError: Could not initialize class org.carrot2.webapp.model.WebappConfig

                org.carrot2.webapp.QueryProcessorServlet.init(QueryProcessorServlet.java:87)

                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

When I remove above piece of code (from QueryProcessorServlet), existing flow works fine. But i need to refer logged in user.

Is there anything else I have to do as part of this? Could you please provide your valuable input resolve this issue.

I'm not sure right away. Please check your Tomcat logs for more exceptions especially those that are thrown here:

http://fisheye3.atlassian.com/browse/carrot2/trunk/applications/carrot2-webapp/src/org/carrot2/webapp/model/WebappConfig.java?r=trunk#l155

(as you can see, currently, WebappConfig loads component suites in a static initializer, which effectively converts the real exception into a NoClassDefFoundError, this is to be improved, hopefully soon: http://issues.carrot2.org/browse/CARROT-487)

If nothing gets logged, please add:

log.error("Could not load application config.", e);

before the throws clause in line 157 and check the logs again.

Thanks,

Staszek

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Carrot2-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/carrot2-developers