I have changed `context.xml` file according to your broadleaf configuration.
I am still getting error for `entityManagerFactory`
尝试在tomcat7独立服务器上部署时出现此错误。它在Eclipse IDE中完美运行。
INFO: Deploying web application archive /var/lib/tomcat7/webapps/demo.war
912 [searcherExecutor-5-thread-1] INFO org.apache.solr.core.SolrCore – [core1] webapp=null path=null params={event=firstSearcher&q=static+firstSearcher+warming+in+solrconfig.xml&distrib=false} hits=0 status=0 QTime=44
912 [searcherExecutor-5-thread-1] INFO org.apache.solr.core.SolrCore – QuerySenderListener done.
913 [searcherExecutor-5-thread-1] INFO org.apache.solr.core.SolrCore – [core1] Registered new searcher Searcher@652acafc[core1] main{StandardDirectoryReader(segments_315:11774:nrt _313(4.7):C36)}
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/tomcat7/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/lib/tomcat7/webapps/demo/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[ WARN] 13:17:38 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[ERROR] 13:17:40 ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in resource loaded from byte array: Cannot resolve reference to bean 'blPersistenceUnitManager' while setting bean property 'persistenceUnitManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blPersistenceUnitManager' defined in resource loaded from byte array: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1158)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.broadleafcommerce.common.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:701)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blPersistenceUnitManager' defined in resource loaded from byte array: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
... 30 more
Caused by: java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException
at org.broadleafcommerce.common.extensibility.jpa.MergePersistenceUnitManager.preparePersistenceUnitInfos(MergePersistenceUnitManager.java:230)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.afterPropertiesSet(DefaultPersistenceUnitManager.java:352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
... 37 more
Caused by: java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy24.addTransformer(Unknown Source)
at org.broadleafcommerce.common.extensibility.jpa.MergePersistenceUnitManager.preparePersistenceUnitInfos(MergePersistenceUnitManager.java:212)
... 40 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager$Jpa2PersistenceUnitInfoDecorator.invoke(DefaultPersistenceUnitManager.java:635)
... 42 more
Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:109)
... 47 more
18 Jan, 2015 1:17:40 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
18 Jan, 2015 1:17:40 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/demo] startup failed due to previous errors
18 Jan, 2015 1:17:40 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/demo] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
18 Jan, 2015 1:17:40 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/demo] appears to have started a thread named [PoolCleaner[219410827:1421567252715]] but has failed to stop it. This is very likely to create a memory leak.
18 Jan, 2015 1:17:40 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/demo] created a ThreadLocal with key of type [org.broadleafcommerce.common.classloader.release.ThreadLocalManager$2] (value [org.broadleafcommerce.common.classloader.release.ThreadLocalManager$2@51fe6403]) and a value of type [org.broadleafcommerce.common.extensibility.jpa.ConfigurationOnlyState] (value [org.broadleafcommerce.common.extensibility.jpa.ConfigurationOnlyState@14582b03]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
18 Jan, 2015 1:17:40 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/demo] created a ThreadLocal with key of type [org.broadleafcommerce.common.classloader.release.ThreadLocalManager$1] (value [org.broadleafcommerce.common.classloader.release.ThreadLocalManager$1@286fdc64]) and a value of type [org.broadleafcommerce.common.classloader.release.ThreadLocalManager] (value [org.broadleafcommerce.common.classloader.release.ThreadLocalManager@47ee3df9]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
18 Jan, 2015 1:17:40 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
18 Jan, 2015 1:17:41 PM org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSourceFactory]
18 Jan, 2015 1:17:41 PM org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSourceFactory]
18 Jan, 2015 1:17:41 PM org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSourceFactory]
18 Jan, 2015 1:17:41 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8983"]
18 Jan, 2015 1:17:41 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 15250 ms
18 Jan, 2015 1:18:02 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load org.apache.tomcat.jdbc.pool.FairBlockingQueue$FairIterator. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1587)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
at org.apache.tomcat.jdbc.pool.FairBlockingQueue.iterator(FairBlockingQueue.java:233)
at org.apache.tomcat.jdbc.pool.ConnectionPool.checkIdle(ConnectionPool.java:988)
at org.apache.tomcat.jdbc.pool.ConnectionPool.checkIdle(ConnectionPool.java:980)
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1348)
at java.util.TimerThread.mainLoop(Timer.java:534)
at java.util.TimerThread.run(Timer.java:484)
Exception in thread "PoolCleaner[219410827:1421567252715]" java.lang.NoClassDefFoundError: org/apache/tomcat/jdbc/pool/FairBlockingQueue$FairIterator
at org.apache.tomcat.jdbc.pool.FairBlockingQueue.iterator(FairBlockingQueue.java:233)
at org.apache.tomcat.jdbc.pool.ConnectionPool.checkIdle(ConnectionPool.java:988)
at org.apache.tomcat.jdbc.pool.ConnectionPool.checkIdle(ConnectionPool.java:980)
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1348)
at java.util.TimerThread.mainLoop(Timer.java:534)
at java.util.TimerThread.run(Timer.java:484)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.FairBlockingQueue$FairIterator
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
... 6 more
我不知道是否更改了任何tomcat7配置文件。
任何帮助我的人都会很棒。
答案 0 :(得分:0)
将此添加到Tomcat的CATALINA_OPTS(在Unix上,这将在set_env.sh中):
-javaagent:/absolute/path/to/spring-instrument.jar
此jar的正确版本位于DemoSite Heat Clinic的lib
目录中。