http://community.borland.com/article/0,1410,23147,00.html

解决方案 »

  1.   

    ...为什么我找不到呢?
    我也在community.borland.com 找过
    对skyyoung 五体投地
    一鞠躬,二鞠躬,三鞠躬
    俺的偶像!
      

  2.   

    The address provided by skyyoung is ok. The content is pasted.
     
    JBuilder 3.5 / 4 Enterprise: Remote Debugging: WebLogic - by Borland Developer Support StaffAbstract:How to debug Java code running in WebLogic server using JBuilder 3.5 / 4.Question:How can I debug my java code running in WebLogic Server? 
     
     
    Answer: 
    It is possible to debug any Java program with JBuilder provided that you have access to the entry point and you understand how to configure the environment for that program (including environment variables and application parameters). Since WebLogic is really just a Java program, it is possible to configure JBuilder to debug it. It is also possible to debug any Java program with JBuilder 3.5/4 Enterprise through the Remote Debugging feature, which relies on Sun's Java Platform Debugger Architecture (JPDA). Sun's JPDA allows you to launch any Java process in "debug mode" which, in turn, allows any JPDA complaint debugger to attach to and debug that process. This FAQ will list steps to use both of the above techniques. The basic procedure is as follows: start up your WebLogic Server in debug mode, with the ejb jars that you want to debug deployed at startup; open a project in JBuilder that has the code for your EJBs, put breakpoints in the code, and then run/attach to the server through JBuilder; run a client application in JBuilder that accesses the EJBs -- you should stop at the breakpoints you set earlier. Note: In these instructions you will see parameters like <wlhome>. These parameters refer to various WebLogic settings, "wlhome" being the WebLogic home directory. You will need to fill in the values for these parameters as appropriate.
    --------------------------------------------------------------------------------Step by step instructions--------------------------------------------------------------------------------Launching, and debugging WebLogic Server from within JBuilder These steps assume that if you have any EJB classes to deploy, they are specified in your "WebLogic.properties" file. Otherwise you can add the -Dweblogic.deploy=<your jar to deploy> parameter to the VM parameters used for running WebLogic. Put breakpoints in the source for any classes, which will be loaded by WebLogic, that you want to debug (like EJB classes, for example).
    Define a library with <wlhome>/classes, <wlhome>/classes/boot, and <wlhome>/lib/weblogicaux.jar (though the last entry might not be necessary). Add this library to your project. 
    NOTE: If you are using JBuilder 4, running Tools | Enterprise Setup and setting up the WebLogic 5.1 Application Server tab will create this library for you. JBuilder 4 also introduces the notion of associating an application server with your project. The application server can be selected from the Project Properties | Enterprise tab. We currently support Inprise Application Server 4.1.1 and WebLogic 5.1.Create a Run Configuration (Run | Configurations menu) to run the WebLogic main class: 
    for the main class specify weblogic.Server. 
    for VM parameters specify:
    -classic
    -Dweblogic.system.home=<your wlhome>
    -Dweblogic.class.path=<wlhome>/classes;<wlhome>/license; <wlhome>/lib/weblogicaux.jar;<wlhome>/myserver/serverclasses
    -Djava.security.manager
    -Djava.security.policy=<wlhome>/weblogic.policy 
    The -classic parameter turns off the HotSpot client VM, which can cause various problems when debugging. You might not actually have HotSpot installed, but this parameter will ensure that the classic VM is used. NOTE: If you are using JBuilder 4, select the EJB tab on the Run tab when setting your configuration -- this will use the main class and options for the application server you selected for your project. Note: WebLogic 5.1 will throw an exception if it detects <weblogic home>/classes in your java classpath when the server is run. Running the server from the EJB Run tab will remove that entry from your classpath when the commandline to run the WebLogic 5.1 server is generated.Create another Run Configuration for your client program, specifying its main class.
    Start the server configuration by selecting it from the "Debug" dropdown menu in the JBuilder toolbar. This is the small down arrow next to the debug button. JBuilder is now debugging the WebLogic server.
    Run or debug the client configuration you created as above. 
    If all went well, you should stop at your EJB breakpoints when they are accessed by the client code. Attaching to, and debugging WebLogic Server with JBuilder For attaching to a running WebLogic server the procedure is similiar except, instead of creating a server configuration to run WebLogic, you need to modify the Debug page of your Project Properties to use the "Attach" feature of Remote Debugging (the Debug page was not part of the Runtime Configuration mechanism in JBuilder3.5, but it is in JBuilder4). In addition, you will need to start your WebLogic server in debug mode before attaching to it with JBuilder. Modify your WebLogic start script ("startWebLogic.cmd" if you are using Windows) to use debug parameters when it launches the Weblogic server. Add the following parameters to the command line that launches the WebLogic server: 
    -Xdebug 
    -Xnoagent 
    -Djava.compiler=NONE 
    -Xrunjdwp:transport=dt_socket,address=<port number>,suspend=y,server=y Set breakpoints as necessary in your code that will be loaded by the WebLogic server.
    Modify your Project Properties | Debug page: 
    Click the "Remote Debugging" checkbox to turn it on. 
    Select the "Attach" tab. 
    For "Host Name", use "localhost" if you are attaching to your local machine, otherwise use the machine name where your WebLogic server will be running. 
    For "Address" use the <port number> you specified on the command line for the server as part of the debug parameters. 
    For "Transport" use "dt_socket" (which you also specified on the command line for the server). Debug the project. Press the debug button on the JBuilder toolbar, or select "Debug" from the Run menu.
    Press the resume button on the Debugger toolbar to resume the now stopped WebLogic server (since you used "suspend=y" as part of the debug parameters the server process is suspended until you do this).
    Create a client Runtime configuration that uses the client program's main class.
    Run or debug your client using the configuration created above. 
    If all went well, you should stop at your EJB breakpoints when they are accessed by the client code.