我使用IntelliJ IDEA 14.0.2启动本地Tomcat 7.0.42实例,然后使用远程Tomcat运行配置单独部署WAR。我的web应用无法通过JNDI获取资源,我怀疑这是因为它无法远程连接到JMX,尽管如果我对JNDI查找进行注释,WAR的部署不会出现问题。如果我在同一个本地Tomcat运行配置中包含Tomcat启动和WAR部署,那么查找就可以正常工作。
以下是我认为相关的所有细节,如果您还需要其他信息,请告诉我。谢谢你的帮助!
HTTP端口:8080
JMX端口:11444
爪哇大学选择
-Dcatalina.base="C:\apache-tomcat-7.0.42"
-Dcatalina.home="C:\apache-tomcat-7.0.42"
-Dwtp.deploy="C:\apache-tomcat-7.0.42\wtpwebapps"
-Djava.endorsed.dirs="C:\apache-tomcat-7.0.42\endorsed"
-Depf.config.root="C:/dev/appConfig"
-Dactivemq.conf="C:/dev/appConfig/app-common-config/environment/dev-win/activemq"
-Dactivemq.data="C:/dev/activemq"
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=11444
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dwebconsole.type=properties
-Dwebconsole.jms.url=tcp://localhost:61616
-Dwebconsole.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:11444/jmxrmi
-Dwebconsole.jmx.user=system
-Dwebconsole.jmx.password=password
-Dlog4j.configuration=file:C:\dev\appConfig\logging\log4j.xml
-Djava.util.logging.config.file="C:\apache-tomcat-7.0.42\conf\logging.properties"
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.security.auth.login.config="C:\apache-tomcat-7.0.42\conf\jaas.config"
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
CATALINA_OPTS
-Dactivemq.conf=C:/dev/appConfig/app-common-config/environment/dev/activemq
-Dactivemq.data=C:/dev/appConfig/activemq-data
-Dlog4j.configuration=file:C:/dev/appConfig/logging/log4j.xml
-Djava.security.auth.login.config=C:/apache-tomcat-7.0.42/conf/jaas.config
JMX端口: 11444远程暂存:相同的文件系统主机:相同的文件系统
远程连接主机:localhost远程连接端口:8080
部署: my-web: war
## JMS Connection Factory
JMS.connectionFactory.factoryName=jms/jms.connectionFactory
JMS.connectionFactory.auth=Container
JMS.connectionFactory.brokerName=ActiveMQBroker
JMS.connectionFactory.brokerURL=tcp://localhost:61616
JMS.connectionFactory.factory=org.apache.activemq.jndi.JNDIReferenceFactory
JMS.connectionFactory.type=org.apache.activemq.ActiveMQConnectionFactory
JMS.connectionFactory.typeInterface=javax.jms.ConnectionFactory
## Local JMS Queue
JMS.queue.auth=Container
JMS.queue.name=jms/my.queue
JMS.queue.physicalName=my.queue
JMS.queue.factory=org.apache.activemq.jndi.JNDIReferenceFactory
JMS.queue.type=org.apache.activemq.command.ActiveMQQueue
<ResourceLink global="${JMS.connectionFactory.factoryName}" name="${JMS.connectionFactory.factoryName}" type="${JMS.connectionFactory.typeInterface}"/>
<ResourceLink global="${JMS.queue.name}" name="${JMS.queue.name}" />
<Resource auth="${JMS.connectionFactory.auth}"
brokerName="${JMS.connectionFactory.brokerName}" brokerURL="${JMS.connectionFactory.brokerURL}"
description="JMS Connection Factory" factory="${JMS.connectionFactory.factory}"
name="${JMS.connectionFactory.factoryName}" type="${JMS.connectionFactory.type}" />
<Resource auth="${JMS.queue.auth}" description="Outbound Queue"
factory="${JMS.queue.factory}" name="${JMS.queue.name}"
physicalName="${JMS.queue.physicalName}" type="${JMS.queue.type}" />
OK - Listed global resources of all types
jms/jms.connectionFactory:org.apache.activemq.ActiveMQConnectionFactory
jms/my.queue:org.apache.activemq.command.ActiveMQQueue
UserDatabase:org.apache.catalina.users.MemoryUserDatabase
@Bean(name = {"jndiObjectFactory"})
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Profile("default")
public JndiObjectFactoryBean jndiObjectFactory() {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
jof.setResourceRef(true);
jof.setJndiName("jms.connectionFactory");
Properties jndiProps = new Properties();
jndiProps.put("java.naming.factory.initial", "org.apache.naming.java.javaURLContextFactory");
jof.setJndiEnvironment(jndiProps);
return jof;
}
SEVERE: Exception sending context initialized event to listener instance of class
org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TestController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.me.test.factory.TestFactory com.me.test.tester.web.controller.TestController.testFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TestFactory': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jndiObjectFactory' defined in class path resource [com/me/test/SpringConfig.class]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jms.connectionFactory] is not bound in this Context. Unable to find [jms.connectionFactory].
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1551)
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:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:622)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:569)
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:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
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:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.me.test.factory.TestFactory com.me.test.tester.web.controller.TestController.testFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TestFactory': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jndiObjectFactory' defined in class path resource [com/me/test/SpringConfig.class]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jms.connectionFactory] is not bound in this Context. Unable to find [jms.connectionFactory].
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
... 56 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TestFactory': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jndiObjectFactory' defined in class path resource [com/me/test/SpringConfig.class]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jms.connectionFactory] is not bound in this Context. Unable to find [jms.connectionFactory].
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1017)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:960)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:858)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480)
... 58 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jndiObjectFactory' defined in class path resource [com/me/test/SpringConfig.class]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jms.connectionFactory] is not bound in this Context. Unable to find [jms.connectionFactory].
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:991)
at com.me.test.factory.TestQueueFactory.newInstance(TestQueueFactory.java:45)
at com.me.test.factory.TestFactory.createEmitter(TestFactory.java:178)
at com.me.test.factory.TestFactory.readConfigurationFromPropertiesFile(TestFactory.java:155)
at com.me.test.factory.TestFactory.init(TestFactory.java:112)
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:606)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:300)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
... 70 more
Caused by: javax.naming.NameNotFoundException: Name [jms.connectionFactory] is not bound in this Context. Unable to find [jms.connectionFactory].
at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:104)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
... 86 more
对我来说,这只是一个愚蠢的错误,我不知道为什么它以前作为本地tomcat运行配置工作。我回去尝试了一下,结果发现了同样的错误。
这仅仅是因为当我试图查找“jms.connection工厂”时,JNDI的名称应该是“JMS/jms.connection工厂”。
如何使用VSTS版本将war文件部署到运行Tomcat的Azure Web应用程序?我在VSTS设置中有一个CI/CD管道,在提交代码时进行构建,然后在构建完成时发布新的war文件并将其推送到Azure。问题是,war文件被部署到\site\wwwroot\webapps,而不是\site\wwwroot\bin\apache-tomcat-8.5.24\webapps,需要将其作为应用程序拉入t
我已经从Glassfish v2.1迁移到Glasfiss3.1.2.2。我在Glassfish v2.1中部署并运行了几个Web应用程序(WAR),但我在Glassfish v3.1.2.2中部署其中一些时遇到问题。 当我尝试在Gfv3中部署一个WAR文件时,我总是会得到一个与在web.xml描述符中定义的库相关的ClassNotFoundException,例如: 或者 这些库包含在web-a
pom.xml我有这个用来部署 在设置中。tomcat服务器的xml我有这个 当我试图调用maven deploy时,出现了一个错误: 服务器正在运行。我试图在pom中更改tomcat插件。xml到tomcat7 maven插件,但我得到了相同的错误。据我所知,它正试图将war文件部署到http://localhost:8080/manager/ua/andrfas/SCPI/0.0.1/SCPI
我正在尝试使用Visual Studio代码将java web应用程序部署到Tomcat,我有一些问题想与大家分享。 在安装了Tomcat for Java扩展之后,我尝试部署了一个Maven Java Web项目。为此,我点击了项目的文件夹并选择了“在Tomcat服务器上运行”选项。结果是出现以下错误消息:< code >该文件夹不是在Tomcat服务器上运行的有效web应用程序。 然后,我意识
基本上,我想使用spring boot auto配置数据源相关功能,并希望将spring boot应用打包到一个war,并部署到Tomcat。 github URL:https://github.com/oneslideicywater/customlizeofkakahair运行MVN构建后,我跳过测试,将部署到TomCat,重新启动它,然后在STS IDE中运行应用程序时,一切都很好。但是会发
我想部署两个应用程序foo。war和条形图。war到同一个Tomcat实例。他们是否可以侦听不同端口上的连接,例如,foo侦听端口81,bar侦听端口82?如果是,我如何配置?我意识到应用程序没有必要监听不同的端口,但这正是我想要实现的。 此外,如果我将重命名为,使其在根上下文中运行,那么对该Tomcat实例的所有请求都将由foo应用程序处理,因此bar必须部署到单独的Tomcat实例,这是否正确