ClassLoader in Web Container

I am having some problems some code that loads a resource using:
ClassLoader.getSystemClassLoader().getResource(resourceToFind);where resourceToFind is the resource name as a String type.
This works fine in when running from a command line, but not when running in a web container such as Tomcat.
I understand that Tomcat has a heirarchy of ClassLoaders, and I would guess, on the following diagram, that I am using the System ClassLoader. So this means it will search also using the Bootstrap ClassLoader also, but not downwards towards the Common or Shared etc ClassLoader.
                      Bootstrap
                          |
                       System
                          |
                       Common
                 Catalina   Shared
                       Webapp1  Webapp2 ...Is there any way I can get an enumeration or something of these generically. I would like this code to work in an app from the command line, but also in various app servers etc too.
I have taken a look at the JDK 1.3 source code for the java.util.ResourceBundle class, as this does what I would like to do, but it uses a native method to get the class context.

Thanks, although one of the problems I have is that it is in a static context, such as:
private static ClassLoader getClassLoader() {
    return ClassLoader.getSystemClassLoader();
}

Similar Messages

  • Can I redirect to a completely different web container?

    Hi all
    How can I redirect from a Servlet to a completely different web container. For example let's say I have MyServlet running on machine A, and according to a parameter in the request, I would like to redirect to host B (to another location).
    I tried to use RequestDispatcher.forward, but it uses a relative location (even if I added the absolute URL, like http://hostb:port/new_location).
    Can I redirect to another container?
    thanks,

    Do you need to send the data to the second site as well? That's where you will run into problems.

  • How to view the session in the web container

    hi, Folks,
    is there any way to view the sessions in J2EE web container? I need to know how many living session currently in the web container.
    Thanks

    You did not indicate the Web Server version that you are using for web container. Assuming its Sun Java System Web Server 6.1, per Servlet 2.3 specification, you should be able to use of session creation and destruction events. This can be done using HttpSessionListener to count active sessions. Here's the docs for reference:
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpSessionListener.html
    Thanks
    Manish

  • Using local session bean interface from web container using EJB 3.0

    Hi,
    How can you use a local session bean interface from Java (rather than data controls) in a web container using EJB 3.0?
    I can use a remote interface by looking up InitialContext, but I can't find a local interface this way (even from another session EJB). I can use a local interface from an EJB using annotation "EJB", but as I understand, this is not available in the web container.
    If I try to add an ejb-jar.xml file, these seems to mess up by project...
    Hope you can help.
    Roger

    The portable way to retrieve an EJB reference in Java EE is to either inject it or look it up via the
    component's private naming environment. The simplest way is :
    @EJB
    private DocumentManager dm;
    The global JNDI name is only used as an implementation specific way to uniquely assign an
    identifier to a specific Remote EJB. It's best for this not to appear directly in the source code.
    There's more on global JNDI names in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    The alternative to annotations is to use an ejb-ref to declare the ejb dependency. The ejb-ref
    is declared in the standard deployment descriptor corresponding to the component doing the
    lookup. Each ejb-ref has an ejb-ref-name, e.g. <ejb-ref-name>DM_ref</ejb-ref-name>
    The code looks up the ejb-ref-name relative to the java:comp/env namespace to retrieve the
    EJB reference.
    DocumentManager dm = (DocumentManager)
    new InitialContext().lookup("java:comp/env/DM_ref");

  • Error 1324: the folder path 'webi/' contains an invalid character

    Hi pros,
    I am getting this error when trying to install bobj xi 3.1 client version. the service pack is zero.
    however, i previously had bobj xi 3.1 server / client components installed and bobj 4.0 client tools.
    i uninstalled bobj 4 and bobj xi 3.1 server components from control panel. also, deleted them from registry.
    still i am getting the above error.
    kindly advise.

    Hi,
    Can you please check the following thread which is for the exact same question :
    error 1324: the folder path 'webi/' contains an invalid character
    Regards
    Steph

  • Possible to deploy Dist Auth in the same web container with Policy Agent?

    I have a client who has limited hardware resources and wants to deploy the distributed authentication UI in the same web container as the policy agent. Has anyone successfully done this?

    I'm sure it's possible just make sure the DAUI context (e.g. /distAuth) in the agent's configuration for the web server is in the not enforced list properties for the agent.
    However, it's so easy just to put an Apache HTTP server/tomcat and run daui, then setup another web server (Sun, Apache, etc.) with an agent or vice versa and you don't have to worry about the agent clobbering DAUI.

  • Changing the Header in a Hybrid Web Container app on BlackBerry

    Hello Experts!
    I am trying to add a custom header to Hybrid Web Container Apps on SUP 2.0.  It would be nice to add branding or additional text - even the ability to center the text would be nice.  I have tried various jQuery approaches and can see the changes working when I test via Chrome.  However when deploying to my BlackBerry simulator the changes are not reflected.  If I had to guess - it would appear the entire Header area is not modifiable.  To add more context to the problem review the generated code below from workflow_jQueryMobileLookAndFeel.html
    <div data-role="page" data-theme='a' id="ErrorDetailScreenDiv">      
          <div data-role="header" data-position="inline">
           <h1>ErrorDetail</h1>
         </div>
    Recall that each screen is a div with the data-role attribute page; similarly the div with data-role header is the area in question that I am trying to modify.
    Here is the jQuery I am using in the customBeforeWorkflowLoad method in the Custom.js file.
    $('[data-role="header"]').each(function() {
              var dvHeader = $(this);     
              var elem = dvHeader.find('h1');
              var h1Str = elem.text();
              elem.empty();
              dvHeader.remove('h1');
                    //function buildHeader returns html text of a div etc
              var txt = buildHeader(h1Str);
              dvNewHeader = $(txt);
              dvHeader.append(dvNewHeader);     
    Again when testing in chrome the text is removed and the new header is added.
    If I had to guess - I would say the Workflow application which wraps around the Hybrid Web Container App is interfering;  I assume the workflow (native) application reads the h1 tags and the header we see on the device is the workflow app and not the Hybrid Web Container.  My other guess would be the Header area is somehow locked in the BlackBerry scenario.
    Thanks.
    Edited by: JUSTIN MCGREW on Sep 22, 2011 5:18 PM
    Edited by: JUSTIN MCGREW on Sep 22, 2011 5:21 PM
    Edited by: JUSTIN MCGREW on Sep 22, 2011 5:22 PM

    Hello,
    Yes I was aware of the customBeforeShowScreen method of adding a screen header.  I believe in my testing I determined for ListView-based screens and credential screens the dynamic header is not shown and only works on pages with an HTMLView.
    Doesnt it seem a little silly to have two headers?
    Example:
    Login Page
    Logo \ Login Page \ Custom Text
    Screen Body
    I will accept that there is not a method to replace the header at the very top of the screen.
    Thanks for your time and help!
    -Justin

  • How to Configure Apache Web Server  with Tomcat web container in Linux

    Hi all,
    I am working on Tomcat web server 5.0.19 on Linux AS 3.0., ( my Control Server)
    I need map my tomcat to Apache Web Server (httpd) in another system
    (web server).
    I dont have jk2_ or jk_mod .so files to use in my tomcat/conf directory to make them available for httpd.conf files of Apache Web server.
    I have only jk2.properties file in my conf.,
    Please tell me how to go about it
    my mail id [email protected]
    Thank You
    Subramanyam.V
    Hyderabad
    India

    The simple answer is to download a web server that has a web container already integrated on it, so all that painful configuration work is avoided.
    You can use the mature SJS Web Server 6.1 SP5 at
    http://www.sun.com/webserver
    Or you can try a preview of the upcoming version at
    http://www.sun.com/download/products.xml?id=446518d5
    You will get better performance and security, with easy of use, at about the same price ;)

  • Threads running in web container

    How to get current web container active threads count,and how to get the max web container thread count ,in weblogic

    Hello Slava,
    The output you see when running to web from Reports Builder is controlled by the web source of your report. Please take a look at your web source and confirm whether that the reports JSP tags are indeed present to fetch the data and format the web output.
    Also, note that if you want to deploy your report using its web layout, you would need to save it as a JSP, as only JSPs can be deployed directly over the web.
    RDF files can be run over the web only using rwservlet, and doing so will cause the output to be formatted using the report's paper layout instead of it's web layout.
    Thanks,
    The Oracle Reports Team.

  • Web Service without Web Container

    There is any framework for do a app with a Web Service Server without deploy in a Web Container?
    I want to do a Desktop app with Web Services and WSDL for a php client. I only had found examples for deploy on Tomcat and others.

    If I change this: @SOAPBinding(style = Style.RPC, parameterStyle=ParameterStyle.BARE)
    It have same error that in soap client for php:
    javax.xml.ws.soap.SOAPFaultException: Cannot find dispatch method for {http://schemas.xmlsoap.org/soap/encoding/}parametros
    at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
    at $Proxy53.usuarioSaldo(Unknown Source)
    at trservidor.TRServidorView.<init>(TRServidorView.java:128)
    at trservidor.TRServidorApp.startup(TRServidorApp.java:19)
    at org.jdesktop.application.Application$1.run(Application.java:171)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

  • How to run a report out of the web container?

    Hi All,
    <p>
    Does anyone have tips on running a report outside of the web container?  I'd like to be able to JUnit the scenarios I'm coding up without having an app server running.  What is the ReportClientDocument expecting in the request, response, and context?  The code as shown just returns the enclosed error.
    <p>
    All I'm really trying to do is have the report execute and be able to assert that the data is appropriately retrieved from the data source.  If there's a way to do that without the Viewer, that would be cool, too.
    <p>
    Any tips would be much appreciated.   Sorry about the poorly formatted code and error... the code tags don't seem to be working...
    <p>
    Thanks,
    <p>
    Eric
    <pre>public void testReportRunning() throws ReportSDKExceptionBase{
              ReportClientDocument rcd = initReportClientDoc("./test/data/EBTest1.rpt");
              assertTrue(rcd.isOpen());
              CrystalReportViewer crv = new CrystalReportViewer();
              crv.setReportSource(rcd.getReportSource());
            String htmlContent = crv.getHtmlContent(new MockHttpServletRequest(), new MockHttpServletResponse(), new MockServletContext());
            System.out.println(htmlContent);
    com.businessobjects.report.web.shared.WebReportingException---- Error code:0
         at com.businessobjects.report.web.e.if(Unknown Source)
         at com.businessobjects.report.web.e.a(Unknown Source)
         at com.crystaldecisions.report.web.ServerControl.a(Unknown Source)
         at com.crystaldecisions.report.web.ServerControl.a(Unknown Source)
         at com.crystaldecisions.report.web.ServerControl.getHtmlContent(Unknown Source)
         at com.tririga.crystalpoc.ReportAccessorTest.testReportRunning(ReportAccessorTest.java:82)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at junit.framework.TestCase.runTest(TestCase.java:164)
         at junit.framework.TestCase.runBare(TestCase.java:130)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:120)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)</pre>
    Edited by: Eric Batzdorff on Jun 12, 2009 12:24 AM
    Edited by: Eric Batzdorff on Jun 12, 2009 12:24 AM
    Edited by: Eric Batzdorff on Jun 12, 2009 12:25 AM

    There's no documentation as to what's the minimum HTTPServletContext, HTTPServletRequest and HTTPServletResponse the CrystalReportViewer expects. 
    There certainly are plenty of unit testing frameworks for Java Web Apps out there, if that's where you're headed.
    Sincerely,
    Ted Ueda

  • ServerSocket(TCP/IP) listening in the web container part

    So, if I implement the ServerSocket(TCP/IP) listening in the web container part (Websphere), what is the best way to do this?
    I need to monitor socket state and statistics from browser.
    When I receive message from socket, I must read something from database and send as response to client (meaning I need to create my own thread to do this).
    Solution:
    - to have one servlet with serverSoket listener in it or
    - during web application statup to start my own thread with serverSoket listener
    - or....
    Also there is a problem that websphere write warning when i try do use DB connection from thread I have created!
    Any suggestion?

    hi,
    do you use websphere? version?
    More details:
    http://www.javaranch.com/newsletter/200403/AsynchronousProcessingFromServlets.html
    According to a Technical note from WebSphere support "If a Servlet is spinning its own threads and accessing a database, the J2EE specification is not clear on this, so WebSphere Application Server 5.0 will allow it at this time. IBM is working with Sun to clarify this in the specification, so eventually (i.e. J2EE 1.4) spun threads from a Servlet accessing a database outside of a transaction will not be supported either". Later the same tech note states "Customers should consider changing their application to comply with the J2EE specification."
    and check this
    http://www-1.ibm.com/support/docview.wss?uid=swg21121449

  • Using Local EJB obect in web container that installed in on the same Web AS

    we can use the local ejb object in the application that runs in same JVM.
    The Web Container and EJB Container run in the same JVM when Web AS installed as Minimum Cluster Installation(one cluster node).
    But, what happened if we install the Web AS as Large Cluster Installation? Can we still use the local ejb objects in the Web Container?
    Best regards,
    Raja
    Message was edited by: Raja Nasrallah

    Hi Raja,
    Yes you can. When you use local EJB objects there's no remote communication and the web container will find them in the EJB container of the local cluster node. For the application providers this is transparent - they shouldn't care about the configuration of the cluster.
    Best regards,
    Vladimir
    PS: Please consider <a href="https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm#lostme">rewarding points</a> for helpful answers.

  • Schedueld tasks in web-container

    Hi,
    i have a small application consisting only of a set of JSP's.
    My problem is: I need to execute a task at schedueld times (e.g. every 5 minutes) and I also want the task to run in the web-container.
    What is the best way to achieve this?
    Thanks in advance

    Hi hemmings!
    I'm currently working in something like this. I can't use TimerTask approach because schedule may vary before next execution gets reached. For instance, user may want to execute something in Chritsmas and cancel the execution before the day arrives. The points I must cover are:
    User configures the execution giving:
    Start date, end date. Both might be null = eternity.
    When daily, every...
    When weekly, every... at weekday...
    When Monthly, every... at monthday...
    or every... the nst weekday...
    Plus daily frequency, starting at... ending at... every...
    Scheduler will point to the script that should be executed. Script must accept Java and SQL syntax.
    I already did something similar some years ago, but I was not quitely satisfied.
    Well, if your requirements are similar to mines I will be glad to share code with you.

  • SUP Hybrid Web container Offline Mode

    Hello,
    I tried out a workflow example on blackberry simulator(using hybrid web container),but when i am in offline mode,the example doesnot work,so i had a doubt whether hybrid webcontainer supports offline mode,or do we need to do anything in the code,to support this.
    regards
    kaushik

    in the SUP documentation it is mentioned that offline support is provided,refer the link
    http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01203.0200/doc/html/apr1300926372606.html)

Maybe you are looking for

  • Warning on safari

    Hi. Whenever I am using safari and clicking to a new page it opens up with a warning saying system may have found unauthorized access on your computer and malicious viruses Rootkit.spyware and Trojan.malware. also I get a warning from http://shopatkm

  • Usage of MAX Function.

    Hi, One of our customers is facing an error while executing a PL/SQL block like, declare l_flag varchar2(30); begin select max('Y') into l_flag from v$database; -- Can use any table here end; however, when the select query is changed to as follows, n

  • SNMP traps from Cisco 4404

    I have a Cisco 4404 WLC that sends its system logs to a syslog server (kiwicat), but I'm interested in getting the snmp traps sent over there as well.  I've configured the syslog server to accept the snmp on the right ports and I've confirmed that th

  • Convert path with effects to plain path

    Ok I have a square that has a scribble effect on it. I want to convert this square with the scribble effect to a bath where each scribble is outlined, sort of like live trace, but I'm not sure if this is possible. Thanks to those who help.

  • Abstract interfaces between diff swcvs

    Hi Guys, I am designing BPM under my own SWCV. I need to use two abstract interfaces which were defined in entirely different SWCV. My scenario is like Proxy-BPM-SOAP. The scenario is synchronus but the Proxy side i have two seperate interfcaes as ou