I inherited a Struts 1 app consisting of about eight separate packages all compiled into the same app. I've been tasked with rewriting its ant build script. Previously it was copying all the config files separately into the /usr/local/tomcat/shared/classes dir, but our ops team has asked us to streamline things so the build script just creates a war file that can be dropped into tomcat.
I get an error when my ConfigurationManager class tries to load its config file. This file, config.xml, is currently being copied into WEB-INF before it's warred up with the rest of the app. So when I look at the exploded war (ROOT) I do find /usr/local/tomcat/webapps/ROOT/WEB-INF/config.xml. Here is the relevant portion of ConfigurationManager:
private static final String BASE_CONFIG_FILE = "WEB-INF/config.xml";
private void loadConfigFiles() throws RCConfigurationException {
try {
log.error("classpath: " + System.getProperty("java.class.path"));
ConfigurationFactory factory = new ConfigurationFactory();
URL configURL = getClass().getResource(BASE_CONFIG_FILE);
factory.setConfigurationURL(configURL);
config = factory.getConfiguration();
} catch (ConfigurationException e) {
log.error("Exception loading configuration files.", e);
throw new RCConfigurationException("Exception loading configuration files", e);
}
}
The log.error() call outputs this:
13:16:10,561 ERROR ConfigurationManager:75 - classpath: /usr/local/tomcat/bin/bootstrap.jar
My localhost.2013-01-29.log shows this:
SEVERE: Exception starting filter GlobalRootManager
java.lang.ExceptionInInitializerError
at com.rc.util.config.ConfigurationManager.getInstance(ConfigurationManager.java:66)
at com.rc.commonbusinesswebapp.servlet.filter.GlobalRootManager.init(GlobalRootManager.java:42)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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.lang.NullPointerException
at org.apache.commons.configuration.ConfigurationFactory.setConfigurationURL(ConfigurationFactory.java:220)
at com.rc.util.config.ConfigurationManager.loadConfigFiles(ConfigurationManager.java:79)
at com.rc.util.config.ConfigurationManager.<init>(ConfigurationManager.java:55)
at com.rc.util.config.ConfigurationManager.<init>(ConfigurationManager.java:26)
at com.rc.util.config.ConfigurationManager$LazyHolder.<clinit>(ConfigurationManager.java:37)
... 29 more
I am spinning my wheels so I hope someone here can help me. Thanks.
WEB-INF is not on a web app's classpath.
WEB-INF/classes is; one option would be to locate the file at the root of the classpath if you want to load the config file as a classpath resource.
Related
Used versions:
Tomcat 7
jre 6
I created a new dynamic web project and I added axis2 web service client in this new project. Then I turned this project into a jar file.
When I exported, I only selected src file. And I added this jar file and the minimum jars for the axis2 client.
this minimum jars:
What's the minimum classpath for an Axis2 client?
I run this main project and the project doesn't give any errors. But This project deploy
But when I deploy this project to the weblogic server, I get the following error:
org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:122)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:66)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:347)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
at webmethods.wsdls.universitebirim.universitebirimv1.UniversiteBirimv1Stub.iDdenBirimAdiGetir(UniversiteBirimv1Stub.java:494)
at webmethods.wsdls.universitebirim.universitebirimv1.TestWebServis.birimGetirv1(TestWebServis.java:15)
at dao.SozMaasDAO.ogrenimSuresiGetir(SozMaasDAO.java:1159)
at dao.SozMaasDAO.ogrenimDurumRowSelect(SozMaasDAO.java:1192)
at bus.SozMaasBUS.listYoktenMezunBilgisiGetir(SozMaasBUS.java:7622)
at bus.SozMaasBUS$$FastClassByCGLIB$$41cbd8aa.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:163)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at bus.SozMaasBUS$$EnhancerByCGLIB$$aa66edae.listYoktenMezunBilgisiGetir(<generated>)
at view.SozMaasView.hnd_yoktenMezunBilgisiGetir(SozMaasView.java:81)
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.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:473)
at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:410)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at filter.SecurityFilter.doFilter(SecurityFilter.java:416)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at filter.GZIPFilter.doFilter(GZIPFilter.java:32)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1499)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: org.apache.axiom.om.DeferredParsingException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:184)
at org.apache.axiom.core.CoreParentNodeSupport.ajc$interMethod$org_apache_axiom_core_CoreParentNodeSupport$org_apache_axiom_core_CoreParentNode$buildNext(CoreParentNodeSupport.aj:96)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.buildNext(OMDocumentImpl.java:1)
at org.apache.axiom.core.CoreParentNodeSupport.ajc$interMethodDispatch1$org_apache_axiom_core_CoreParentNodeSupport$org_apache_axiom_core_CoreParentNode$buildNext(CoreParentNodeSupport.aj)
at org.apache.axiom.core.CoreChildNodeSupport.ajc$interMethod$org_apache_axiom_core_CoreChildNodeSupport$org_apache_axiom_core_CoreChildNode$coreGetNextSibling(CoreChildNodeSupport.aj:115)
at org.apache.axiom.om.impl.llom.OMNodeImpl.coreGetNextSibling(OMNodeImpl.java:1)
at org.apache.axiom.core.CoreChildNodeSupport.ajc$interMethodDispatch1$org_apache_axiom_core_CoreChildNodeSupport$org_apache_axiom_core_CoreChildNode$coreGetNextSibling(CoreChildNodeSupport.aj)
at org.apache.axiom.core.CoreDocumentSupport.ajc$interMethod$org_apache_axiom_core_CoreDocumentSupport$org_apache_axiom_core_CoreDocument$coreGetDocumentElement(CoreDocumentSupport.aj:47)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.coreGetDocumentElement(OMDocumentImpl.java:1)
at org.apache.axiom.om.impl.common.AxiomDocumentSupport.ajc$interMethod$org_apache_axiom_om_impl_common_AxiomDocumentSupport$org_apache_axiom_om_impl_intf_AxiomDocument$getOMDocumentElement(AxiomDocumentSupport.aj:32)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:1)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:557)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:553)
at org.apache.axis2.transport.TransportUtils.createDefaultDocumentElement(TransportUtils.java:230)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:207)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:144)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:107)
... 53 more
Caused by: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:36)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:666)
... 70 more
<May 12, 2017 3:50:29 PM EEST> <Error> <HTTP> <BEA-101017> <[ServletContext#181830207[app:kbs_3asd module:kbs_3asd path: spec-version:2.5]] Root cause of ServletException.
java.lang.NullPointerException
at dao.SozMaasDAO.ogrenimDurumRowSelect(SozMaasDAO.java:1198)
at bus.SozMaasBUS.listYoktenMezunBilgisiGetir(SozMaasBUS.java:7622)
at bus.SozMaasBUS$$FastClassByCGLIB$$41cbd8aa.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:163)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
Truncated. see log file for complete stacktrace
>
Note:
When I added the web service client, the codes was created in this way
webmethods.wsdls.universitebirim.universitebirimv1.UniversiteBirimv1Stub.ıDdenBirimAdiGetir
But I changed them like this:
webmethods.wsdls.universitebirim.universitebirimv1.UniversiteBirimv1Stub.iDdenBirimAdiGetir
Code:
public static Birim birimAgaciGetir(long birim_id){
Birim birim= new Birim();
try {
UniversiteBirimv1Stub stub = new UniversiteBirimv1Stub();
IDdenBirimAdiGetir c2f = new IDdenBirimAdiGetir();
c2f.setBIRIM_ID(birim_id);
IDdenBirimAdiGetirE e= new IDdenBirimAdiGetirE();
e.setIDdenBirimAdiGetir(c2f);
IDdenBirimAdiGetirResponseE res = stub.ıDdenBirimAdiGetir(e);
System.out.println("Tested: "+res);
birim= res.getIDdenBirimAdiGetirResponse().getBirim();
//System.out.println(res.getIDdenBirimAdiGetirResponse().getBirim().getBAGLI_OLDUGU_BIRIM_ID());
} catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}catch (Exception e) {
System.out.println(e);
}
return birim;
}
I used this in main project.
System.out.println(res.getIDdenBirimAdiGetirResponse().getBirim().getBAGLI_OLDUGU_BIRIM_ID());
I solved this problem, added two jars(StAX, Woodstox) in project
In my case the service was down and hence axis2 gave the same error. Once the service started, I was able to invoke and get the response.
In my spring-boot application I have externalized the log4j2.xml file and added the location of the configuration file using logging.config properties in application.properties file.
If I give an incorrect file location in logging.config then my application doesn't start and throw the following error:
[main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.IllegalStateException: java.io.FileNotFoundException: /tmp/log4j2.xml (No such file or directory)
at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:315) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:276) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:212) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:73) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:336) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at my.application.Application.main(Application.java:67) [classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_60]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:?]
I think the ideally the application should startup with default logging. Is there a way so that I can put in the default logging configuration or have spring-boot application start with default logging capabilities.
I am using log4j2 and spring-boot.
As the spring document says:
The various logging systems can be activated by including the appropriate libraries on the classpath, and further customized by providing a suitable configuration file in the root of the classpath, or in a location specified by the Spring Environment property logging.config.
For log4j2, the configuration file should be log4j2-spring.xml or log4j2.xml
So you can add log4j2.xml in your project resources directory and it will be packed into the jar file and then will be in the classpath.
I get the below error when I run my Spring project..I followed multiple SO links and implemented everything but still I have the same problem.
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
I have attached my project Maven depedencies, deployment assembly and wtpwebapps lib folder to show all the dependencies..
Not sure what else Im missing.
Stack
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4153)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
You should have this in your pom.xml
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
Also you can try:
Right click on your project
"Propeties"
Deployment Assembly
Add
Java Build Path Entries
Maven Dependencies (Selected them all)
Finish
Your project setup shows there is jar file missing or your are pointing to missing jar file in your project build path.
Right click on your project ==> Go to Build Path ==> In Libraries tab..
You can see the jar files missed with red color cross mark delete them (if you need them add those missing jars in your path)
And re-build the project.
I am trying to load my spring context.xml file using Java from the classpath. My context.xml file is in src/main/resources.
public static void main(String[] args) {
ClassPathXmlApplicationContext context = null;
try {
context = new ClassPathXmlApplicationContext("classpath:context.xml");
context.registerShutdownHook();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (context != null) {
context.close();
}
}
}
Above code works fine when I am running in my eclipse. But as soon as I package it into a runnable jar by right clicking the project and select export as a runnable jar and then run the jar from a ubuntu machine as -
java -jar test.jar
Then I am getting below exception -
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [context.xml]; nested exception is java.io.FileNotFoundException: class path resource [context.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.host.sd.corp.ldap.Application.main(Application.java:63)
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:616)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.io.FileNotFoundException: class path resource [context.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:157)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
... 18 more
Is there anything I am missing?
You probably didn't include the resources in src/main/resources in your jar. I don't believe the Maven plugin is involved in Eclipse's Jar Export utility.
I've deployed an instance of tomcat with JavaBridge as specified here:
http://php-java-bridge.sourceforge.net/doc/tomcat6.php
I've added a JavaBridge.war project to my webapps directory, because I want to run php-cgi embedded.
I've updated java -D command line option in catalina.sh with:
-Dphp.java.bridge.php_exec = /path/to/webapps/JavaBridge/WEB-INF/cgi/i386-linux/php-cgi
(as outlined here: PHP/Java bridge problem)
aaand when I start tomcat in catalina.out I get this:
/path/to/webapps/JavaBridge/WEB-INF/cgi/i386-linux/php-cgi: /lib/tls/libc.so.6: version
`GLIBC_2.7' not found (required by /local/home/fxf-int/deploy/phptc/www/phptest/JavaBridge
/WEB-INF/cgi/i386-linux/php-cgi)
Fatal Error: Failed to start PHP [/path/to/webapps/JavaBridge/WEB-INF/cgi/i386-linux/php-cgi, -v], reason: java.io.IOException: php could not be run, returned error code: 1, result: 1
Could not start FCGI server: java.io.IOException: PHP not found. Please install php-cgi. PHP test command was: [.../JavaBridge/WEB-INF/cgi/i386-linux/php-cgi, -v]
Timeout waiting for PHP FastCGI daemon
php.java.bridge.http.FCGIConnectException: Could not connect to server
at php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58)
at php.java.bridge.http.FCGIConnectionPool.<init>(FCGIConnectionPool.java:175)
at php.java.bridge.http.FCGIConnectionPool.<init>(FCGIConnectionPool.java:189)
at php.java.servlet.ContextLoaderListener.createConnectionPool(ContextLoaderListener.java:541)
at php.java.servlet.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:185)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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.IOException: java.net.ConnectException: Connection refused
at php.java.bridge.http.FCGIConnectException.<init>(FCGIConnectException.java:37)
... 29 more
Caused by: java.io.IOException: PHP not found. Please install php-cgi. PHP test command was: [/path/to/JavaBridge/WEB-INF/cgi/i386-linux/php-cgi, -v]
at php.java.bridge.Util$Process.start(Util.java:1145)
at php.java.servlet.fastcgi.FCGIProcess.start(FCGIProcess.java:68)
at php.java.bridge.http.SocketChannelFactory.doBind(SocketChannelFactory.java:125)
at php.java.bridge.http.FCGIConnectionFactory.runFcgi(FCGIConnectionFactory.java:88)
at php.java.bridge.http.FCGIConnectionFactory$1.run(FCGIConnectionFactory.java:109)
P.S. I don't want to install php, would prefer to use embedded from a war as in JavaBridge.war. Updating /lib/tls/libc.so.6 is not an option. Help! :)
P.P.S. The only other place I've found this problem discussed is here:
http://sourceforge.net/mailarchive/forum.php?forum_name=php-java-bridge-users&max_rows=25&style=nested&viewmonth=201101