From: <leg...@at...> - 2003-09-24 16:17:55
|
The following comment has been added to this issue: Author: Ethan Wolf Created: Wed, 24 Sep 2003 11:16 AM Body: I don't think lazy loading of the mapping files gets around the problem I experienced. (Just to be sure, I tried to incorporate the patch into my project last night and gave it a test. Assuming that I did it coreectly, the ManagedConnectionFactory still didn't find the mapping files.) The way I understand it, the non-lazy strategy causes the class loader from the component deployer thread to be used in the initialize method, while lazy loading causes the class loader from the application thread to get used. Unfortunately, neither of these class loaders works in my deployment. (I tried to summarize my deployment in http://forum.hibernate.org/viewtopic.php?p=2187#2187 ). Since my mapping files are deployed with the connector (a .rar in WebLogic and a -ds configuration in JBoss that refers to hibernate.rar), I need them to be loaded by a class loader associated with the connector itself. I had success getting the class loader from the ManagedConnectionFactoryImpl class itself, and to be honest, I'm not sure whether there is a thread associated with the connector rather than a connector client or a deployer.) While I think it is a cool idea to do the lazy loading of the mapping files. I worry that it means the client application is configuring the connector (instead of making it part of the connector deployment). It seems to me that the configuration one gets when doing a JNDI lookup would depend on random things like which application happens to call the connector first. (This works fine when the .rar is packaged as part of the ear, but in the case that the rar is a utility used by multiple application it gets a bit wacky.) From what I've read, I'm not entirely sure what the correct deployment is, but I certainly think that it seems much cooler to make the hibernate connector a configured utility that gets used by multiple applications (like a configured datasource). If you need any more information about my deployment, let me know. I've written an ant script to package and deploy my version of hibernate.rar and a connector configuration. I have deployments for both JBoss and WebLogic. I'd be very happy to share the script with you/the community if you give me a few days to clean up a bit and extract it from my project specific stuff. That way you can replicate my way of deploying and see if it makes sense or is moronic. Let me know if that would be useful. (Feedback would certainly be useful for me!) --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-330 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-330 Summary: Loading mapping files from ManagedConnectionFactoryImpl in WebLogic Type: Bug Status: Unassigned Priority: Minor Project: Hibernate2 Components: core Versions: 2.0.1 Assignee: Reporter: Ethan Wolf Created: Fri, 12 Sep 2003 1:31 PM Updated: Fri, 12 Sep 2003 1:31 PM Environment: Windows 2000, WebLogic 8.1 (on windows 2000) Description: ManagedConnectionFactoryImpl.initialize() passes the contextClassLoader from the thread to load the mapping files in Configuration.addResource. This works fine (in both JBoss and WebLogic) IF the mapping files are on the class path of the application server. It also works on JBoss when the mapping files are packaged with the connector deployment (-ds.xml). (The mapping files are found through JBoss' UnifiedClassLoader architecture.) However, in WebLogic, the configuration files are not found when they are packaged with the individual deployment. This seems to be because the thread that deploys the component corresponds to the root thread on the application server, and therefore uses the Launcher$AppClassLoader. The actual class loader used to load the deployed connector (GenericClassLoader) is managed by the deploymer components of weblogic. Changin the class loader passed to Configuration.addResource by the ManagedConnectionFactoryImpl to getClass().getClassLoader() seems to result in the desired ability to load the mapping files from the deployment directory. Since the ManagedConnectionFactoryImpl is only used when deploying to an application server, I would assume that this has no adverse affects and it seems correct, but these class loader issues are quite mind boggling. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |