Discussions

EJB programming & troubleshooting: Read xml file from an EJB

  1. Read xml file from an EJB (8 messages)

    I like to read xml files from a EJB, and I'd like to put these files in the ear file.
    Where do I have to put the xml files?

    Threaded Messages (8)

  2. Read xml file from an EJB[ Go to top ]

    Hi
      Your question is not clear. Whether u want to put xml file in .ear while making ear file or u want it by program.

    Pankaj
  3. Read xml file from an EJB[ Go to top ]

    Now I'm reading the xml files from the file system with an absolut path (c:\external\xml\Program.xml).
    But I want all the xml files in my package structure.
    If I make a package call com.enterprise.ejb.resources and put all the files here, how do I have to reference to this files?
    I hope my question is more clear now.
  4. Read xml file from an EJB[ Go to top ]

    There are lots of ways by which you can achieve what you want to do. you can put all your xmls in thier own jar say in: com.myproject.xml in the jar file xmlfiles.jar. Ear it up with the other jars that contain the ejbs and then use the class loader to read the xmls from thier packages. note that depending on your classloader (i.e. app server classloading) you may need to add xmlfiles.jar to the manifest of anyother jar that uses it inside the Ear.

    Hope this helps.
    Cheers,
    AT
  5. Read xml file from an EJB[ Go to top ]

    I want to package my xml files in the ejb jar file
  6. Read xml file from an EJB[ Go to top ]

    getClass().getClassLoader().getResourceAsStream("com/myresources/xml/myfile.xml");
  7. Read xml file from an EJB[ Go to top ]

    Is this 'legal' from a J2EE perspective - I thought it ws against the standard to access files like this?
  8. Read xml file from an EJB[ Go to top ]

    No problem, as long as you don't do the file I/O under a TX context.
  9. Read xml file from an EJB[ Go to top ]

    And how do you make this access?