• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

How to run a main method from within a maven multi-module project ?

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have developed a multi-module maven project with 9 modules. i wanted to test one of my service classes. so i simply wrote a main method in the class and executed the class and was left surprized with an exception stack that said "FileNotFoundException" and futher the reason was - The filename, directory name, or volume label syntax is incorrect

Here are the details



I am simply passing an XML as a string to build() method which processes the XML to create a Template Object using SAX parser. I dont think so the code here is causing any problem but it has got something to do with maven. I am recieving following exception when i run this main method.

Exception in thread "main" java.io.FileNotFoundException: D:\Raghave\OSRMediaManager\mediamanager\documentmanagementsystem\ <page> <attribute key="color" param="@{BaseColor.BLUE}"\> <attribute key="size" param="12.2f"\> <\font> <content class="java.lang.String"\> <attribute key="anchor" param="123i" \> <attribute key="background" param="123i,145f,134d" \> <attribute key="font" param="${chunkfont}"\> <position xpos="23" ypos="25"\> <\title> <\template> (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at com.bluebench.mediamanager.dms.utility.TemplateBuilder.build(TemplateBuilder.java:41)
at com.bluebench.mediamanager.dms.utility.TemplateBuilder.main(TemplateBuilder.java:70)




If you look at the stack you will see "java.io.FileNotFoundException: D:\Raghave\OSRMediaManager\mediamanager\documentmanagementsystem\" here this path is the path of the current maven module from which this class TemplateBuilder and main method are executed. How is it possible that JVM is unable to find the path of module from which the main method is executed ?

Is It something like we cannot directly execute a main class from within maven module. IF this is true, i wanted to know why so and what are the options available for a quick test in that case ?

I AM STUCK..
 
author & internet detective
Posts: 40791
828
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a coding error and not a maven error. The stack trace says it is failing in the TemplateBuilder class. Since you didn't show that class, I have to infer what happens next based on the stack trace. It appears TemplateBuilder is expecting the name of a file to be passed in rather than the XML content of a file.

I can tell this because it is trying to open a file that has XML content in the "name."
 
reply
    Bookmark Topic Watch Topic
  • New Topic