I am working on Jboss 4.05 , I have an xsd file that was on jboss.com and want to have it locally on my system, I can not find the right location to put this file, when starting the jboss I get this error:
Offending resource: class path resource [spring/my-context.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 75 in XML document from class path resource [spring/my-ranking-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'seam:instance'.
the problem started when jboss.com went down, i located the relevant xsd and downloaded it. i have tried putting it in the bin directory of jboss and also on the lib directory under the server to no avail.
thanks in advance,
Dov
I think the xsd needs to be in the class path.
It's the server that needs it then make sure the path to the file is in the Jboss start up classpath. You can change the startup classpath in the run.bat or run.sh file.
If the probem is with a deployment then the file needs to go in that deployment's classpath.
ex: for my axis deployment the xsd would be in the classes directoy.
jboss-4.0.2\server\default\deploy\axis.war\WEB-INF\classes
Related
This error blows my brain. All the junit tests is fine but when my application loads as plugin for another application I have an errors. The beans.xml is 100% at root of jar file but for some reason the main application, that loads my plugin can't find the file. Why?
In my application's boot method I call
new ClassPathXmlApplicationContext("beans.xml"); throws
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not exist
or
new FileSystemXmlApplicationContext(getClass().getClassLoader().getResource("beans.xml").getPath()); throws
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file:/C:/path/to/my.jar!/beans.xml]; nested exception is java.io.FileNotFoundException: C:\path\to\my.jar!\beans.xml (The system cannot find the path specified)
UPD: The problem was the application uses custom classloader that does not load resource files in root, META-INF and etc. but only classes
The FileNotFoundException that you get really points out that the beans.xml file is not in your jar at the place where you think it is. I would have a look inside that jar. You can for example open the jar with the 7-zip tool. I find that this provides useful insight when you get errors like the one you report.
If you're getting the FileNotFoundException it is because the file is not located where you're looking for it. The beans.xml file must be located in src/main/resources
I'm trying to use the appassember plugin to create an embedded tomcat using the heroku howto, with tomcat7 and oracle-java-7.
I've used these instructions a number of times to convert a working war file with no problems.
The current project is a spring-batch-admin console with a single runner underneath. I'm not the code owner, and not-so-familiar with spring-batch, but it seems happy to be dropped into a 'normal' /var/lib/tomcat7/webapps.
When launched with the auto-generated shell scripts (sh ./target/bin/webapp), I get the following error:
ERROR - DispatcherServlet - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:/META-INF/servlet/*.xml]
Offending resource: URL [jar:file:/vagrant/pairbulkdata_app/downloadjob_batch/target/repo/org/springframework/batch/spring-batch-admin-resources/1.0.0.M1/spring-batch-admin-resources- 1.0.0.M1.jar!/org/springframework/batch/admin/web/resources/servlet-config.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [../batch/module-context.xml]
Offending resource: URL [jar:file:/vagrant/pairbulkdata_app/downloadjob_batch/target/repo/org/springframework/batch/pbdDownloadXmlConfig/1.0.0.M1/pbdDownloadXmlConfig-1.0.0.M1.jar!/META-INF/servlet/service-context.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [jar:file:/vagrant/pairbulkdata_app/downloadjob_batch/target/repo/org/springframework/batch/pbdDownloadXmlConfig/1.0.0.M1/pbdDownloadXmlConfig-1.0.0.M1.jar!/META-INF/servlet/../batch/module-context.xml]; nested exception is java.io.FileNotFoundException: JAR entry META-INF/servlet/../batch/module-context.xml not found in /vagrant/pairbulkdata_app/downloadjob_batch/target/repo/org/springframework/batch/pbdDownloadXmlConfig/1.0.0.M1/pbdDownloadXmlConfig-1.0.0.M1.jar
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
Which seems to imply that it isn't finding the servlet-config.xml file.
The interesting thing, when I go peek into the new myApp.jar vs the old myApp.war files, the contents of the META_INF file have been moved around.
The relevent parts of the original war is:
\META-INF\maven
\WEB-INF\classes\META-INF\stuff-to-launch-the-servlet
In the fat jar, I'm getting:
\META-INF
|-----> maven
|-----> stff-to-launch-the-servlet
and WEB-INF doesn't seem to be baked in at all.
Since the class it can't find is in the stuff that got moved around, I'm heading down that rabbit hole.
Why does the jar file include the META-INF at a different path? The original configuration is on the filesystem, because this isn't a onejar, and should get picked up from the CLASSPATH, correct?
I use this line :
context:property-placeholder location="classpath*:resources/BLLresources/MQ.properties"
in a spring.xml file to look for MQ.properties which is inside the jar where the xml file is (in config folder at the root level).
I got error :
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: {{uriMesarimReadQueue}} due to: Properties file classpath*:resources/BLLresources/MQ.properties not found in classpath
If I put the properties file outside the jar it works fine.
the jar is in the classpath.
any advice ?
I think your have your references setup incorrectly. In a normal java project the resources folder would be located in src/main/resources, this folder gets mapped to the root of the generated jar file. Therefore, if you had a file src/main/resources/BLLresources/MQ.properties, the mapping would be classpath*:BLLresources/MQ.properties
I have a properties file placed in glassfish3\glassfish\domains\domain1\config, the application can read the values specified but It can't find the specified path on the same server deployed, ex:
Props.properties content is:
FilePath=//192.xxx.xxx.xxx/glassfish3/FolderName
My app throws an error that says file or folder does not exist even it is there.
What is the proper way to do this?
Welp, I solved it by:
FilePath=/root/glassfish3/FolderName
I am trying to run a jar file via cmd line that uses Spring and a spring xml configuration file.
The cmd line call is similar to:
java -cp lib/MyJar.jar my.package.MyClass
The error I get is:
Caused by: java.io.FileNotFoundException: class path resource
[myPath/mySpringCfg.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:157)
My manifest classpath is similar to:
Class-Path: 3rdPartyJar1.jar 3rdPartyJar2.jar ./myPath/
The call that loads the file equates to:
context = new ClassPathXmlApplicationContext("myPath/mySpringCfg.xml");
Is there a way to correctly pull in XML files in the classpath so that Spring will work as expected? It seems like the classpath docs only talk about archive files and folders.
Thanks!
UPDATE
It seems to run fine when I switch over to FileSystemXmlApplicationContext. I guess the ClassPathXmlApplicationContext cannot be used from command-line
Your reference to the XML is myPath/mySpringCfg.xml - this means that myPath has to be in the classpath.
Change your manifest to be:
Class-Path: 3rdPartyJar1.jar 3rdPartyJar2.jar ./
This way myPath will be a part of the classpath and not just its contents.
Note:
The application configuration XML is a part of your application's code, don't mistake it for a configuration.
If you want configuration - put it outside in a properties file and use place-holders in your XML configuration file.
Update:
I think the root cause of your problem is in the code (I didn't test it though) - try this instead:
context = new ClassPathXmlApplicationContext("/myPath/mySpringCfg.xml");
The difference is in the '/' before 'myPath'
I am not aware of the architecture of your project, but why not place your xml configuration file into your project jar?