Accessing the text/property file inside the root context

Hi
          I want to access the property file lying inside the root context folder
          via plain java classes using IO.
          Could you please help me out.

Hi
Using this.getClass().getClassLoader().getResource("config_settings");
In order to load the properties file, uses the classpath search mechnism.
Basically it means that java will look for your file in the classpath.
The defualt class path of a web server is usualy the following:
ContextName/Web-Inf/Classes;ContextName/Web-Inf/lib
This is why it is working for you when you put your properties file under ContextName/Web-Inf/Classes, but it doesnt work when it is under ContextName/*, as this is not a part of the classpath search.
You have 3 options:
1.Put you properties file under the sever defulat classpath
(ContextName/Web-Inf/Classes;ContextName/Web-Inf/lib,if it's under lib, the file has to be inside a jar file)
2.Add ContextName/* to your server classpath ( in tomcat->setClasspath.bat file )
3.Instead of using "this.getClass().getClassLoader().getResource("config_settings"
read your file directly using the java.io.* library and give it the full path to the file,
you can store the full path in web.xml file, or using getServletContext().getRealPath("") to locate the context path and read the file from there( but then you are using the Servlet API )
Hope it helps
all the best
tal

Similar Messages

  • GPO to prevent users from accessing the root folder of their profile doesn't work

    Hi,
    Here's the scenario:
    In a Windows 2012 RDS I created two groups called RemoteApp users and remote desktop users.
    These groups are defined in the collection for the corresponding RD Session hosts.
    These groups are not included in any other group, but they are located under an OU -called  Remote Users.
    In the domain controller I have created a GPO named "Restrict access to root drive"  which is linked to the Remote Users OU.
    The GPO I selected is - "Prevent users from adding files to the root of their users files folder"
    This doesn't seem to work. I have waited more than a few hours to allow the 90 minutes update, plus used the gpupdate /force
    but when a user clicks on the RemoteApp (Excel in this example) then access to the C: drive (which is the root folder of the user's profile) is enabled, and the user can create folders and save files under C:.
    I tried to run gpresult for the specific user but the GPO I created wasn't mentioned.
    I thought this would be a straight forward mechanism, but somehow it looks like something is missing.
    I have read about loopback and expanding, but not sure if this is what needs to be done, and if yes - I'd appreciate if I can get  step by step instructions. Everything I found so far was VERY vague.
    Thanks !
    One more detail that may be relevant - the DC is a Windows Server 2012, and the session host is a Windows 2012 R2.

    > These groups are not included in any other group, but they are located
    > under an OU -called  Remote Users.
    >
    > In the domain controller I have created a GPO named "Restrict access to
    > root drive"  which is linked to the Remote Users OU.
    >
    The USER accounts need to be in the OU your GPO is linked to. Despite
    their name, GPOs do NOT apply to groups, but to users (and computers).
    Groups only provide an additional layer of filtering...
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • I cant access the root share of a windows server after upgrading to mountain lion

    Hi Guys,
    Since upgrading to mountain lion i cant access the shared drives on our windows server. For example in a windows machine if i go to run the type \\server\ i get all the visible shares available. in my previous version i was able to do the same (obviously i would authenticate with my AD account). now when i try to access those same shares i get the message below:
    "The operation cant be completed becuase the original item for "/" cant be found"
    I can however connect to the shares directly for example if i connect to server path \\server\data it works ok.
    I have verified my account details and they are ok - i have also disconnected and reconnected the connection.
    This was working fine before the upgrade. can anyone help??

    well iv just managed to get to 35 gig free (just deleting iphone backups) and im now able to get past the next screen on bootcamp.
    unfortunatly its only allowing me to create a new partition not delete the current.
    this is leading me to think the old ones master partition has become damaged and the hard drive dosent know it exists any more.
    if this is the case (please tell me im wrong though) what options do i have as i dont want to / have the money to buy another hard drive to back everything up to it with.
    thanks again
    gareth

  • Specify a property file inside a ear file

    Hi guys I have this myApplication.ear file.
    All the project inside the ear file are using myProperties.properties file.
    I have been told that this property file has to be inside the ear file.In websphere 7.0 ,the administrator will specify a jvm classpath like /webAS/installedApps/myApplication.ear/myProperties.properties.During runtime my code will find the property file using this class path
    I am using RAD 7.5 to generate the ear file.Can some one tell me how to achieve this.Basically my ear file has to be bundled with the property file.
    thanks
    m

    You might get better results from a RAD forum if you a havent already figured out your issue.

  • Changing values in property file inside a jar in an ear

    Hi,
    I have an application that contains EJB. The environment values needed for initial context of the ejb is kept in a .properties file. I have created an ear of the application. Inside the ear there is a jar which contains the .properties file. I need to deploy the ear to different environments. However before deploying I need some kind of script to change the values in the .properties file inside the jar in the ear.
    Can anyone provide some help/pointers about how can I achieve it (Using ANT/WLST)

    WLST does not have any capability to update a JAR.
    WLS 10.3 (still in tech preview) has the ability to override properties
    files inside the jar with an external properties file. This would allow you
    to deploy the same ear to different environments, and then only deploy a
    different properties file in the plan directory.
    <Rishi Shah> wrote in message news:[email protected]..
    Hi,
    I have an application that contains EJB. The environment values needed for
    initial context of the ejb is kept in a .properties file. I have created an
    ear of the application. Inside the ear there is a jar which contains the
    .properties file. I need to deploy the ear to different environments.
    However before deploying I need some kind of script to change the values in
    the .properties file inside the jar in the ear.
    Can anyone provide some help/pointers about how can I achieve it (Using
    ANT/WLST)

  • I suddenly can't access the Root User Account

    Things were working fine, then I used Disk Warrior to clean things up. Now when I enable Root User, I can't log it the account. I tried the change password and used the new PW and no joy.
    I use Root when I am working on user directories and have never seen this before.
    Any help or ideas would be appreciated,
    DN~

    silly me.

  • Calling property file inside jsp in weblogic.

    In JSP file, sometimes, we use the following code in the jspInit()
              <%!
              ResourceBundle resouce =null;
              public void jspInit() {
              resource = ResourceBundle.getBundle("resources");
              %>
              The resources.properties is the file to have the name value pair, which is
              easy to get a list of something.
              Can I still use properties file in my JSP in weblogic? where should I put
              properties? is it weblogic\myserver\under public_html ?
              Thank you for any help.
              li
              

    Can I still use properties file in my JSP in weblogic? where should I          put
              > > properties? is it weblogic\myserver\under public_html ?
              >
              > yes, put the properties file in your java classpath.
              I mean to say, put properties file in a directory, which is in Java class
              path.
              thanks,
              -ramu
              "Ramu" <[email protected]> wrote in message
              news:3a6623c0$[email protected]..
              > "li" <[email protected]> wrote in message
              > news:3a661a8c$[email protected]..
              > > In JSP file, sometimes, we use the following code in the jspInit()
              > > <%!
              > > ResourceBundle resouce =null;
              > > public void jspInit() {
              > > resource = ResourceBundle.getBundle("resources");
              > > }
              > > %>
              > > The resources.properties is the file to have the name value pair, which
              is
              > > easy to get a list of something.
              > >
              > > Can I still use properties file in my JSP in weblogic? where should I
              put
              > > properties? is it weblogic\myserver\under public_html ?
              >
              > yes, put the properties file in your java classpath.
              >
              > -ramu
              >
              >
              >
              > >
              > >
              > > Thank you for any help.
              > >
              > > li
              > >
              > >
              > >
              > >
              >
              >
              

  • Value does not fall within the expected range in my itemupdated eventreceiver while accessing a splist column on the root site collection

    hi,
     I am performing the below operations:
    1) Itemupdated event handler when a document is uploaded into the document library
    2) Now amreading another list which is in the root  site level so, i used spsite, spweb again and accessed that splist and trying to read single line of text column and user or group column.
    Now when i am reading this, i am getting the error "Value does not fall within the expected range".
    I went to resource throttling under central admin -->my current web appln and changed that value to 20  from 8
    even after performing the above, i am getting the same error.
    pls help anyone has faced this issue before.
    Accessing a splist which is under root site collection within the itemupdated eventreceiver is allowed in SP ?

    hello sir,
     as per my requirement i have to access a  splist which is residing in the ROOT SITE COLLECTION OF THIS WEB APPLICATION. the event receiver i have written is residing in one of the few document libraries within the sub site. there are hundreds
    of sub sites exist in this site collection. I need to access the root site collection within the itemevent receiver and access thatperson column from that splist. why i ahve kept this list at the root site collection level [
    http://server1:2020/ ] , because this  splist is the UI for customer's sp admin for performing  weekly tasks. like adding few items in the splist and my event receiver fires and check this column- person /group
    column ]  and apply permissions on the  document.
    so my doubt is it possible to access the root site collection from my event receiver code.
    spweb from properties web is just the subsite url and not the site collection. i want to get the root sitec ollection url's splist.
    also am already running this code under runwithelevatedprivileges.

  • Initial JNDI context doesn't return the root node

    Hi :
    I just deployed a java application on Netweaver CE 7.2, when the application starts up, the code is trying to perform a JNDI bind and lookup operations by calling " Context context = new Initialcontext(), context.bind(), context.lookup("...)", the problem is that the initial context returned is not the root context (i.e. "/"), it's something like "webcontainer/applications/vendor-name/application-name/module-name/...." etc.. This is a problem for us because our application is consisted of multiple ears with multiple modues(wars) inside each ear, each module needs to publish a set of services as JNDI entries and those services (JNDI entries) need to be accessible to other ears or modules, which means they have to be published under some public directory (for exmaple the root directory), it can NOT be published under the current context of the current module.
    So,  my questions is, is there a way to make the "new Initialcontext()" to return the root directory, perhaps by changing the deployment descriptor or configuration settings somewhere? thanks a lot for your help.

    Hi,
       Add this code to the <i>wdDoModifyView()</i> method:
    IWDRoadMap rdMap = (IWDRoadMap) view.getElement("<id of the RoadMap UI>");
    rdMap.mappingOfOnSelect().addSourceMapping("step","selectedStep");
    Edit the StepSelected action to add a parameter called "<i>selectedStep</i>" of type String. After this the signature for the action handler will look like:
    public void onActionStepSelected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, String selectedStep )
    Inside the action handler you can access the selected step simply as "<i>selectedStep</i>".
    Regards,
    Satyajit.

  • Access E17 File Manager as root

    Hi Everyone,
    I'm having trouble in finding out which command line to use to access the root part of the E17 file manager - I've tried gksu enlightenment but that didn't work could anybody help if possible.

    DarkCerberus wrote:
    Hi Everyone,
    I'm having trouble in finding out which command line to use to access the root part of the E17 file manager - I've tried gksu enlightenment but that didn't work could anybody help if possible.
    I think i remember a quote by rasterman himself that in order to access EFM as root enlightenment has to run as root since the FM is integrated in it. Or something along these lines. I might be wrong so better wait people knowing E17 better than me.

  • Access the site title, url from new -spsite cmd let

    hi,
    I am creating  new site using the pshel
    new-spsite -name $projectName –Description $projectDescri -Template "STS#0" -ContentDatabase $contentdbnameproj $sitecollecName -OwnerAlias $primAdmin_1 –SecondaryOwnerAlias $secondaryAdminin -verbose
    and I want to get the site url  created here,
    Can i assign the output  of this command to a pshell varibale? so that i can  access the root web's title and url and perform more operations like  adding few users into the members group,add some other users into a list within
    this site collection etc ...

    i have written the  belwo script  for creating siet collec with sepcific content db and geting the rootweb property and able to manipulate partially.
    but i was getting few errrors while manipulating the  groups etc
    $ErrorActionPreference="Stop"
    Write-Host "Create SiteColection"
    $dummywebappname= "http://srvr:1009"
    $projectName = Read-Host "Enter Project Name"
    $projectDescri = Read-Host "Enter Project Description"
    $contentdbnameproj= "WSS_ContentDB_"+$projectName
    #$contentdbnameproj="WSS_ContentDB_Project"
    new-spcontentdatabase -name $contentdbnameproj -webapplication $dummywebappname -verbose
    Write-Host -f yellow "Project DB has been created"
    $sitecollecName = $dummywebappname + "/sites/"+$projectName
    #$primAdmin = Read-Host "Enter primray admin name: like in\p.p";
    $primAdmin_1 = "in\p.p"
    #$mtemplate= Get-SPWebtemplate -Identity "STS#0"
    #$secondaryAdmin = Read-Host "Enter secondary admin name: like in\p.p";
    $secondaryAdmin_1 = "in\h.v"
    #$rildccs= read-host  "Enter names with semilcolon separated like: "
    #$EM= read-host "Enter EM Name with semilcolon separated like: "     #"in\m.n";
    #$PM= read-host "Enter PM Name with semilcolon separated like: "     #"in\m.n";  "in\r.r.s";
    # list name where EM and PM needs to be inserted
    $projlistname="Project_Master"
    new-spsite -name $projectName –Description $projectDescri -Template "STS#0" -ContentDatabase $contentdbnameproj $sitecollecName -OwnerAlias $primAdmin_1 –SecondaryOwnerAlias $secondaryAdminin -verbose
    $mprojectURL=$sitecollecName
    $sitecollecURL=  $sitecollecName
    $currsite=Get-SPSite $sitecollecURL
    $currWeb=$currsite.RootWeb
    Write-Host  -f yellow "Project named " $projectName  " with URL" $mprojectURL "was  successfully created"
    Write-Host -f yellow "starting to create default groups..."
    $projSite = New-Object Microsoft.SharePoint.SPSite($sitecollecName) 
    $projweb = $projSite.RootWeb
    $projweb = Get-SPWeb $projweb.Url
    $projweb.Update()

  • How to configure multiple virtual hosts for the same context root /

    Hi,
    I am using Glassfish V1 U1 - b14 on Solaris.
    I am trying to configure two applications to be mapped to the / root context, each one in its own virtual host.
    Two things I have noticed:
    1. I have to manually add virtual-hosts="hostId" in domain.xml/application-ref ... looks like just simply deploying the app does not do that although the application is set as default for its particular virtual host. Is this a bug?
    2. Although I have set for each virtual host the default web-app correctly, and they both respond fine, I cannot map both of them to the / context. The second application (chronologically deployed) does not respond when called with the / context ....
    Any ideas? Is this a bug again?
    Regards,
    Rares
    Message was edited by:
    raresp

    Wow, that's a shame. All mighty Application Server and two different apps on two different virtual hosts are considered ambiguous to have the same context root definition.... Fair play to Tomcat and 90% of the rest of servlet containers!
    In my case I have the same EAR we are planning to deploy to many (up to 30) virtual hosts. Faking different context roots for each deployment will bring unnecessary overheads...
    Should I file a bug or feature request?
    Thanks again for your answer, although you're basically saying it is not possible I will wait and look a while for a possible solution before bringing this topic to a conclusion.

  • I have just bought the iPad Air but when I try accessing my fotos from my iCloud account, I only get this years fotos whereas in my old iPad I can access the last three years of fotos. I've tried syncing to the computer but it didn't help

    I have just bought the iPad Air but cannot access the roots I have on my iCloud account. They do appear on my old ipad 2, any ideas how I can access them please

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • [solved] Unable to find the root device after an upgrade - diff. case

    Background: I recently upgraded my installation done in August 2011 to the most recent packages with 'pacman -Syu' - which, amongst some other minor issues that I fixed,  apparently broke my installation's boot sequence. Not sure if this is relevant, but I forced the upgrade as it's been prescribed here.
    Note to self: do backups before any major upgrades like this.
    Problem: The problem is of the same origin as seen in this post - systems lets me know it cant access the root partition anymore. I'm halfway through the procedure that pineapple-biku suggested but since my partition layout is different - and - because I don't have much understanding of what *exactly* I'm supposed to do and accomplish, I'm stuck for now.
    What is the best way to find out the exact labels of encrypted volumes and their corresponding kernel device IDs (i.e. /dev/sda6 for 'tmp' and so on)? I have several volumes of the same size, thus it's hard to guess which is which without knowing for sure.
    Details: My setup has an unencrypted '/boot' partition and 7 other encrypted partitions, including /root, /usr and others. These are contained within a single extended partition.
    Any help will be greatly appreciated. In case I've left out some important information, let me know, and I'll do my best to provide it.
    Last edited by Raija (2012-02-28 03:06:25)

    Thank you both for your assistance. Some more understanding was exactly what I was in need of.
    falconindy wrote:The news item you posted says to force the installation of a single package, not the entire upgrade. These two things are not equivalent.
    Thanks for pointing that out. I'm still a newbie when it comes to Pacman, thus prone to such mistakes.
    Gcool wrote:
    Raija wrote:What is the best way to find out the exact labels of encrypted volumes and their corresponding kernel device IDs (i.e. /dev/sda6 for 'tmp' and so on)? I have several volumes of the same size, thus it's hard to guess which is which without knowing for sure.
    # ls -lah /dev/disk/by-label
    # ls -lah /dev/disk/by-id
    # ls -lah /dev/disk/by-uuid
    This should get you on the way on discovering which disk is what exactly (you'll need to know the / and /boot partition in order to fix the issue).
    Thank you. I'll try that.

  • Opening html files inside jar

    Hi,
    I'm making a program where i have a set of help files in the form of html and i would like to open them when the user clicks the "Help" button and I used this code at first
    try
         Desktop.getDesktop().browse(new URI("resources/html/help.html"));
    catch (Exception ex)
         JOptionPane.showMessageDialog(null, "Could not open help.html in default browser\n", "Error", JOptionPane.ERROR_MESSAGE);
    }However after I made the jar and tried to execute on another computer however, it wouldn't work and would display the error message. I was wondering if there was some way that I could open the help.html in their default browser, or maybe a frame if that works, from the jar and have my program still be platform independent?

    ok so i just realized that it doesn't make sense for a program outside the jar, like IE or Firefox, to be able to access and open a file inside of the jar. I am now looking for suggestions on how to work around this problem for my program to be able to have a simple help system located inside the jar that can be loaded during runtime.
    Thanks for your suggestions.

Maybe you are looking for

  • Can i install windows server 2008 r2 under Windows Small Business Server - Premium

    I have purchased Windows Small Business Server 2008 - Premium and i want to know if i can install Windows Server 2008 R2 and activate the same under the same license. Also if there is a link to download the ISO file of the server.

  • How to display values of shuttle pane by defaul in left shuttle

    Hi I have created shuttle pane through JDeveloper and I have set all properties It also displays on page well there are two boxes or shuttle displayed one is for containing all values another for selected values but in my case bydefault all values ar

  • Front row on yosemite

    I'm trying to use the Menu button from the remote control and it doesn't display anything, the rest of the buttons work ok but Front Row doesn't show up. Is it disable on Yosemite system?

  • Itunes Opening itself every 2 minuites - APPLE NOT LISTENING

    Itunes is opening itself every two minutes and playing music. I do not have any 'devices'  plugged in. It is not enabled for startup. I remember having this problem a year or so ago with another update on an older operating system but that fix does n

  • Business Process Procedures-Document

    Hi Guys, I am looking for Business Process Procedures document of QM. Is there any link where I can get the Business Process Procedures Normaly these documents are with Building block documents but for QM it is not available for any process other tha