File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Properties files in web.xml (Struts 1.0.2)

 
Siva Ramky
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to use two different properties files in my struts project and im facing problem while configuring them in web.xml( im following struts 1.0.2 where the properties file configuration is made in web.xml instead of struts-config.xml)

i tried to use,

....
<init-param>
<param-name>application</param-name>
<param-value>ABCResources</param-value>
</init-param>

<init-param>
<param-name>application</param-name>
<param-value>XYZResources</param-value>
</init-param>
.....

where ABCResources and XYZResources are the names of my two different properites files which i have kept under classes folder.

But the above approach doesnt work and throws xml parsing error during server bootup (unmarshall exception)in weblogic 9.2 , I believe its mainly because of the duplicate 'application' entry.But the same approach worked fine in weblogic 8.1 . Please suggest if there is any work around for weblogic 9.2. Thanks
[ July 25, 2008: Message edited by: Siva Ramky ]
 
Sagar Rohankar
Ranch Hand
Posts: 2905
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Siva Ramky:
Hi,

In my project i need to use to different properties files and im facing problem while configuring them in web.xml( im following struts 1.0.2 where the properties file configuration is made in web.xml instead of struts-config.xml)


I never used Struts 1.0, but can you put those .propertise files in struts-config file using <message-resources parameter="MessageResources"/> tag and change your dtd definition to this :



Try this,
 
Siva Ramky
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your post

I have already tried that approach by moving the properties entries to struts-config .. but there i encountered a different error as shown below..

<Servlet: "action" failed to preload on startup in Web application: "webapp".
javax.servlet.UnavailableException: Input/output error reading configuration from resource path /WEB-INF/struts-config.xml
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:468)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:278)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)


This is an age-old project which needs some enhancement now. Still im looking for a workaround.
 
Sagar Rohankar
Ranch Hand
Posts: 2905
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I googled this topic and not find any great help .

The init-param are used to get application scoped values, with param-name as a parameter ,So you can change the param name to , say app1 and app2 and used in you application as parameter !
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe Struts 1.0.2 supports multiple properties files. If you want that feature, you will have to upgrade your project to at least 1.1.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic