How to load a class dynamically in the current/system class loader

I need to dynamically load a new jdbc driver jar to the current/system class loader... Please note that creating a new classloader will not help since the DriverManager refers to the systemclassloader itself.
Restarting the application by appending the jar to its classpath will solve the problem but I want to avoid doing this.

Did you then create a ClassLoader to load the JDBC
driver and then install it into the system as
directed by the JDBC specification (ie
Class.forName(someClassName))?
And then try to use it from a class loaded fromsome
other ClassLoader (i.e. the system class loader)?
If you did not try this please explain why not.O.K. I just looked at the source to
java.sql.DriverManager. I did not know what I was
talking about, as what I suggested above will not
work.
This is my new Idea:
Create a URLClassLoader to load the JDBC driver also
in this ClassLoader you need to place a helper class
that does the following:
public class Helper {
public Driver getJDBCDriver(String driverClassName,
String url) {
try {
Class.forName(driverClassName);
Driver d = DriverManager.getDriver(url);
return d;
catch(Exception ex) {
ex.printStackTrace();
return null;
}Now create an instance of the Helper class in the new
ClassLoader, and call its getJDBCDriver method to get
an instance of the driver (you will probably have to
create an interface in the root class loader that the
Helper implements so that you can easily call it).
Now from the root classloader you can make calls
directly to the returned Driver and bypass the
DriverManager and its restrictions on cross
ClassLoader access.
The only catch here is that you would have to call to
the returned Driver directly and not use the Driver
Manager.This sounds like will work but I did not want to load DriverManager in a new classloader.. I did a hack
I unzip the jar dynamically in a previously known location (which I included in my classpath when launching the app). The classLoader finds the class now though it did not exist when the app was launched !
A hack of-course but works eh ..

Similar Messages

  • How cost;ly it is to get the current system time

    I am using this call "System.currentTimeMillis()" to get the current system time. I need to now how costly it is to get the current system time.

    Why don't you time it -:) Run it 10000 times and print the first and last result. The difference is the time it took.

  • How to create  some columns dynamically in the report designer depending upon the input selection

    Post Author: ekta
    CA Forum: Crystal Reports
    how  to create  some columns dynamically in the report designer depending upon the input selection 
    how  export  this dynamic  report in (pdf , xls,doc and rtf format)
    report format is as below:
    Element Codes
    1
    16
    14
    11
    19
    10
    2
    3
    Employee nos.
    Employee Name
    Normal
    RDO
    WC
    Breveavement
    LWOP
    Sick
    Carers leave
    AL
    O/T 1.5
    O/T 2.0
    Total Hours
    000004
    PHAN , Hanh Huynh
    68.40
    7.60
    76.00
    000010
    I , Jungue
    68.40
    7.60
    2.00
    5.00
    76.00
    000022
    GARFINKEL , Hersch
    66.30
    7.60
    2.10
    76.00
    In the above report first column and the last columns are fixed and the other columns are dynamic depending upon the input selection:
    if input selection is Normal and RDO then only 2 columns w'd be created and the other 2 fixed columns.
    Can anybody help me how do I design such report....
    Thanks

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • Parallel How many times user can login to the SAP system through ITS

    Hello all
    We are using the ITS ---620 and following 46D R/3 system 
    R/3 system details:
    Kernal :
    kernel release :46D
    O/S :SunOS 5.8 Generic_108528-05 sun4us
    We would like to now, At a time How many times user can login to the SAP system through ITS
    Kindly letus know  if any one have idea about parameter which can restrict the end users to u201CNu201D times/ sessions.
    Transaction SITSPMON/SMICM are not working in R/3 system as it is 46D.
    We found that parameter u201Clogin/disable_multi_gui_loginu201D works with SAPgui logons.
    System logons using the Internet Transaction Server (ITS) or Remote Function Call (RFC) are not affected by this Parameter u201Clogin/disable_multi_gui_loginu201D
    I need similar parameter u201Clogin/disable_multi_gui_loginu201D for the ITS users.
    Thanks

    I have searched all docs and notes.
    Everytime the answer is PArameter for multi_gui_logonis not applicable for SAP Gui for HTML ( Browser )
    The functionality does not exist for SAP Gui for HTML.
    Regards,

  • How to compare the current system time with two timing?

    want to get the current system time and compare with the two different timing example startwindow time as 2:00:00AM and endWindowTime as 6:00:00AM. if my current system time falls between these window i have to execute my rest of the code.
    my below code works for fine for JAVA 1.6 version when i do the same code with JAVA 1.4 i am getting different date and time
    String starTime=(String) NightlyvendorStatus[0].getPropertyValue("startTime");
      String endTime=(String) NightlyvendorStatus[0].getPropertyValue("endTime");
      Date windowStarttime = new SimpleDateFormat("HH:mm:ss").parse(starTime);
      Date windowEndtime = new SimpleDateFormat("HH:mm:ss").parse(endTime);
      Date systemdate = new Date();
      SimpleDateFormat parser = new SimpleDateFormat("HH:mm:ss");
      String systemTime=parser.format(systemdate);
      Date currentTime = new SimpleDateFormat("HH:mm:ss").parse(systemTime);
      if (currentTime.after(windowStarttime) && currentTime.before(windowEndtime)){
    --- rest logic here---}
    the output from JAVA 1.4 IS Thu Jan 01 02:00:00 GMT 1970 Thu Jan 01 06:00:00 GMT 1970 Thu Jan 01 03:23:00 GMT 1970
    HOW TO DO this logic..

    Hi,
    You can try converting dates into timestamp and compare just like as comparing two integers variables.
    Regards,
    Anshul

  • How to create a different sid in the same  system

    Hi Experts
    In one system already i have installed HP Quality center with Oracle, Now i want to install SAP on the same system. Please help me how to create a different SID on the same system.
    Thanks in advance

    Hi,
    If you are talking about host...then when you will start installation of new system it ask for SID then choose different SID...
    Thanks
    Sunny

  • When I switch back to an ongoing application, from the switcher, it reverts to its own 'homepage' rather than the stay at the state/stage I left it at. How can I force applications to maintain the current state?

    iPhone 4S with the latest updates 8.1.3 (12B466) installed.
    When I switch back to an ongoing application, from the switcher, it reverts to its own 'homepage' rather than the stay at the state/stage I left it at.
    How can I force applications to maintain the current state?
    I am in the process of getting enough screenshots to demonstrate further.

    ios7 keeps refreshing apps after switching
    solcwd

  • I enabled my older 2014 version of Bridge. How do I undo that and enable the current Bridge?

    I was asked if I wanted to enable my 2014 version of Bridge and said yes which I now realize was a mistake. How do I get it back to the current 2015 version of Bridge?

    There is only one version of Bridge, and that is CC.  It has not been updated except for Adobe Camera Raw 9.0  Do you mean Lightroom?
    If so you should know Lightroom CC is a separate install. LR 5.71 is still installed.

  • How do I lock a field so the current type in it cannot be overriden?

    how do I lock a field so the current type in it cannot be overriden?

    You can make the field Read Only. You need to be aware that if the form is cleared the typed value in the field will clear and the text in the "Options" "Default Value" will become the field's value. You can use JavaScript to make a form field Read Only and set the default value.

  • Creating a field or workflow that responds to the Current System Date.

    In our activities/tasks we have a field that is the Expected Completion Date or Required Completion Date. Based on that date, and the current date, I want a workflow to trigger when the required completion date is less than 30 days away, sending daily reminders to the owner/manager that they have a activity/task due.
    The way I see it I have two options.
    1. Customize a field to be the system date. Create a workflow that says every time that field changes, and the date is within 30 days of required completion date, send out an email.
    2. Create a workflow that somehow incorporates the current/system date, and do the same thing as above, substituting the field with the actual date.
    I don't know how to make either of those options happen. Does anyone either have other options or advice on how to make this work?
    Thank you in advance!

    Hello Cyril,
    Here is an idea that could be done:
    You could create a dynamic step by having a step that holds all the properties for both configurations (the superset of the necessary variables) and an extra one that indicates which 'mode' the step is in.  Then you create the main Edit substep in whichever language you desire.  That substep window will then have a box/dropdown/etc. at the top you can use to choose between modes A & B.  When the user changes the value, you would dynamically change the rest of the window to contain the appropriate properties for mode A or B.  You then copy the property values in that window to the Step properties, and copy the mode to your variable and you can run the step in that mode.  When the step then runs, it checks the mode variable, and depending on its value, it will run the step in mode A or B.
    Now we could add a dialog that allows us to choose when we put a step down but we should still allow the user to change later via the Edit substep we create.
    I don't think we can create something that inserts a completely different step, but we can have one step that has the ability to do both and we can pick which one we execute.  Also note we still don't have the ability to edit the Panels for a step, so we have to use a new window that we call from our Edit substep to complete the step.
    Hope this helps.
    Regards,
    Olivier L. | Certified LabVIEW Developer

  • BSP: Use of dynpro services is not possible in the current system status

    Hello,
    in the component SRQM_INCIDENT_H i created a own button and eventhandler on the overview view.
    Here in this eventhandler i´m calling an own method from an own class. This method is doing a RFC in our ERP system.
    If i test the method this works fine.
    If i call this method in my eventhandler i get BSP error:
    Calling the BSP page was terminated due to an error.
    SAP Note
    The following error text was processed in the system:
    Use of dynpro services is not possible in the current system status
    Exception Class CX_SY_MESSAGE_IN_PLUGIN_MODE
    Error Name
    Program ZCL_CRM_CS_DATA_SERVICES======CP
    Include ZCL_CRM_CS_DATA_SERVICES======CM001
    ABAP Class ZCL_CRM_CS_DATA_SERVICES
    Method CREATE_CS_ORDER
    Line 54
    Long text -
    Error type: Exception
    Any ideas?
    thank you
    Best regards

    Hi,
           Web-UI cannot handle MESSAGE statements. if it's your own program, you should use the web-ui( view_manager->get_message_container or cl_crm_bol_core's global message container) alternatives to display the messages. If the message statement is being issued by a standard program, it's most usually deliberate attempt to fail on unrecoverable error. You can catch it by usin the try...catch CX_SY_MESSAGE_IN_PLUGIN_MODE ..where you call the standard functions.
    Regards,
    Arun Prakash

  • CRM70 Use of dynpro services is not possible in the current system status

    Hi all,
    i programmed in Webclient UI an own button which calls a Method of a zclass. Within this method i do a remote function call in ERP.
    I can test the method successfully but if i call it from CRM Webclient UI i have a BSP error:
    Business Server Page (BSP) error
    What happened?
    Calling the BSP page was terminated due to an error.
    SAP Note
    The following error text was processed in the system:
    Use of dynpro services is not possible in the current system status
    Exception Class CX_SY_MESSAGE_IN_PLUGIN_MODE
    Could one of you experts please give me a hind?
    Thank you
    Kind regards
    Manfred

    Solved,
    there was a SAP GUI "MESSAGE" in the ERP function call which is not possible for CRM Webclient UI.
    Kind regards
    Manfred

  • Use of dynpro services is not possible in the current system status

    Hi,
    I am new to all of this and new to SAP. I will bew self learing my way into CRM SOA,  working with the web service creaiton i keep getting the following errlr when rtying to Activate a new created web service:
    "Use of dynpro services is not possible in the current system status"
    not knowing the system that well i wonderin if there is missing configuration. This is CRM 7.0
    Exception Class CX_SY_SEND_DYNPRO_NO_RECEIVER
    Error Name DYNPRO_SEND_IN_BACKGROUND
    Program SAPLSKEY
    Include LSKEYU03
    Line 33

    Hi Keith,
    Welcome to the SCN forums!
    SAPLSKEY
    You should first check your Abap dumps using tranaction code ST22, this usually provides more detail on the problem.
    In this case I think it's trying to return a screen (or pop-up message) that can't be handled while activating the web service. The "SAPLSKEY" tells me that it might be licence related, do you have a valid developer's licence for Abap development work? If not apply for one (find out the procedure from other Abap developer's that you may work with) & check if that makes a difference while activating.
    Regards, Trevor

  • I need to get the Current System Date and time in the format

    I need to get the Current System Date and time in the format
    *6/24/2009 11:30:29 AM*
    How do i do it ?

    I seem to be saying this a lot lately.
    Google is your friend.
    I googled "java current date format" and SimpleDateFormat featured prominently in the results.

  • No maintenance cycle is open for the current system

    Hello!
    I have problems to use CharM functionality due to following error:
    <b>No maintenance cycle is open for the current system</b>
    The error arises when I try to set a urgent correction in status "In Development" I get the following error, menwhile I have an valid maintenance cycle active.
    I use CharM functionality for the solution consisting of an single system with two clients:
    SRM:000 (as DEV-system) (system role: source system)
    SRM:100 (as PRD-system) (system role: target system)
    - No maintenance cycle is open for the current system (meanwhile I have a valid maintenance cycle created and activated).
    Futhermore I get the additional warning:
    IBase component is not a productive system in system lanscape
    Can some help me with this issue?
    Thank you very much!
    regards
    Thom

    Hello Kriti,
    thank you very much for your response.
    Unfortunately I also thought about it.
    Basically my CharM procedure looks as follows.
    I send the message from productive client (I have only one system with client 000 and 100)  to Service Desk in SOLMAN.
    There I can see the IBase of the productive client.
    Then I create a urgent correction by assigning IBase to this IBase of productive client. It is also possible to change the IBase in change mode, so I have tried all the possible values of IBase and get the same error.
    My problem also is that I have multiple values of IBase assigmenets, it means one system has multiple assigments to IBase components.
    I do not know how to delete/cut these settings....
    Thank you for your further help!
    regards
    Thom

Maybe you are looking for

  • JMS sender with MessageTransformBean and xml.additionalLastFields

    Hi all, I have a JMS sender adapter (generic JMS) which I use for this scenario MQ (JMS) --> PI (7.4 AEX) --> ERP (IDoc) I am following this page for setting up content conversion for the adapter: Adapter Engine (Java SE) - SAP Library If i specify t

  • Apple 20" Model A1038 Screen Shake

    I recently purchased the DVI to ADC adapter to connect my Cinema Display monitor to my PC that uses Radeon HD 4850 video card. The monitor displays fine, but ever now and then the picture shakes vertically. I do not know what is causing this shaking

  • UDO - DLL (1)

    Hi, I am using the User Defined Object (UDO) Wizard in B1. I am doing the UDO sample in SDK Help (Step 2 - Create a DLL for SM_MOR Object). 1) How do I build a C++ DLL (White Paper)? 2) And does it have to be a C++ DLL? 3) What about a C# DLL? Thank

  • Support RTP payload type 8 and 13

    I am trying to use JMF to play back recorded RTP streams containing RTP payload type 8 (ALaw) and 13 (CN). It seems these are not supported by default. Did anybody add support to JMF to support these payload types succesfully? Help is greatly appreci

  • How do I turn off/on the internal antenna in order to connect an external antenna

    MacBook Pro, 10.9.1, Mavericks, retina display --- 2 questions How do I turn off/on the internal antenna in order to connectand use an external antenna.  Second question, I mistakenly installed the wrong driver for the external antenna, How do I unin