-
1. Re: Is META-INF in the classpath?
dimitris May 29, 2008 1:52 PM (in response to dimitris)The full trace:
Caused by: java.io.FileNotFoundException: X:\cvs\jboss-public\jboss-head\build\o utput\jboss-5.0.0.CR1\bin\META-INF\noop.xml at org.jboss.net.protocol.file.FileURLConnection.connect(FileURLConnecti on.java:95) at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLC onnection.java:104) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown So urce) at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityRefer ence(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent Dispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un known Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98) at org.jboss.deployers.vfs.spi.deployer.JAXPDeployer.doParse(JAXPDeploye r.java:179) at org.jboss.deployers.vfs.spi.deployer.JAXPDeployer.parse(JAXPDeployer. java:150) at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse (AbstractVFSParsingDeployer.java:184) at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithO utput.createMetaData(AbstractParsingDeployerWithOutput.java:330) ... 26 more 20:44:38,625 WARN [HDScanner] Failed to process changes org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incompl ete deployments (SEE PREVIOUS ERRORS FOR DETAILS): *** CONTEXTS IN ERROR: Name -> Error vfsfile:/X:/cvs/jboss-public/jboss-head/build/output/jboss-5.0.0.CR1/server/defa ult/deploy/x.sar/ -> java.io.FileNotFoundException: X:\cvs\jboss-public\jboss-he ad\build\output\jboss-5.0.0.CR1\bin\META-INF\noop.xml
-
2. Re: Is META-INF in the classpath?
starksm64 May 29, 2008 2:01 PM (in response to dimitris)No, not generally. If its needed you would have to use a META-INF/jboss-structure.xml to instruct the structure deployers to add it. You then have to specify the complete classpath though. Don't know if the latest classloading deployers have a simpler syntax for this.
<structure> <context> <path name=""/> <metaDataPath> <path name="META-INF"/> </metaDataPath> <classpath> <path name=""/> <path name="lib" suffixes=".jar"/> </classpath> </context> <context> <path name="jbosstest-web.war" /> <metaDataPath> <path name="WEB-INF"/> </metaDataPath> <classpath> <path name="jbosstest-web.war/WEB-INF/classes"/> <path name="jbosstest-web.war/WEB-INF/lib" suffixes=".jar"/> </classpath> </context> <context> <path name="wars/notjbosstest-web.war" /> <metaDataPath> <path name="WEB-INF"/> </metaDataPath> <classpath> <path name="wars/notjbosstest-web.war/WEB-INF/classes"/> </classpath> </context> <context> <path name="jbosstest-web-ejbs.jar" /> <metaDataPath> <path name="META-INF"/> </metaDataPath> <classpath> <path name="jbosstest-web-ejbs.jar"/> </classpath> </context> <context> <path name="cts.jar" /> <metaDataPath> <path name="META-INF"/> </metaDataPath> <classpath> <path name="cts.jar"/> </classpath> </context> <context> <path name="websubdir/relative.jar" /> <metaDataPath> <path name="META-INF"/> </metaDataPath> <classpath> <path name="websubdir/relative.jar"/> </classpath> </context> <context> <path name="scripts/security-config-service.xml" /> </context> </structure>
-
3. Re: Is META-INF in the classpath?
adrian.brock May 29, 2008 2:20 PM (in response to dimitris)This looks like a problem with the new SARDeployer.
protected ServiceDeployment parse(VFSDeploymentUnit unit, VirtualFile file, Document document) throws Exception { ServiceDeploymentParser parser = new ServiceDeploymentParser(document); ServiceDeployment parsed = parser.parse();
The location of the xml document (file.toURL())
is not being passed to the JAXP parser used
by ServiceDeploymentParser, so it wil resolve it relative to the current directory
(which is the bin folder normally with JBoss).
But I think this will be true of a lot of the other parsing deployers that now use JBossXB.
In general we are passing streams instead of URLs, e.g.
JBossXBDeployerHelperInputStream is = openStreamAndValidate(file); Object parsed = null; try { // HERE Doesn't know the file url parsed = unmarshaller.unmarshal(is, resolver);
-
4. Re: Is META-INF in the classpath?
adrian.brock May 29, 2008 2:23 PM (in response to dimitris)"scott.stark@jboss.org" wrote:
No, not generally. If its needed you would have to use a META-INF/jboss-structure.xml to instruct the structure deployers to add it. You then have to specify the complete classpath though. Don't know if the latest classloading deployers have a simpler syntax for this.
This doesn't use classloading. It is xml parsing. ;-)
We need to tell the parser what the system uri is so it can do relative uri handling.
I guess there will be a similar problem for the more modern XInclude handling? -
5. Re: Is META-INF in the classpath?
adrian.brock May 29, 2008 2:34 PM (in response to dimitris)"adrian@jboss.org" wrote:
This looks like a problem with the new SARDeployer.
Well actually the problem is in the JAXPDeployer that it uses.
Ironically, it is setting up an InputSource with the URI but then not using it :-)InputStream is = openStreamAndValidate(file); try { DocumentBuilder parser = getDocumentBuilderFactory().newDocumentBuilder(); InputSource source = new InputSource(is); source.setSystemId(file.toURI().toString()); parser.setEntityResolver(new JBossEntityResolver()); // HERE it passes the stream instead of the source :-) return parser.parse(is);
-
6. Re: Is META-INF in the classpath?
adrian.brock May 29, 2008 2:39 PM (in response to dimitris)Bug report: http://jira.jboss.com/jira/browse/JBDEPLOY-47
-
7. Re: Is META-INF in the classpath?
dimitris May 30, 2008 12:09 PM (in response to dimitris)So META-INF/jboss-structure.xml is not needed after all, thanks! :-)
-
8. Re: Is META-INF in the classpath?
alesj Jun 10, 2008 10:34 AM (in response to dimitris)"adrian@jboss.org" wrote:
Bug report: http://jira.jboss.com/jira/browse/JBDEPLOY-47
What would a test for this look like? -
9. Re: Is META-INF in the classpath?
adrian.brock Jun 10, 2008 10:49 AM (in response to dimitris)"alesj" wrote:
"adrian@jboss.org" wrote:
Bug report: http://jira.jboss.com/jira/browse/JBDEPLOY-47
What would a test for this look like?
Like the original post in this thread.
Or if you are using schemas, something like:
ejb-jar.xml<ejb-jar xmlns="whatever" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="included.xml"/> </ejb-jar>
included.xml<enterprise-beans> ...
Where included.xml is alongside ejb-jar.xml in the META-INF folder.
If you pass the full uri of the enclosing (ejb-jar.)xml, the relative url (included.xml)
should resolved based on that rather than the process's current directory. -
10. Re: Is META-INF in the classpath?
alesj Jun 10, 2008 10:50 AM (in response to dimitris)In JBossXBHelper, should I change the code this way:
//parsed = unmarshaller.unmarshal(is, resolver); parsed = unmarshaller.unmarshal(file.toURL().toString(), resolver);
-
11. Re: Is META-INF in the classpath?
alesj Jun 10, 2008 11:19 AM (in response to dimitris)I 'missing' better stream handling in both JBossXBHelper parse methods.
Since we're going 'around the corner' to get what we already have at that point - a file and its stream.
Since if we pass in URL, it's probably some code deeper in unmarshaller that opens connection/stream on top of that vfs's url, meaning it goes all the way to recreating whole vfs structure ...
Jaxb and jaxp deployers already have this done via (Input|Dom)Source.
Should I open JBossXB issue? -
12. Re: Is META-INF in the classpath?
aloubyansky Jun 10, 2008 5:26 PM (in response to dimitris)Yes, I didn't know it would use systemId as the base for entity resolutions when InputStream/Reader is passed in.
-
13. Re: Is META-INF in the classpath?
alesj Jun 11, 2008 5:56 AM (in response to dimitris)I've now have this:
<jboss-include xmlns="urn:jboss:include:1.0" name="mymetadata" xmlns:xi="http://www.w3.org/2001/XInclude"> <jboss-test>test1</jboss-test> <xi:include href="included.xml"/> </jboss-include>
where included.xml is<?xml version="1.0" encoding="UTF-8"?> <jboss-test>test2</jboss-test>
If I comment out include in the first xml, I'm fine with parsing.
But if I use it, then I get this:Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: jboss-test not found as a child of {urn:jboss:include:1.0}jboss-include at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:201) at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:181) at org.jboss.deployers.vfs.spi.deployer.JBossXBDeployerHelper.parse(JBossXBDeployerHelper.java:190) at org.jboss.deployers.vfs.spi.deployer.JBossXBDeployerHelper.parse(JBossXBDeployerHelper.java:164) at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:132) at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:118) at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:185) at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:336)
Where my metadata is:@JBossXmlSchema(namespace="urn:jboss:include:1.0", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="jboss-include", namespace = "urn:jboss:include:1.0") @XmlType( name="includeType", namespace="urn:jboss:include:1.0", propOrder={"others"} ) public class IncludeMetaData implements Serializable { /** The serialVersionUID */ private static final long serialVersionUID = 1L; private String name; private List<TestMetaData> others; public String getName() { return name; } @XmlAttribute(required = true) public void setName(String name) { this.name = name; } public List<TestMetaData> getOthers() { return others; } @XmlElement(name = "jboss-test") public void setOthers(List<TestMetaData> others) { this.others = others; } } @JBossXmlSchema(namespace="urn:jboss:mytest:1.0", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="jboss-test") public class TestMetaData implements Serializable { /** The serialVersionUID */ private static final long serialVersionUID = 1L; private String name; public String getName() { return name; } @XmlAttribute(required = true) public void setName(String name) { this.name = name; } }
What am I missing? -
14. Re: Is META-INF in the classpath?
aloubyansky Jun 11, 2008 6:03 AM (in response to dimitris)Maybe the namespace in the included.xml?