Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 6th, 2003, 03:08 PM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to leojhartiv Send a message via MSN to leojhartiv Send a message via Yahoo to leojhartiv
Default Read XML Config File From Within EJB JAR

Hello,

I have an EJB JAR, erptsecejb.jar. Within that jar is a class, MyClass which needs to read an XML file also contained within that same JAR. Here is what the paths within the EJB JAR may look like:

com/foo/bar/config/ConfigFile.xml
com/foo/bar/other/MyClass.class

I've tried doing the following:

URL mUrl = MyClass.class.getClassLoader().getResource("com/foo/bar/config/ConfigFile.xml");

URL mUrl = MyClass.class.getClassLoader().getResource("com.fo o.bar.config.ConfigFile.xml");

URL mUrl = MyClass.class.getClassLoader().getResource("Config File.xml");


I also tried added the following to the Manifest file:
Class-Path: com/foo/bar/config

No matter what I do, the class can't find this file. When I perform a mUrl.getPath(), I get a null-pointer exception.

Any suggestions?


Thanks,
Leo Hart





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read XSL from jar present in applications l Archana144 Spring 1 March 21st, 2008 06:49 AM
Reading xml file which is in a JAR file pradheepayyanar J2EE 2 December 26th, 2007 05:52 AM
Read xml file Nehru C# 0 October 8th, 2007 04:40 AM
xml file read data from servlet kotaiah J2EE 0 October 15th, 2006 06:37 AM
DTS Package, XML task. Read XML file and store it Victoria SQL Server DTS 0 July 24th, 2006 02:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.