Re: Solr spring application context error

2009-07-09 Thread John Wang
Ah, my bad, this is the same as null. Sorry for the stupid comment.
-John

On Thu, Jul 9, 2009 at 1:55 PM, John Wang  wrote:

> Hi guys:
>  Could it be in method:load in class CoreContainer:
>
> libLoader = SolrResourceLoader.createClassLoader(f, null);
>
>
>The parent ClassLoader is set to null, shouldn't it be the current
> classloader? e.g."
>
>
> libLoader =
> SolrResourceLoader.createClassLoader(f,Thread.currentThread().getContextClassLoader(
> ));
>
>
> Thanks
>
>
> -John
>
> On Sun, Jul 5, 2009 at 11:38 PM, John Wang  wrote:
>
>> Hi Chris:
>>
>>  The problem is that (at least for me, not a expert spring'er) The
>> beans are being loaded (and when the class loading issue occurs) at
>> construction time of FileSystemXmlApplicationContex, the setClassLoader
>> method by the time can be called is too late.
>>
>> -John
>>
>>
>> On Thu, Jul 2, 2009 at 2:26 PM, Chris Hostetter > > wrote:
>>
>>>
>>> : I did try that. The problem is that you can't tell
>>> : FileSystemXmlApplicationContext to load with a different ClassLoader.
>>>
>>> why not?
>>>
>>> it subclasses DefaultResourceLoader which has the  setClassLoader method
>>> Mark pointed out.
>>>
>>>
>>>
>>> -Hoss
>>>
>>>
>>
>


Re: Solr spring application context error

2009-07-09 Thread Mark Miller

A value of null will cause the parent class loader to be set to:

Thread.currentThread().getContextClassLoader();

The context class loader for a given thread is the class loader that the 
threads creator wants you to use (good for servlet containers),
so looks right to me. If its not set, it will use the parent thread's 
class loader.


- Mark

John Wang wrote:

Hi guys:
 Could it be in method:load in class CoreContainer:

libLoader = SolrResourceLoader.createClassLoader(f, null);


   The parent ClassLoader is set to null, shouldn't it be the current
classloader? e.g."


libLoader =
SolrResourceLoader.createClassLoader(f,Thread.currentThread().getContextClassLoader(
));


Thanks


-John

On Sun, Jul 5, 2009 at 11:38 PM, John Wang  wrote:

  

Hi Chris:

 The problem is that (at least for me, not a expert spring'er) The
beans are being loaded (and when the class loading issue occurs) at
construction time of FileSystemXmlApplicationContex, the setClassLoader
method by the time can be called is too late.

-John


On Thu, Jul 2, 2009 at 2:26 PM, Chris Hostetter wrote:



: I did try that. The problem is that you can't tell
: FileSystemXmlApplicationContext to load with a different ClassLoader.

why not?

it subclasses DefaultResourceLoader which has the  setClassLoader method
Mark pointed out.



-Hoss


  


  



--
- Mark

http://www.lucidimagination.com





Re: Solr spring application context error

2009-07-09 Thread John Wang
Hi guys:
 Could it be in method:load in class CoreContainer:

libLoader = SolrResourceLoader.createClassLoader(f, null);


   The parent ClassLoader is set to null, shouldn't it be the current
classloader? e.g."


libLoader =
SolrResourceLoader.createClassLoader(f,Thread.currentThread().getContextClassLoader(
));


Thanks


-John

On Sun, Jul 5, 2009 at 11:38 PM, John Wang  wrote:

> Hi Chris:
>
>  The problem is that (at least for me, not a expert spring'er) The
> beans are being loaded (and when the class loading issue occurs) at
> construction time of FileSystemXmlApplicationContex, the setClassLoader
> method by the time can be called is too late.
>
> -John
>
>
> On Thu, Jul 2, 2009 at 2:26 PM, Chris Hostetter 
> wrote:
>
>>
>> : I did try that. The problem is that you can't tell
>> : FileSystemXmlApplicationContext to load with a different ClassLoader.
>>
>> why not?
>>
>> it subclasses DefaultResourceLoader which has the  setClassLoader method
>> Mark pointed out.
>>
>>
>>
>> -Hoss
>>
>>
>


Re: Solr spring application context error

2009-07-05 Thread John Wang
Hi Chris:

 The problem is that (at least for me, not a expert spring'er) The beans
are being loaded (and when the class loading issue occurs) at construction
time of FileSystemXmlApplicationContex, the setClassLoader method by the
time can be called is too late.

-John

On Thu, Jul 2, 2009 at 2:26 PM, Chris Hostetter wrote:

>
> : I did try that. The problem is that you can't tell
> : FileSystemXmlApplicationContext to load with a different ClassLoader.
>
> why not?
>
> it subclasses DefaultResourceLoader which has the  setClassLoader method
> Mark pointed out.
>
>
>
> -Hoss
>
>


Re: Solr spring application context error

2009-07-02 Thread Chris Hostetter

: I did try that. The problem is that you can't tell
: FileSystemXmlApplicationContext to load with a different ClassLoader.

why not?  

it subclasses DefaultResourceLoader which has the  setClassLoader method 
Mark pointed out.



-Hoss



Re: Solr spring application context error

2009-07-01 Thread John Wang
Hi Mark:

I did try that. The problem is that you can't tell
FileSystemXmlApplicationContext to load with a different ClassLoader.

-John

On Wed, Jul 1, 2009 at 4:20 PM, Mark Miller  wrote:

> I havn't done much a spring in a while, and I've never done anything
> hardcore, but could you:
>
> in your plugin code, grab the classloader of the plugin class and init the
> spring context with it?
>
> org.springframework.core.io.DefaultResourceLoader#setClassLoader
>
> Or you could use the solr classloader to load the spring context?
>
> Or perhaps we could provide access to the classLoader from the core?
>
>
> --
> --
> - Mark
>
> http://www.lucidimagination.com
>
>
> On Wed, Jul 1, 2009 at 6:52 PM, John Wang  wrote:
>
> > Hi guys:
> >
> >What is the plan with this issue? Should there be a bug created?
> >
> >I am having a similar issue from a different angle:
> >
> > 1) using spring which is instantiating beans when the plugins are loaded
> > 2) classloader mismatch.
> > 3) only way to resolve, copy my jars to solr.war's WEB-INF/lib
> >
> > -John
> >
> > On Thu, Jun 18, 2009 at 6:53 PM, Mark Miller 
> > wrote:
> >
> > > Chris Hostetter wrote:
> > >
> > >> : Yeah, I actually looked at the code and saw that later. I was
> > forgetting
> > >> the
> > >> : issue that bugged me (and confusing it with the trouble this guy was
> > >> having) -
> > >> : which is that plugins in the solr/lib folder cannot load from other
> > jars
> > >> in
> > >> : that folder. I think that was the actual issue.
> > >>
> > >> WTF?!? ... seriously?
> > >> I don't think i've ever tried it, but if that's really true then it
> > seems
> > >> like it must be a bug in URLClassLoader ... we're iterating over the
> > file
> > >> list to generate a URL[] before calling URLClassLoader.newInstance.
> > >>
> > >>
> > >> -Hoss
> > >>
> > >>
> > >>
> > > I have a fairly strong memory that its true - but its been almost a
> year
> > > now. I'll check when I get a chance. I also seem to remember mentioning
> > it
> > > to Erik and him already knowing of it...
> > >
> > > Or my mind is playing tricks on me. I'll check.
> > >
> > >
> > > --
> > > - Mark
> > >
> > > http://www.lucidimagination.com
> > >
> > >
> > >
> > >
> >
>


Re: Solr spring application context error

2009-07-01 Thread Mark Miller
I havn't done much a spring in a while, and I've never done anything
hardcore, but could you:

in your plugin code, grab the classloader of the plugin class and init the
spring context with it?

org.springframework.core.io.DefaultResourceLoader#setClassLoader

Or you could use the solr classloader to load the spring context?

Or perhaps we could provide access to the classLoader from the core?


-- 
-- 
- Mark

http://www.lucidimagination.com


On Wed, Jul 1, 2009 at 6:52 PM, John Wang  wrote:

> Hi guys:
>
>What is the plan with this issue? Should there be a bug created?
>
>I am having a similar issue from a different angle:
>
> 1) using spring which is instantiating beans when the plugins are loaded
> 2) classloader mismatch.
> 3) only way to resolve, copy my jars to solr.war's WEB-INF/lib
>
> -John
>
> On Thu, Jun 18, 2009 at 6:53 PM, Mark Miller 
> wrote:
>
> > Chris Hostetter wrote:
> >
> >> : Yeah, I actually looked at the code and saw that later. I was
> forgetting
> >> the
> >> : issue that bugged me (and confusing it with the trouble this guy was
> >> having) -
> >> : which is that plugins in the solr/lib folder cannot load from other
> jars
> >> in
> >> : that folder. I think that was the actual issue.
> >>
> >> WTF?!? ... seriously?
> >> I don't think i've ever tried it, but if that's really true then it
> seems
> >> like it must be a bug in URLClassLoader ... we're iterating over the
> file
> >> list to generate a URL[] before calling URLClassLoader.newInstance.
> >>
> >>
> >> -Hoss
> >>
> >>
> >>
> > I have a fairly strong memory that its true - but its been almost a year
> > now. I'll check when I get a chance. I also seem to remember mentioning
> it
> > to Erik and him already knowing of it...
> >
> > Or my mind is playing tricks on me. I'll check.
> >
> >
> > --
> > - Mark
> >
> > http://www.lucidimagination.com
> >
> >
> >
> >
>


Re: Solr spring application context error

2009-07-01 Thread John Wang
Hi guys:

What is the plan with this issue? Should there be a bug created?

I am having a similar issue from a different angle:

1) using spring which is instantiating beans when the plugins are loaded
2) classloader mismatch.
3) only way to resolve, copy my jars to solr.war's WEB-INF/lib

-John

On Thu, Jun 18, 2009 at 6:53 PM, Mark Miller  wrote:

> Chris Hostetter wrote:
>
>> : Yeah, I actually looked at the code and saw that later. I was forgetting
>> the
>> : issue that bugged me (and confusing it with the trouble this guy was
>> having) -
>> : which is that plugins in the solr/lib folder cannot load from other jars
>> in
>> : that folder. I think that was the actual issue.
>>
>> WTF?!? ... seriously?
>> I don't think i've ever tried it, but if that's really true then it seems
>> like it must be a bug in URLClassLoader ... we're iterating over the file
>> list to generate a URL[] before calling URLClassLoader.newInstance.
>>
>>
>> -Hoss
>>
>>
>>
> I have a fairly strong memory that its true - but its been almost a year
> now. I'll check when I get a chance. I also seem to remember mentioning it
> to Erik and him already knowing of it...
>
> Or my mind is playing tricks on me. I'll check.
>
>
> --
> - Mark
>
> http://www.lucidimagination.com
>
>
>
>


Re: Solr spring application context error

2009-06-18 Thread Mark Miller

Chris Hostetter wrote:

: Yeah, I actually looked at the code and saw that later. I was forgetting the
: issue that bugged me (and confusing it with the trouble this guy was having) -
: which is that plugins in the solr/lib folder cannot load from other jars in
: that folder. I think that was the actual issue.

WTF?!? ... seriously?  

I don't think i've ever tried it, but if that's really true then it seems 
like it must be a bug in URLClassLoader ... we're iterating over the file 
list to generate a URL[] before calling URLClassLoader.newInstance.



-Hoss

  
I have a fairly strong memory that its true - but its been almost a year 
now. I'll check when I get a chance. I also seem to remember mentioning 
it to Erik and him already knowing of it...


Or my mind is playing tricks on me. I'll check.

--
- Mark

http://www.lucidimagination.com





Re: Solr spring application context error

2009-06-18 Thread Chris Hostetter

: Yeah, I actually looked at the code and saw that later. I was forgetting the
: issue that bugged me (and confusing it with the trouble this guy was having) -
: which is that plugins in the solr/lib folder cannot load from other jars in
: that folder. I think that was the actual issue.

WTF?!? ... seriously?  

I don't think i've ever tried it, but if that's really true then it seems 
like it must be a bug in URLClassLoader ... we're iterating over the file 
list to generate a URL[] before calling URLClassLoader.newInstance.


-Hoss



Re: Solr spring application context error

2009-06-18 Thread Mark Miller

Chris Hostetter wrote:

: Date: Fri, 08 May 2009 08:27:58 -0400
: From: Mark Miller
: Subject: Re: Solr spring application context error
: 
: I've run into this in the past as well. Its fairly annoying. Anyone know why

: the limitation? Why aren't we passing the ClassLoader thats loading Solr
: classes as the parent to the lib dir plugin classloader?

FWIW: We do.  

I'm not sure what exactly the problem might have been in this thread 
(class loaders are nightmares, and spring doesn't make life any easier 
unless *everything* involved is using spring) but SolrResourceLoader uses 
Thread.currentThread().getContextClassLoader() to set the parent class 
loader unless an explict parent class loader was specified. (the webapp 
loader is the parent for the solr shardLib loader, which is the parent for 
the individual core loaders)


at least ... that's the way it use to work, and skimming the code it 
doesn't look like it's been broken (in an obvious way)


-Hoss

  
Yeah, I actually looked at the code and saw that later. I was forgetting 
the issue that bugged me (and confusing it with the trouble this guy was 
having) - which is that plugins in the solr/lib folder cannot load from 
other jars in that folder. I think that was the actual issue.


- Mark

--
- Mark

http://www.lucidimagination.com





Re: Solr spring application context error

2009-06-18 Thread Chris Hostetter
: Date: Fri, 08 May 2009 08:27:58 -0400
: From: Mark Miller
: Subject: Re: Solr spring application context error
: 
: I've run into this in the past as well. Its fairly annoying. Anyone know why
: the limitation? Why aren't we passing the ClassLoader thats loading Solr
: classes as the parent to the lib dir plugin classloader?

FWIW: We do.  

I'm not sure what exactly the problem might have been in this thread 
(class loaders are nightmares, and spring doesn't make life any easier 
unless *everything* involved is using spring) but SolrResourceLoader uses 
Thread.currentThread().getContextClassLoader() to set the parent class 
loader unless an explict parent class loader was specified. (the webapp 
loader is the parent for the solr shardLib loader, which is the parent for 
the individual core loaders)

at least ... that's the way it use to work, and skimming the code it 
doesn't look like it's been broken (in an obvious way)

-Hoss



Re: Solr spring application context error

2009-05-08 Thread sachin78

Iam having the same problem.Please let me know if anyone finds answer to
this.

Thank you,
Sachin


markrmiller wrote:
> 
> I've run into this in the past as well. Its fairly annoying. Anyone know 
> why the limitation? Why aren't we passing the ClassLoader thats loading 
> Solr classes as the parent to the lib dir plugin classloader?
> 
> - Mark
> 
> Erik Hatcher wrote:
>> This is probably because Solr loads its extensions from a custom class 
>> loader, but if that class then needs to access things from the 
>> classpath, it is only going to see the built-in WEB-INF/lib classes, 
>> not solr/home lib JAR files.  Maybe there is a Spring way to point it 
>> at that lib directory also?  This is the kinda pain we get, it seems, 
>> when reinventing a container, unfortunately.
>>
>> Erik
>>
>> On May 7, 2009, at 2:49 PM, Raju444us wrote:
>>
>>>
>>> I have configured solr using tomcat.Everything works fine.I overrode
>>> QParserPlugin and configured it.The overriden QParserPlugin has a 
>>> dependency
>>> on another project say project1.So I made a jar of the project and 
>>> copied
>>> the jar to the solr/home lib dir.
>>>
>>> the project1 project is using spring.It has a factory class which 
>>> loads the
>>> beans.Iam using this factory calss in QParserPlugin to get a bean.When I
>>> start my tomcat the factory class is loading fine.But the problem is 
>>> its not
>>> loading the beans.And Iam getting exception
>>>
>>> org.springframework.beans.factory.BeanDefinitionStoreException: 
>>> IOException
>>> parsing XML document from class path resource
>>> [com/mypackage/applicationContext.xml]; nested exception is
>>> java.io.FileNotFoundException: class path resource
>>> [com/mypackage/applicationContext.xml] cannot be opened because it 
>>> does not
>>> exist
>>>
>>> Do I need to do something else?. Can anybody please help me.
>>>
>>> Thanks,
>>> Raju
>>>
>>>
>>> -- 
>>> View this message in context: 
>>> http://www.nabble.com/Solr-spring-application-context-error-tp23432901p23432901.html
>>>  
>>>
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
> 
> 
> -- 
> - Mark
> 
> http://www.lucidimagination.com
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Solr-spring-application-context-error-tp23432901p23446518.html
Sent from the Solr - User mailing list archive at Nabble.com.



Re: Solr spring application context error

2009-05-08 Thread Mark Miller
I've run into this in the past as well. Its fairly annoying. Anyone know 
why the limitation? Why aren't we passing the ClassLoader thats loading 
Solr classes as the parent to the lib dir plugin classloader?


- Mark

Erik Hatcher wrote:
This is probably because Solr loads its extensions from a custom class 
loader, but if that class then needs to access things from the 
classpath, it is only going to see the built-in WEB-INF/lib classes, 
not solr/home lib JAR files.  Maybe there is a Spring way to point it 
at that lib directory also?  This is the kinda pain we get, it seems, 
when reinventing a container, unfortunately.


Erik

On May 7, 2009, at 2:49 PM, Raju444us wrote:



I have configured solr using tomcat.Everything works fine.I overrode
QParserPlugin and configured it.The overriden QParserPlugin has a 
dependency
on another project say project1.So I made a jar of the project and 
copied

the jar to the solr/home lib dir.

the project1 project is using spring.It has a factory class which 
loads the

beans.Iam using this factory calss in QParserPlugin to get a bean.When I
start my tomcat the factory class is loading fine.But the problem is 
its not

loading the beans.And Iam getting exception

org.springframework.beans.factory.BeanDefinitionStoreException: 
IOException

parsing XML document from class path resource
[com/mypackage/applicationContext.xml]; nested exception is
java.io.FileNotFoundException: class path resource
[com/mypackage/applicationContext.xml] cannot be opened because it 
does not

exist

Do I need to do something else?. Can anybody please help me.

Thanks,
Raju


--
View this message in context: 
http://www.nabble.com/Solr-spring-application-context-error-tp23432901p23432901.html 


Sent from the Solr - User mailing list archive at Nabble.com.





--
- Mark

http://www.lucidimagination.com





Re: Solr spring application context error

2009-05-08 Thread Raju444us

Paul/Erik,
  
   Thanks for your reply.I have the jar file containing the plugin code and
the applicationContext.xml in solr/home/lib directory.It is instantiating
the plugin code.But it is not loading the application context.xml file from
solr/home/lib dir.But when i copied the jar file containing the
applicationContext.xml file into the solr.war file's WEB-Inf/lib dir and
placed the solr.war file in tomcat's web-apps dir ,it worked.

As Erik said solr may only load the xml from solr.war file?

Please let me know if there is any way to do this by placing the
applicationContext.xml file in solr/home/lib.

Thanks,
Raju

   

Noble Paul നോബിള്‍  नोब्ळ्-2 wrote:
> 
> a point to keep in mind is that all the plugin code and everything
> else must be put into the solrhome/lib directory.
> 
> where have you placed the file com/mypackage/applicationContext.xml ?
> 
> On Fri, May 8, 2009 at 12:19 AM, Raju444us  wrote:
>>
>> I have configured solr using tomcat.Everything works fine.I overrode
>> QParserPlugin and configured it.The overriden QParserPlugin has a
>> dependency
>> on another project say project1.So I made a jar of the project and copied
>> the jar to the solr/home lib dir.
>>
>> the project1 project is using spring.It has a factory class which loads
>> the
>> beans.Iam using this factory calss in QParserPlugin to get a bean.When I
>> start my tomcat the factory class is loading fine.But the problem is its
>> not
>> loading the beans.And Iam getting exception
>>
>> org.springframework.beans.factory.BeanDefinitionStoreException:
>> IOException
>> parsing XML document from class path resource
>> [com/mypackage/applicationContext.xml]; nested exception is
>> java.io.FileNotFoundException: class path resource
>> [com/mypackage/applicationContext.xml] cannot be opened because it does
>> not
>> exist
>>
>> Do I need to do something else?. Can anybody please help me.
>>
>> Thanks,
>> Raju
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Solr-spring-application-context-error-tp23432901p23432901.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> -
> Noble Paul | Principal Engineer| AOL | http://aol.com
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Solr-spring-application-context-error-tp23432901p23444847.html
Sent from the Solr - User mailing list archive at Nabble.com.



Re: Solr spring application context error

2009-05-07 Thread Noble Paul നോബിള്‍ नोब्ळ्
a point to keep in mind is that all the plugin code and everything
else must be put into the solrhome/lib directory.

where have you placed the file com/mypackage/applicationContext.xml ?

On Fri, May 8, 2009 at 12:19 AM, Raju444us  wrote:
>
> I have configured solr using tomcat.Everything works fine.I overrode
> QParserPlugin and configured it.The overriden QParserPlugin has a dependency
> on another project say project1.So I made a jar of the project and copied
> the jar to the solr/home lib dir.
>
> the project1 project is using spring.It has a factory class which loads the
> beans.Iam using this factory calss in QParserPlugin to get a bean.When I
> start my tomcat the factory class is loading fine.But the problem is its not
> loading the beans.And Iam getting exception
>
> org.springframework.beans.factory.BeanDefinitionStoreException: IOException
> parsing XML document from class path resource
> [com/mypackage/applicationContext.xml]; nested exception is
> java.io.FileNotFoundException: class path resource
> [com/mypackage/applicationContext.xml] cannot be opened because it does not
> exist
>
> Do I need to do something else?. Can anybody please help me.
>
> Thanks,
> Raju
>
>
> --
> View this message in context: 
> http://www.nabble.com/Solr-spring-application-context-error-tp23432901p23432901.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
-
Noble Paul | Principal Engineer| AOL | http://aol.com


Re: Solr spring application context error

2009-05-07 Thread Erik Hatcher
This is probably because Solr loads its extensions from a custom class  
loader, but if that class then needs to access things from the  
classpath, it is only going to see the built-in WEB-INF/lib classes,  
not solr/home lib JAR files.  Maybe there is a Spring way to point it  
at that lib directory also?  This is the kinda pain we get, it seems,  
when reinventing a container, unfortunately.


Erik

On May 7, 2009, at 2:49 PM, Raju444us wrote:



I have configured solr using tomcat.Everything works fine.I overrode
QParserPlugin and configured it.The overriden QParserPlugin has a  
dependency
on another project say project1.So I made a jar of the project and  
copied

the jar to the solr/home lib dir.

the project1 project is using spring.It has a factory class which  
loads the
beans.Iam using this factory calss in QParserPlugin to get a  
bean.When I
start my tomcat the factory class is loading fine.But the problem is  
its not

loading the beans.And Iam getting exception

org.springframework.beans.factory.BeanDefinitionStoreException:  
IOException

parsing XML document from class path resource
[com/mypackage/applicationContext.xml]; nested exception is
java.io.FileNotFoundException: class path resource
[com/mypackage/applicationContext.xml] cannot be opened because it  
does not

exist

Do I need to do something else?. Can anybody please help me.

Thanks,
Raju


--
View this message in context: 
http://www.nabble.com/Solr-spring-application-context-error-tp23432901p23432901.html
Sent from the Solr - User mailing list archive at Nabble.com.