-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: NullPointer with Hibernate/AspectJ CGLIB
PostPosted: Wed Sep 01, 2004 2:09 pm 
Newbie

Joined: Wed Sep 01, 2004 2:03 pm
Posts: 7
Hibernate version: 2.1

Mapping documents: N/A

Code between sessionFactory.openSession() and session.close(): N/A

Full stack trace of any exception that occurs:

13:57:18,207 INFO [SessionFactoryImpl] building session factory
13:57:18,504 INFO [STDOUT] java.lang.NullPointerException
13:57:18,504 INFO [STDOUT] at com.trifecta.buildserver.beans.User.setPassword_aroundBody1$advice(User.java:121)
13:57:18,504 INFO [STDOUT] at com.trifecta.buildserver.beans.User.setPassword(User.java)
13:57:18,504 INFO [STDOUT] at com.trifecta.buildserver.beans.User$$BulkBeanByCGLIB$$a639c238.setPropertyValues(<generated>)
13:57:18,504 INFO [STDOUT] at net.sf.hibernate.util.ReflectHelper.getBulkBean(ReflectHelper.java:141)
13:57:18,504 INFO [STDOUT] at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:754)
13:57:18,504 INFO [STDOUT] at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:715)
13:57:18,504 INFO [STDOUT] at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:41)
13:57:18,504 INFO [STDOUT] at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)
13:57:18,504 INFO [STDOUT] at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:750)
13:57:18,504 INFO [STDOUT] at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:417)
13:57:18,504 INFO [STDOUT] at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:355)
13:57:18,504 INFO [STDOUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:718)
13:57:18,504 INFO [STDOUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:213)
13:57:18,504 INFO [STDOUT] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159)
13:57:18,504 INFO [STDOUT] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:172)
13:57:18,504 INFO [STDOUT] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:272)
13:57:18,504 INFO [STDOUT] at org.springframework.web.context.support.XmlWebApplicationContext.refresh(XmlWebApplicationContext.java:131)
13:57:18,504 INFO [STDOUT] at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:154)
13:57:18,504 INFO [STDOUT] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:95)
13:57:18,504 INFO [STDOUT] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
13:57:18,504 INFO [STDOUT] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3805)
13:57:18,504 INFO [STDOUT] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4321)
13:57:18,504 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
13:57:18,504 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
13:57:18,504 INFO [STDOUT] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
13:57:18,504 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:57:18,504 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
13:57:18,504 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
13:57:18,504 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
13:57:18,504 INFO [STDOUT] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
13:57:18,504 INFO [STDOUT] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:109)
13:57:18,504 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
13:57:18,520 INFO [STDOUT] at org.apache.catalina.core.StandardContext.init(StandardContext.java:5412)
13:57:18,520 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:57:18,520 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
13:57:18,520 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
13:57:18,520 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
13:57:18,520 INFO [STDOUT] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:109)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
13:57:18,520 INFO [STDOUT] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:286)
13:57:18,520 INFO [STDOUT] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:70)
13:57:18,520 INFO [STDOUT] at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:306)
13:57:18,520 INFO [STDOUT] at org.jboss.web.WebModule.startModule(WebModule.java:62)
13:57:18,520 INFO [STDOUT] at org.jboss.web.WebModule.startService(WebModule.java:40)
13:57:18,520 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
13:57:18,520 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
13:57:18,520 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:57:18,520 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
13:57:18,520 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
13:57:18,520 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
13:57:18,520 INFO [STDOUT] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:837)
13:57:18,520 INFO [STDOUT] at $Proxy17.start(Unknown Source)
13:57:18,520 INFO [STDOUT] at org.jboss.system.ServiceController.start(ServiceController.java:367)
13:57:18,520 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
13:57:18,520 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
13:57:18,520 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
13:57:18,520 INFO [STDOUT] at $Proxy31.start(Unknown Source)
13:57:18,520 INFO [STDOUT] at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:313)
13:57:18,520 INFO [STDOUT] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:836)
13:57:18,520 INFO [STDOUT] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:645)
13:57:18,520 INFO [STDOUT] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
13:57:18,520 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
13:57:18,520 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
13:57:18,520 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
13:57:18,520 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
13:57:18,535 INFO [STDOUT] at $Proxy7.deploy(Unknown Source)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:478)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:274)
13:57:18,535 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
13:57:18,535 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
13:57:18,535 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
13:57:18,535 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
13:57:18,535 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
13:57:18,535 INFO [STDOUT] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:837)
13:57:18,535 INFO [STDOUT] at $Proxy0.start(Unknown Source)
13:57:18,535 INFO [STDOUT] at org.jboss.system.ServiceController.start(ServiceController.java:367)
13:57:18,535 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
13:57:18,535 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
13:57:18,535 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
13:57:18,535 INFO [STDOUT] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
13:57:18,535 INFO [STDOUT] at $Proxy4.start(Unknown Source)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.SARDeployer.start(SARDeployer.java:251)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:836)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:645)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
13:57:18,535 INFO [STDOUT] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:592)
13:57:18,535 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:57:18,535 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
13:57:18,535 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
13:57:18,551 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
13:57:18,551 INFO [STDOUT] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
13:57:18,551 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
13:57:18,551 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
13:57:18,551 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
13:57:18,551 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
13:57:18,551 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
13:57:18,613 INFO [STDOUT] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
13:57:18,613 INFO [STDOUT] at $Proxy5.deploy(Unknown Source)
13:57:18,613 INFO [STDOUT] at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:407)
13:57:18,613 INFO [STDOUT] at org.jboss.system.server.ServerImpl.start(ServerImpl.java:311)
13:57:18,613 INFO [STDOUT] at org.jboss.Main.boot(Main.java:145)
13:57:18,613 INFO [STDOUT] at org.jboss.Main$1.run(Main.java:399)
13:57:18,613 INFO [STDOUT] at java.lang.Thread.run(Thread.java:534)

Name and version of the database you are using: MySQL Max 4.x

Debug level Hibernate log excerpt:


I have an aspect which advises 2 setter methods of my User class. This stacktrace is what happens when the woven .class file is modified by Hibernate when JBoss starts.

Here is the Aspect:

public aspect EncryptionAspect {

public pointcut passwordOperations(String password) :
execution(public void *.set*Password(String)) && args(password);

void around(String password) : passwordOperations(password)
{
try
{
MessageDigest md = MessageDigest.getInstance("MD5");
password = new String(md.digest(password.getBytes()));
}
catch(Exception e)
{
e.printStackTrace();
System.exit(0);
}

proceed(password);
}
}

The User class is a straight forward basic javabean w/ getters/setters etc.

Anyone know why this is happening, how to fix it?

Thanks!!!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 01, 2004 2:13 pm 
Newbie

Joined: Wed Sep 01, 2004 2:03 pm
Posts: 7
Follow up:

When I comment out this section of the advice:

void around(String password) : passwordOperations(password)
{
/* try
{
MessageDigest md = MessageDigest.getInstance("MD5");
password = new String(md.digest(password.getBytes()));
}
catch(Exception e)
{
e.printStackTrace();
System.exit(0);
}
*/
proceed(password);
}


... everything starts fine (no execeptions on startup), but my passwords do not get encrypted. This must be caused by something between the /* */ but I don't know what. Am I doing something stupid here?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 01, 2004 2:38 pm 
Newbie

Joined: Wed Sep 01, 2004 2:03 pm
Posts: 7
Answer:

Here is what I got to work:

void around(String password) : passwordOperations(password)
{
try
{
MessageDigest md = MessageDigest.getInstance("MD5");
password = new String(md.digest(password.getBytes()));
}
catch(Exception e)
{
}
finally
{
proceed(password);
}
}


It seems that the e.printStackTrace(); inside the catch block wasn't meshing too well with Hibernate/AspectJ.

Still don't quite understand the full reasoning behind this solution.

Feel free to comment.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.