This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Spring and the fly likes Error creating bean with name 'jotm' defined in ServletContext resource [/WEB-INF/classes/data/confi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Error creating bean with name Watch "Error creating bean with name New topic
Author

Error creating bean with name 'jotm' defined in ServletContext resource [/WEB-INF/classes/data/confi

Ramasubramaniam Rathinasubbu
Ranch Hand

Joined: Jun 09, 2010
Posts: 44
During the development i am getting the following error, very frequently i am getting following error.

javax.servlet.ServletException: Error creating bean with name 'jotm' defined in ServletContext resource [/WEB-INF/classes/data/config/spring/emr-spring-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.transaction.jta.JotmFactoryBean]: Constructor threw exception; nested exception is java.lang.NullPointerException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)


root cause

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jotm' defined in ServletContext resource [/WEB-INF/classes/data/config/spring/emr-spring-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.transaction.jta.JotmFactoryBean]: Constructor threw exception; nested exception is java.lang.NullPointerException
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:946)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:540)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
java.lang.Thread.run(Thread.java:619)


root cause

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.transaction.jta.JotmFactoryBean]: Constructor threw exception; nested exception is java.lang.NullPointerException
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:938)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:540)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
java.lang.Thread.run(Thread.java:619)


root cause

java.lang.NullPointerException
org.objectweb.carol.util.configuration.TraceCarol.isDebugRmiCarol(TraceCarol.java:154)
org.objectweb.carol.rmi.multi.MultiPRODelegate.exportObject(MultiPRODelegate.java:96)
javax.rmi.PortableRemoteObject.exportObject(PortableRemoteObject.java:87)
javax.rmi.PortableRemoteObject.<init>(PortableRemoteObject.java:71)
org.objectweb.jotm.TransactionFactoryImpl.<init>(TransactionFactoryImpl.java:65)
org.objectweb.jotm.Jotm.<init>(Jotm.java:137)
org.springframework.transaction.jta.JotmFactoryBean.<init>(JotmFactoryBean.java:79)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:938)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:540)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
java.lang.Thread.run(Thread.java:619)

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

"Could not instantiate bean class [org.springframework.transaction.jta.JotmFactoryBean]: Constructor threw exception; nested exception is java.lang.NullPointerException"

That is your error.

What is on this line of code


java.lang.NullPointerException
org.objectweb.carol.util.configuration.TraceCarol.isDebugRmiCarol(TraceCarol.java:154)

TraceCarol.java at line 154. That is where the NPE is being thrown. So something isn't set up.

It looks like you are using JTA, so you are deploying on an App Server? Or are you providing a third party JTA Transaction Manager product?

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ramasubramaniam Rathinasubbu
Ranch Hand

Joined: Jun 09, 2010
Posts: 44
Yes, I am using third party JPA

<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/>
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Ramasubramaniam Rathinasubbu wrote:Yes, I am using third party JPA

<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/>


I asked JTA, not JPA.

Anyway, if you are using a third party JTA, not JPA, then maybe you have conflicting versions of some sort, or some extra properties that are required to be set, that you aren't in your config to cause the NullPointerException to be thrown.

What is at
TraceCarol.java at line 154.

That is where the NPE is being thrown, that is where you will see what is set to null. But we can't help without seeing that line of code.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error creating bean with name 'jotm' defined in ServletContext resource [/WEB-INF/classes/data/confi