From: grafpoo <nu...@jb...> - 2005-04-28 21:25:48
|
i am having trouble getting mixin functionality to work. what i am trying to do is to assign a unique ID to hibernate sessions so i can track them in a logging aspect i've created. the aspect works, but Session.toString() generates a big old verbose string that i don't really want to try to parse. so i created an interface: package foo.aop; public interface SessionIdentifier { public String getId(); } and my mixin class: package foo.aop; import java.io.UnsupportedEncodingException; import java.security.SecureRandom; import org.apache.commons.codec.binary.Base64; public class JbossSessionMixin implements SessionIdentifier { private String id; private static SecureRandom randy = new SecureRandom(); private static Base64 base64 = new Base64(); public JbossSessionMixin() { try { byte[] b = new byte[4]; randy.nextBytes(b); id = new String(base64.encode(b), "UTF-8"); } catch (UnsupportedEncodingException e) { id = "--ERROR--"; } } public String getId() { return id; } } and my jboss-aop.xml [?xml version="1.0" encoding="UTF-8"?] [aop] [introduction class="org.hibernate.impl.SessionImpl"] [mixin] [interfaces]foo.aop.SessionIdentifier[/interfaces] [class]foo.aop.JbossSessionMixin[/class] [/mixin] [/introduction] [/aop] i package this as a sarfile which contains my war file and a foo.aop, which has the the two class files above and the jboss-aop.xml - the two class files are also in a jar in the war's WEB-INF/lib when i try to deploy the sar, i get the following error: 2005-04-28 15:07:14,543 INFO [STDOUT] org.jboss.aop.instrument.TransformationException: Failed to aspectize class org.hibernate.impl.SessionImpl. Could not find class it references foo.aop.JbossSessionMixin It may not be in your classpath and you may not be getting field and constructor weaving for this class. 2005-04-28 15:07:14,543 INFO [STDOUT] at org.jboss.aop.instrument.Instrumentor.convertReferences(Instrumentor.java:543) 2005-04-28 15:07:14,543 INFO [STDOUT] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:579) just for grins, i added a jar file with the 'missing' class and interface in server/all/lib in jboss, but i still get the same error, so it doesn't seem to be a true classpath problem. if anyone can tell me what i am missing i will be very grateful. thanks. john View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3875845#3875845 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3875845 |