Why can't my regular application context load my properties file? - java

I'm trying to use the PropertyPlaceholderConfigurer in my application. My applicationContext-test.xml loads my properties file just fine, but my applicationContext.xml throws an exception. In both cases, I'm loading my properties file like this:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>localdevelopment_Company.properties</value>
</property>
</bean>
When I run my tests, it does not complain, but when I start my server, I get this exception:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/localdevelopment_Company.properties]
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:638)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/localdevelopment_Company.properties]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:117)
at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:181)
at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:69)
... 21 more
I'm driving myself crazy trying to get this to work. Can someone help?

This comes down to where different application contexts look for their resources.
A unit test context looks at the classpath, but a webapp context looks inside the webapp. So when your webapp looks for localdevelopment_Company.properties, it's looking for a file at the root of the webapp.
If your file is actually on the classpath, then you need to override the webapp context's default search location:
<value>classpath:localdevelopment_Company.properties</value>

Related

Springboot - packaging issue

I have a springboot app which runs fine from the IDE (IntelliJ) but does not run when I copy the boot jar into a different clean folder (in windows).
The error I get is as follows:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:104)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:61)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.reflect.InvocationTargetException
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 org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
... 3 more
Caused by: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: JAR entry n.properties not found in .\cef-fulltext-updater-exec.jar
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:89)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:166)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
at com.elsevier.cef.fulltext.updater.configuration.FulltextUpdaterApplication.main(FulltextUpdaterApplication.java:10)
... 8 more
Caused by: java.io.FileNotFoundException: JAR entry n.properties not found in .\cef-fulltext-updater-exec.jar
Strangely I do not get this error when I run with the same jar file in linux ec2 instance.
Why would this happen?
p.s. I have tried several things but its taking me in various random paths which do not seem to answer this basic question.

Failed instantiate InitialContextFactory

I've tried looking for the solution for failed to instantiate InitialContextFactory however their answer seems not to be working, I've tried running this on both JBoss 6 EAP and JBoss 7 AS so it seems something I am doing wrong.
this is how I initialize InitialContext:
public static Context getInitialContext( )
throws javax.naming.NamingException {
Properties p = new Properties( );
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
return new javax.naming.InitialContext(p);
}
this is the stacktrace:
javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.SpringCounterWebApp.war:main" from Service Module Loader
org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:664)
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
javax.naming.InitialContext.init(InitialContext.java:223)
javax.naming.InitialContext.<init>(InitialContext.java:197)
com.example.jms.TopicExample.getInitialContext(TopicExample.java:111)
com.example.jms.TopicExample.example(TopicExample.java:32)
com.example.rest.OrderInfoImpl.test(OrderInfoImpl.java:44)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:165)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:92)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:209)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:152)
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:113)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)
any help would be appreciated.
Inside an app server, all you should have to do is new InitialContext(), without any argument. JNDI is pre-configured with the appropriate properties for you, by the app server.

java.lang.NoClassDefFoundError: org/springframework/orm/hibernate3/support/HibernateDaoSupport

I'm working with Java web development, using spring3.1.1+hibernate3.6.0+tomcat7.0.29 + mysql5.5, but after running on my server, Eclipse prompted that
HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/orm/hibernate3/support/HibernateDaoSupport
and as follows in detail,
type Exception report
message Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/orm/hibernate3/support/HibernateDaoSupport
description The server encountered an internal error (Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/orm/hibernate3/support/HibernateDaoSupport) that prevented it from fulfilling this request.
exception
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/orm/hibernate3/support/HibernateDaoSupport
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:972)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.NoClassDefFoundError: org/springframework/orm/hibernate3/support/HibernateDaoSupport
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:791)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
cc.fanbang.api.manager.DBManager.addUser(DBManager.java:139)
cc.fanbang.api.controller.TestController.handleDBManagerTestRequest(TestController.java:42)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.support.HibernateDaoSupport
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:791)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
cc.fanbang.api.manager.DBManager.addUser(DBManager.java:139)
cc.fanbang.api.controller.TestController.handleDBManagerTestRequest(TestController.java:42)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
I can't understand why it told me that no hibernatedaosupport, and I've imported it in the project in referenced libraries and web-inf/lib.
packages which I've imported as follows,
commons-beanutils-1.8.3.jar
commons-coder-1.4.jar
commons-io-2.3.jar
commons-lang-2.6.jar
commons-logging-1.1.1.jar
ezorph-1.0.6.jar
json-lib-2.4-jdk15.jar
jstl-1.2.jar
org.springframework.asm-3.1.1.release.jar
org.springframework.beans-3.1.1.release.jar
org.springframework.context-3.1.1.release.jar
org.springframework.core-3.1.1.release.jar
org.springframework.expression-3.1.1.release.jar
org.springframework.web.servlet-3.1.1.release.jar
org.springframework.web-3.1.1.release.jar
servlet-api.jar
antlr-2.7.6
c3p0-0.9.1.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
ehcache-1.5.0.jar
hibernate-jpa-2.0-api-1.0.1.final.jar
hibernate3.jar
javassist-3.12.0.ga.jar
jta-1.1.jar
mysql-connector-java-5.1.12-bin.jar
org.springframework.orm-3.1.1.release.jar
org.springframework.jdbc-3.1.1.release.jar
org.springframework.aop-3.1.1.release.jar
org.springframework.transaction-3.1.1.release.jar
slf4j-api-1.6.1.jar
slf4j-nop-1.6.1.jar
and the part contents of applicationContext.xml related to transaction process as follows,
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="fbPointcut" expression="bean(dbManager)" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="fbPointcut" />
</aop:config>
NoClassDefFoundError means that the class loader cannot find a class which org.springframework.orm.hibernate3.support.HibernateDaoSupport depends on. Not that HibernateDaoSupport itself is missing. The best way to find which dependency is missing is to look at the import section of HibernateDaoSupport
It seems you are missing org.springframework.dao library in your classpath.
I think it is because you have a different version of spring-orm jar in your library which has the org.springframework.orm.hibernate3.support.HibernateDaoSupport class.
Add spring-orm 3.1 jar to your lib. You can find the jar download link at the bottom.
In general if you get a NoClassDefFoundError, google for the jar that has the class. Maven Central Repository is a good place to do that.
Your spring aop, jdbc and transaction jars are also of different version (3.0.7 and not 3.1.1). Always use jars of same versions . There are chances that application might throw some error if you use different versions of jars.
14.3 Hibernate
We will start with a coverage of Hibernate 3 in a Spring environment,
using it to demonstrate the approach that Spring takes towards
integrating O/R mappers. This section will cover many issues in detail
and show different variations of DAO implementations and transaction
demarcation. Most of these patterns can be directly translated to all
other supported ORM tools. The following sections in this chapter will
then cover the other ORM technologies, showing briefer examples there.
Note: As of Spring 3.0, Spring requires Hibernate 3.2 or later.
Source: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/orm.html#orm-hibernate
Your Hibernate Version is too old.
On re-reading your question, you say you are using Hibernate 3.6, yet you list hibernate3.jar among your dependencies. Which is it?

Maven issue - dependency(class not found exception)

I'm starting on a new project, and it seems to have some problems related to Maven. When I try to start my web app, it gives errors related to bean factory creation, because cannot find a class referenced in other project. In such scenario, I need to stop the server, run the pom.xml for that other project, run pom.xml for my project and then restart the server. It seems strange to me, if they are related, shoudn't maven run that dependency automatically?
See the error message below:
2012-08-03 08:55:01,374 [domain-service:main][ERROR] org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'assetService' defined in URL [file:/C:/Springsource/tc-server-6.0.20.domain.service/wtpwebapps/pumpkin-domain-service/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/pumpkin/service/exception/ServiceException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:741)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:587)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:290)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Caused by: java.lang.NoClassDefFoundError: com/pumpkin/service/exception/ServiceException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1890)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:887)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1351)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1230)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:65)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
... 28 more
Any help is very appreciated!
Thank you in advance!
I always like to put my answer when I get it so I can help someone that comes to the page looking for a solution... I looked more on the internet and finally found the solution on other stackoverflow post:
Maven dependencies are not always transitive. If taac-backend-gui
declares its dependency on com.wuntee.rsaAuthenticationManager with
scope="test" or optional="true", com.wuntee.rsaAuthenticationManager
won't automatically become a dependency of com.wuntee.taac Either of
these would be consistent with the symptoms you describe.
Cheers!

Hibernate Error Message

I have scoured the web in search of a solution to this problem, but with little to no luck. I am using Hibernate with MS SQL Server, Flex and Java on Eclipse Helios. When I try to run the mxml file on my Tomcat server, I get the following (abbreviated) error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.flex.remoting.RemotingDestinationExporter#0': Invocation of init method failed; nested exception is flex.messaging.config.ConfigurationException:Cannot add destination with id 'myDestination' to service with id 'remoting-service' because another service with id 'remoting-service' already has a destination with the same id.
Here is the corresponding stack trace:
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Can anybody shed some light on this? I'd be more than happy to provide any additional info. Thanks.
looks like you have multiple xml (configuration) files and one of them has the id as remoting-service.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.flex.remoting.RemotingDestinationExporter#0': Invocation of init method failed; nested exception is flex.messaging.config.ConfigurationException:Cannot add destination with id 'myDestination' to service with id 'remoting-service' because
another service with id 'remoting-service' already has a destination with the same id.
you need to check all your spring config files to find & rename on of the id's.

Categories

Resources