Home » Eclipse Projects » Rich Client Platform (RCP) » Exported project can't find resource bundle, bundle is found by Eclipse App
Exported project can't find resource bundle, bundle is found by Eclipse App [message #456205] |
Mon, 16 October 2006 00:18  |
Eclipse User |
|
|
|
I am scratching my head over this:
ResourceBundle rs = ResourceBundle.getBundle("edoc");
AuWebServiceSoap_address = rs.getString("webservice_address");
edoc is edoc.Properties, in the root of the project.
When run as an Eclipse Application the resource bundle is found. When
exported and executed as an Eclipse Product the resource bundle is not
found.
edoc.Properties is included in the Build page. It is in the project.jar
in the plugins folder of the Product folder. But it isn't found when
executed. The log entries are:
!ENTRY Alchemy2 4 0 2006-10-15 23:10:18.737
!MESSAGE From: Alchemy.Search()
!STACK 0
java.util.MissingResourceException: Can't find bundle for base name edoc,
locale en_US
at java.util.ResourceBundle.throwMissingResourceException(Unkno wn Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at org.tempuri.AuWebServiceLocator.<init>(AuWebServiceLocator.java:21)
at com.cprs.edoc.alchemy.Alchemy2.Search(Alchemy2.java:582)
at
com.cprs.alchemyviewer.GetAlchemyImage.getImage(GetAlchemyIm age.java:135)
at com.cprs.alchemyviewer.DtaQMonitor.run(DtaQMonitor.java:164)
At least I almost have it!
Thanks for the help guys.
Bill Blalock
|
|
| |
Re: Exported project can't find resource bundle, bundle is found by Eclipse App [message #456279 is a reply to message #456207] |
Mon, 16 October 2006 10:39   |
Eclipse User |
|
|
|
xiangqinxian wrote:
> Hi,
> Could you paste that build.properties file ?
> Regards
> qinxian.
Thanks for looking,
=====================================
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/,\
build.properties,\
lib/,\
lib/jaxrpc.jar,\
lib/axis.jar,\
lib/commons-discovery-0.2.jar,\
lib/commons-logging-1.0.4.jar,\
lib/log4j-1.2.8.jar,\
lib/activation.jar,\
lib/axis-ant.jar,\
lib/mail.jar,\
lib/saaj.jar,\
lib/wsdl4j-1.5.1.jar,\
edoc.Properties
=============================
edoc.Properties is in the root of the Product jar.
This is edoc.Properties, in case it matters:
==============================================
#WebServiceURL property
webservice_address = http://stpap4gt/auwebservice/auwebservice.asmx
#Database properties
server = p102
port = 1521
database = DEV8173
================================================
|
|
|
Re: Exported project can't find resource bundle, bundle is found by Eclipse App [message #456283 is a reply to message #456207] |
Mon, 16 October 2006 11:54   |
Eclipse User |
|
|
|
xiangqinxian wrote:
> Hi,
> Could you paste that build.properties file ?
> Regards
> qinxian.
This is the Manifest.MF file, throught it might help ---
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Alchemy Viewer Plug-in
Bundle-SymbolicName: com.cprs.alchemyviewer; singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.cprs.alchemyviewer.Activator
Bundle-Vendor: CPRS
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.uky.imageviewer,
com.ibm.jt400,
org.apache.xerces
Eclipse-LazyStart: true
Bundle-ClassPath: .,
lib/jaxrpc.jar,
lib/axis.jar,
lib/commons-discovery-0.2.jar,
lib/commons-logging-1.0.4.jar,
lib/log4j-1.2.8.jar,
lib/activation.jar,
lib/axis-ant.jar,
lib/mail.jar,
lib/saaj.jar,
lib/wsdl4j-1.5.1.jar
|
|
| | |
Re: Exported project can't find resource bundle, bundle is found by Eclipse App [message #456336 is a reply to message #456290] |
Mon, 16 October 2006 17:54   |
Eclipse User |
|
|
|
Alex Blewitt wrote:
> Is it a case-sensitive filing system? If so, it might be looking for
'edoc.properties' and not 'edoc.Properties'. If it's a case-insensittive
filing system (e.g. Windows) then it's quite likely that it would work from a
dev area, but fail when exported to a Jar (since the Jar is case-sensitive
regardless of what filing system it's exported to).
> You should be able to test this pretty easily (for example, change
Properties to properties). Also, if you expand the Jar out into an unpacked
version, you might find that it suddenly starts working. That's what I'd look
for.
> Alex.
Alex:
You were right. Changing the file name 'edoc.Properties' to
'edoc.pProperties' and chaning the build.properties file (refactor didn't
automatically make the change from 'edoc.Properties' to 'edoc.properties'.
How can something like 'edoc.properties' be left out of the JAR file,
exported with the project but as a file, 'edoc.properties', so that the
"soft" values can easily be edited?
Putting it in the jar file works but I might has well not use a resource
bundle if it can't be changed.
Thanks
Bill Blalock
|
|
|
Re: Exported project can't find resource bundle, bundle is found by Eclipse App [message #456342 is a reply to message #456336] |
Mon, 16 October 2006 22:53   |
Eclipse User |
|
|
|
在 2006-10-16一的 21:54 +0000,Bill Blalock写道:
> Alex Blewitt wrote:
>
> > Is it a case-sensitive filing system? If so, it might be looking for
> 'edoc.properties' and not 'edoc.Properties'. If it's a case-insensittive
> filing system (e.g. Windows) then it's quite likely that it would work from a
> dev area, but fail when exported to a Jar (since the Jar is case-sensitive
> regardless of what filing system it's exported to).
>
> > You should be able to test this pretty easily (for example, change
> Properties to properties). Also, if you expand the Jar out into an unpacked
> version, you might find that it suddenly starts working. That's what I'd look
> for.
>
> > Alex.
>
> Alex:
>
> You were right. Changing the file name 'edoc.Properties' to
> 'edoc.pProperties' and chaning the build.properties file (refactor didn't
> automatically make the change from 'edoc.Properties' to 'edoc.properties'..
>
> How can something like 'edoc.properties' be left out of the JAR file,
> exported with the project but as a file, 'edoc.properties', so that the
> "soft" values can easily be edited?
>
Maybe you could refer osgi specs and use FileLocator.find+variables.
More details code in FindSupport.class.
> Putting it in the jar file works but I might has well not use a resource
> bundle if it can't be changed.
>
> Thanks
> Bill Blalock
>
>
Regards
Qinxian
|
|
|
Re: Exported project can't find resource bundle, bundle is found by Eclipse App [message #456350 is a reply to message #456336] |
Tue, 17 October 2006 04:50  |
Eclipse User |
|
|
|
> You were right. Changing the file name
> 'edoc.Properties' to
> 'edoc.pProperties' and chaning the build.properties
> file (refactor didn't
> automatically make the change from 'edoc.Properties'
> to 'edoc.properties'.
I'm not sure that there is a refactor for changing file names; I'd have assumed that you were using F2 to rename it. If there is a refactor option, then you also have the opportunity of changing occurences of the name in other resources, but you have to specify which manually (e.g. by resource name, usually *.xml and *.mf)
> How can something like 'edoc.properties' be left out
> of the JAR file,
> exported with the project but as a file,
> 'edoc.properties', so that the
> "soft" values can easily be edited?
I'd recommend that you use a system property (e.g. the kind specified by -D) to point to the location of the properties file, which you can then read directly.
Of course, this advice isn't terribly helpful for an individual plugin, but if you're exporting a product and these are product configurations, then that's the approach I'd take. You could possibly even utilise the config.ini associated with your configuration to perform the setup on your behalf.
For a general case, there's an OSGi configuration service that you can use to configure properties on a per-plugin basis. However, there's no external file-based reader for that one, and it persists configuration between restarts.
Alex.
|
|
|
Goto Forum:
Current Time: Wed Jul 16 02:02:30 EDT 2025
Powered by FUDForum. Page generated in 0.07763 seconds
|