|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
ClassLoader issuesI'm using Simple inside a framework which messes around with the class
loaders a bit; it has a bootstrap class loader which it uses to start execution, and then a new class loader is created inside this with access to all the useful classes. Unfortunately, this doesn't play nicely with Simple's classloader support, and it can't create any of the classes which are visible to the application while it's running. I've tried a few workarounds, but in the end I had to copy the source, and add a setClassLoader to TreeStrategy in order to get it to use the correct classloader. This seems like a useful feature to have, and other serialisation mechanisms support it. As far as I can tell, by default, since the Simple classes are loaded by the initial class loader, there's no other way to get it to use a new runtime class loader, but maybe I'm missing something? Cheers, dave -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) 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/devconference _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ClassLoader issuesHi,
There is, try this. try { Thread.currentThread().setContextClassLoader(myPreferredLoader); persister.read(SomeClass.class, someSource); }finally { Thread.currentThread().setContextClassLoader(someOtherLoader); } Niall Niall Gallagher RBS Global Banking & Markets Office: +44 7879498724 -----Original Message----- From: Dave Murray-Rust [mailto:d.murray-rust@...] Sent: 09 October 2009 12:11 To: simple-support@... Subject: [Simple-support] ClassLoader issues I'm using Simple inside a framework which messes around with the class loaders a bit; it has a bootstrap class loader which it uses to start execution, and then a new class loader is created inside this with access to all the useful classes. Unfortunately, this doesn't play nicely with Simple's classloader support, and it can't create any of the classes which are visible to the application while it's running. I've tried a few workarounds, but in the end I had to copy the source, and add a setClassLoader to TreeStrategy in order to get it to use the correct classloader. This seems like a useful feature to have, and other serialisation mechanisms support it. As far as I can tell, by default, since the Simple classes are loaded by the initial class loader, there's no other way to get it to use a new runtime class loader, but maybe I'm missing something? Cheers, dave -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) 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/devconference _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our website at www.rbs.com *********************************************************************************** ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) 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/devconference _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ClassLoader issuesThanks, that works great. (I was trying to do something similar when I
created the Persister, rather than at read time). Would you be open to adding a method to explicitly set a class loader? It would make for cleaner code than having to wrap every read call as below. Thanks very much! dave On 9 Oct 2009, at 12:42, <niall.gallagher@...> <niall.gallagher@... > wrote: > Hi, > > There is, try this. > > try { > Thread.currentThread().setContextClassLoader(myPreferredLoader); > persister.read(SomeClass.class, someSource); > }finally { > Thread.currentThread().setContextClassLoader(someOtherLoader); > } > > Niall > > > Niall Gallagher > RBS Global Banking & Markets > Office: +44 7879498724 > > -----Original Message----- > From: Dave Murray-Rust [mailto:d.murray-rust@...] > Sent: 09 October 2009 12:11 > To: simple-support@... > Subject: [Simple-support] ClassLoader issues > > I'm using Simple inside a framework which messes around with the > class loaders a bit; it has a bootstrap class loader which it uses > to start execution, and then a new class loader is created inside > this with access to all the useful classes. > > Unfortunately, this doesn't play nicely with Simple's classloader > support, and it can't create any of the classes which are visible to > the application while it's running. > > I've tried a few workarounds, but in the end I had to copy the > source, and add a setClassLoader to TreeStrategy in order to get it > to use the correct classloader. This seems like a useful feature to > have, and other serialisation mechanisms support it. > > As far as I can tell, by default, since the Simple classes are > loaded by the initial class loader, there's no other way to get it > to use a new runtime class loader, but maybe I'm missing something? > > Cheers, > dave > > -- > The University of Edinburgh is a charitable body, registered in > Scotland, with registration number SC005336. > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) 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/devconference > _______________________________________________ > Simple-support mailing list > Simple-support@... > https://lists.sourceforge.net/lists/listinfo/simple-support > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. > > This e-mail message is confidential and for use by the > addressee only. If the message is received by anyone other > than the addressee, please return the message to the sender > by replying to it and then delete the message from your > computer. Internet e-mails are not necessarily secure. The > Royal Bank of Scotland plc does not accept responsibility for > changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the > transmission of viruses, it is the responsibility of the recipient to > ensure that the onward transmission, opening or use of this > message and any attachments will not adversely affect its > systems or data. No responsibility is accepted by The > Royal Bank of Scotland plc in this regard and the recipient should > carry > out such virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > *********************************************************************************** > > -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) 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/devconference _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
| Free embeddable forum powered by Nabble | Forum Help |