Kevin Sutter wrote: > > I would suggest turning this option off and using either static > enhancement > via the PCEnhancer tool or using the -javaagent option like you suggested. > If both of these problems are resolved by using one of this preferred > enhancement processes, then I would suggest that we open another JIRA with > these additional short comings. > > Document for the RuntimeUnenhancedClasses property can be found here [2]. > FYI, WebSphere Application Server runs with this option set to "warn". > This > way, a warning message gets issued and we still don't fallback to this > subclassing mechanism. > > Let me know your results.
Well, as I mentioned in my previous post I haven't had that much luck with command line usage of PCEnhancer. So I thought it would be nice to use javaagent with Tomcat. Here is what I learnt. Tomcat fails to start when I pass -javaagent to its JVM. I found that it's possibe to register javaagent AFTER JVM has started as it's described here http://java.sun.com/javase/6/docs/api/java/lang/instrument/package-summary.html In testing console application following code at the beginning of main() works fine: PCEnhancerAgent.premain("", InstrumentationFactory.getInstrumentation()); I thought I'd put at the beginning of ServletContextListener.contextInitialized() but it was throwing exception that it couldn't find class PCEnhancer because it uses system classloader. So I tried to do little hack like this ClassPathHacker.addFile("C:\\Program Files\\Java\\jdk1.6.0_10\\lib\\tools.jar"); ClassPathHacker.addFile("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\lib\\openjpa-1.3.0-SNAPSHOT.jar"); ClassPathHacker.addFile("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\lib\\commons-lang-2.1.jar"); ClassPathHacker.addFile("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\lib\\commons-collections-3.2.jar"); ClassPathHacker.addFile("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\lib\\serp-1.13.1.jar"); ClassPathHacker.addFile("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\lib\\geronimo-jta_1.1_spec-1.1.jar"); ClassPathHacker.addFile("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\lib\\geronimo-jpa_3.0_spec-1.0.jar"); PCEnhancerAgent.premain("", InstrumentationFactory.getInstrumentation(AppListener.class.getClassLoader())); It works but looks scary, plus paths are hardcoded. Finally I ended up with putting this at ServletContextListener.contextInitialized() PCEnhancer.main(new String[0]); So it tries to enhance everything every reload of my web-app. Do you thing it's ok approach ? -- View this message in context: http://n2.nabble.com/Re%3A-Foreign-key-field-doesn%27t-get-populated-in-descendant-class-in-Join-Inheritance-tp1574111p1579019.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
