Hi
Just got my first bean deployed in JBoss but Im having difficulty trying to talk to it
from one of my java test classes.... Here's what Im trying to do....
Oh I should point out im new to all this stuff so apologies if its really simple...
try {
| ctx = new
ClassPathXmlApplicationContext("/applicationContext.xml");
|
| service = (TokenManagementService) ctx
| .getBean("tokenManagementService");
|
| } catch (BeansException e) {
| e.printStackTrace();
| throw new BusinessLogicException(e.getMessage());
| }
My applicationContext.xml looks like this....
<bean id="token"
class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
|
| <property name="jndiName">
| <value>ejb/tokenManagementService</value>
| </property>
|
| <property name="resourceRef">
| <value>true</value>
| </property>
|
| <property name="businessInterface">
| <value>
| aero.sita.gsl.bio.services.backEnd.tokenManagement.ITokenManagement
| </value>
| </property>
|
| </bean>
And this is the error that's spewing out....
27-Jul-2009 14:35:52 org.springframework.context.support.AbstractApplicationContext
prepareRefresh
| INFO: Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext@16f8cd0: display name
[org.springframework.context.support.ClassPathXmlApplicationContext@16f8cd0]; startup date
[Mon Jul 27 14:35:52 BST 2009]; root of context hierarchy
| 27-Jul-2009 14:35:52 org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
| INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
| 27-Jul-2009 14:35:53 org.springframework.context.support.AbstractApplicationContext
obtainFreshBeanFactory
| INFO: Bean factory for application context
[org.springframework.context.support.ClassPathXmlApplicationContext@16f8cd0]:
org.springframework.beans.factory.support.DefaultListableBeanFactory@1125127
| 27-Jul-2009 14:35:53
org.springframework.beans.factory.support.DefaultListableBeanFactory
preInstantiateSingletons
| INFO: Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@1125127: defining
beans [token]; root of factory hierarchy
| 27-Jul-2009 14:35:53
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
| INFO: Destroying singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@1125127: defining
beans [token]; root of factory hierarchy
| org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'token' defined in class path resource [applicationContext.xml]: Invocation of
init method failed; nested exception is javax.naming.NoInitialContextException: Need to
specify class name in environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
| at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
| at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
| at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
| at java.security.AccessController.doPrivileged(Native Method)
| at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
| at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
| at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
| at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
| at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
| at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
| at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
| at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
| at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
| at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
| at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
| at
aero.sita.gsl.bio.services.frontEnd.businessLogic.step.verification.ValidateTokenStep.processRequestImpl(ValidateTokenStep.java:39)
| at
aero.sita.gsl.bio.services.frontEnd.businessLogic.step.verification.TestValidateTokenStep.testProcessRequestImpl(TestValidateTokenStep.java:41)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at junit.framework.TestCase.runTest(TestCase.java:168)
| at junit.framework.TestCase.runBare(TestCase.java:134)
| at junit.framework.TestResult$1.protect(TestResult.java:110)
| at junit.framework.TestResult.runProtected(TestResult.java:128)
| at junit.framework.TestResult.run(TestResult.java:113)
| at junit.framework.TestCase.run(TestCase.java:124)
| at junit.framework.TestSuite.runTest(TestSuite.java:232)
| at junit.framework.TestSuite.run(TestSuite.java:227)
| at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
| at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
| Caused by: javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an application resource
file: java.naming.factory.initial
| at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
| at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
| at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
| at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
| at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
| at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
| at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:104)
| at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
| at
org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:121)
| at
org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:108)
| at
org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean.afterPropertiesSet(LocalStatelessSessionProxyFactoryBean.java:85)
| at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
| at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
| ... 35 more
| aero.sita.gsl.bio.services.frontEnd.commonCore.exception.BusinessLogicException: Error
creating bean with name 'token' defined in class path resource
[applicationContext.xml]: Invocation of init method failed; nested exception is
javax.naming.NoInitialContextException: Need to specify class name in environment or
system property, or as an applet parameter, or in an application resource file:
java.naming.factory.initial
| at
aero.sita.gsl.bio.services.frontEnd.businessLogic.step.verification.ValidateTokenStep.processRequestImpl(ValidateTokenStep.java:42)
| at
aero.sita.gsl.bio.services.frontEnd.businessLogic.step.verification.TestValidateTokenStep.testProcessRequestImpl(TestValidateTokenStep.java:41)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at junit.framework.TestCase.runTest(TestCase.java:168)
| at junit.framework.TestCase.runBare(TestCase.java:134)
| at junit.framework.TestResult$1.protect(TestResult.java:110)
| at junit.framework.TestResult.runProtected(TestResult.java:128)
| at junit.framework.TestResult.run(TestResult.java:113)
| at junit.framework.TestCase.run(TestCase.java:124)
| at junit.framework.TestSuite.runTest(TestSuite.java:232)
| at junit.framework.TestSuite.run(TestSuite.java:227)
| at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
| at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
All help is appreciated....
thanks
marty
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4246197#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...