I am also looking into embedding Merlin into a webapps, how is it possible to:
Doing some architecture work, too see how Merlin could fit for a project: 1) Embed Merlin in a webapp (using an external repository at another location in the file system). 2) For service (in this case a singleton) to expose itself using JNDI. 3) For code executing on the HTTP processing thread such as a class being called from a .JSP-page to access that Service. 1 and 2 is fairly easy, did a prototype of that already, it works fine, as well as looking up the service using JNDI, but... When I try to make calls to that service I get ClassNotFound exceptions for the implementation classes for the Service (only when called from the HTTP request thread, otherwise it runs fine). This makes sense because the service was loaded using a merlin class loader called from the init() in the servlet, and the HTTP request is from a thread pool that has the Web Container (Tomcat) classpath setup. Moving the required files into /WEB-INF/lib/ does not help (gives ClassCastExceptions instead for some reason...) Any ideas how this could be resolved, besides using some kind of remoting? Which would be my next option I would think... / Nicolai > -----Original Message----- > From: Stephen McConnell [mailto:[EMAIL PROTECTED] > Sent: Friday, February 06, 2004 7:16 PM > To: Avalon framework users > Subject: Re: Webapp example > > > Eric: > > In your scenario are you dealing with a single servlet, > multiple-servlet, single web-app, or multiple web-apps? Multi > servlet scenarios should be fine. > > The objective of the merlin-in-a-servlet is rather simple - > namely the deployment of merlin as a web-application. In > this context the web-server is in control with respect to the > setup of the parent classloader and the deployment of a > servlet that embeds Merlin. Merlin then kicks in as part of > the servlet initialization with its component deployment stuff. > > In the setup of the system I just used the default behavior > which is for merlin to use the ${merlin.home}/system > repository for internals and ${avalon.home}/repository for > application content loading. I know others are declaring > classloader resources independently of the repository by > using local fileset declarations in the classloader > definition instead. > > I have not personally tried to fully package merlin in a > web-app using only content in a web-inf/ directory. There is > a crunch point concerning the loading of content from within > a war file. Merlin uses plain vanilla URLClassLoaders - > however - this imposes the restriction that the jar files > included in the classloaders are actual files in the file > system (as opposed to jar in a war). To bypass this problem > one would need to write an new classloader (like what Tomcat > provides). On the other hand - if you running in an > environment where you know content is unpacked - then it > should be possible to configure merlin to work off the unpacked files. > > Just a final note - I'm currently experimenting with a merlin > loading and deploying components that provide direct support > for http service requests which is looking promising. > > Stephen. > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
