This content has been marked as final.
Show 1 reply
-
1. Re: How to access class of EJB Session Bean from listener MB
vit.jonas Mar 26, 2009 10:00 AM (in response to vit.jonas)OK, I was finaly able to solve this by EJB3Deployer source code. I use following snipet to extract informations about classes in deployed jar:
DeploymentInfo info = (DeploymentInfo)notification.getUserData(); Iterator it = ArchiveBrowser.getBrowser(info.localUrl, new MyClassFileFilter()); try { while (it.hasNext()) { InputStream stream = (InputStream) it.next(); DataInputStream dstream = new DataInputStream(new BufferedInputStream(stream)); ClassFile cf = null; try { cf = new ClassFile(dstream); log.debug("ClassFile: " + cf.getName()); AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag); if (visible != null) { Annotation myAnnotation = visible.getAnnotation("my.test.MyAnnotation"); if(myAnnotation != null) { ... } } } finally { dstream.close(); stream.close(); } } } catch (IOException e) { }