Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 04:18 Go to next message
Bill Blalock is currently offline Bill BlalockFriend
Messages: 119
Registered: July 2009
Location: Alabama
Senior Member
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 #456207 is a reply to message #456205] Mon, 16 October 2006 08:04 Go to previous messageGo to next message
Xiang Qinxian is currently offline Xiang QinxianFriend
Messages: 119
Registered: July 2009
Senior Member
Hi,
Could you paste that build.properties file ?

Regards
qinxian.

在 2006-10-16一的 04:18 +0000,Bill Blalock写道:
> 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 14:39 Go to previous messageGo to next message
Bill Blalock is currently offline Bill BlalockFriend
Messages: 119
Registered: July 2009
Location: Alabama
Senior Member
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 15:54 Go to previous messageGo to next message
Bill Blalock is currently offline Bill BlalockFriend
Messages: 119
Registered: July 2009
Location: Alabama
Senior Member
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 #456290 is a reply to message #456279] Mon, 16 October 2006 20:29 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
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.
Re: Exported project can't find resource bundle, bundle is found by Eclipse App [message #456334 is a reply to message #456290] Mon, 16 October 2006 21:07 Go to previous messageGo to next message
Bill Blalock is currently offline Bill BlalockFriend
Messages: 119
Registered: July 2009
Location: Alabama
Senior Member
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.

The operating system is Windows XP and is not normally case sensitive.

I am testing whether renaming the properties file corrects the problem.

Thanks
Bill Blalock
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 21:54 Go to previous messageGo to next message
Bill Blalock is currently offline Bill BlalockFriend
Messages: 119
Registered: July 2009
Location: Alabama
Senior Member
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] Tue, 17 October 2006 02:53 Go to previous messageGo to next message
Xiang Qinxian is currently offline Xiang QinxianFriend
Messages: 119
Registered: July 2009
Senior Member
在 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 08:50 Go to previous message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
&gt; You were right. Changing the file name
&gt; 'edoc.Properties' to
&gt; 'edoc.pProperties' and chaning the build.properties
&gt; file (refactor didn't
&gt; automatically make the change from 'edoc.Properties'
&gt; 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)

&gt; How can something like 'edoc.properties' be left out
&gt; of the JAR file,
&gt; exported with the project but as a file,
&gt; 'edoc.properties', so that the
&gt; "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.
Previous Topic:Type java.lang.Class cannot be resolved
Next Topic:(howto) Share icons across many bundles ?
Goto Forum:
  


Current Time: Sat Apr 27 02:45:43 GMT 2024

Powered by FUDForum. Page generated in 0.04068 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top