Not the answer you're looking for?Browse other questions tagged java netbeans platform heap-memory or ask your own question. Now I'm running the job again now within NetBeans where I have amended the Java VM settings. But can anyone tell me which configuration file in Tomcat I would have to change to allow the Windows service to run with the new settings?
Not the answer you're looking for?Browse other questions tagged java tomcat memory-management or ask your own question. Software development: Is it appropriate to tell my boss and coworkers that it is difficult for me to discuss specs verbally? This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. The Identity Manager Integrated Development Environment (Identity Manager IDE) is Java application that enables you to view, customize, and debug Sun Java™ System Identity Manager (Identity Manager) objects in your deployment. Checkout View feature allows you to check out, modify, and check in Identity Manager views (such as a user view). The Identity Manager IDE is a fully integrated NetBeans plugin that was designed to replace Identity Manager’s Business Process Editor (BPE) application. This section provides instructions for installing and configuring the Identity Manager IDE application. If you experience out-of-memory errors as you work with Identity Manager IDE, you might have to increase the NetBeans memory settings. When the Update Center Wizard displays (Figure 1-1), select Install Manually Downloaded Modules, and then click Next. In the next Select Location of Modules panel, click Add to locate and select the Identity Manager IDE NetBeans plugin file (com-sun-idm-ide.nbm) that is available in the Identity Manager distribution in the top-level directory. When the Select Modules to Install panel displays (Figure 1-2), click Next again to download the module. The Download Modules panel displays to show you the status of the module(s) being downloaded. The View Certificates and Install Modules panel displays (Figure 1-3), containing a list of the module(s) you downloaded. Not all of these windows display when you first open the Identity Manager IDE, but will open automatically (or can be opened) as you use different features in the application.
The Projects window displays by default when you open the Identity Manager IDE, and it provides a vertical, logical view of all open projects.
When you right-click on a project node, or on any of the object nodes, in this window, a pop-up menu displays with options that enable you to perform different tasks. Select to download objects from the repository to your local file system, upload objects from your local file system to the repository, and to checkout a view. Select to modify the object’s code structure and update the rest of your code to reflect the modifications. Select to create JUnit tests, add to Favorites, manage Internationalization, or to apply a Diff patch. Select the Files window for a directory-based view of your projects, including files and folders that do not display in the Projects Window. You can open and edit your project configuration files, such as the project build script and properties files. Select the Runtime window for read-only access to the Identity Manager catalog (waveset.dtd) under the DTD and XML schema catalogs.
The Editor window provides a toolbar and a display area that enable you to work with objects in Design view or Source Editor view. Click the Design button to work with a graphical representation of Workflow Process and Workflow Subprocess objects. Dragging items into Design view, updates the XML source and the node tree in both the Projects and Files views. The Design View window provides a graphical diagram of a workflow, where each node represents a specific process activity and the lines represent transitions.
In addition to these buttons, you can use the Workflow Selector menu (also provided on this toolbar) to select and work on a workflow or workflow subprocess in Design view.
When you edit a workflow in Design View, the Palette window displays items loaded from the workflow library.
The Source Editor is a full-featured text editor that is integrated with the Explorer Projects window and the Debugger. This view opens automatically when you create a new, editable object from the available Identity Manager IDE templates, or you can open the Source Editor by double-clicking an editable object in Projects window. When you select objects for editing, the Palette window displays (typically in the upper right side of the Identity Manager IDE) with items from the workflow library and XPRESS categories.
Table 1-3 describes the toolbar buttons (from left to right) provided for the Source Editor view. Back (Alt+K) and Forward (Alt+L): Click these buttons to move back to the last edit, or forward to the next edit, you made in the Source Editor window. Find Previous Occurrence (Shift+F3): Click this button to locate and move the insertion point to text that you previously searched for.
Find Selection (Ctrl+F3): Click this button to locate the item where your cursor is currently inserted.
Find Next Occurrence (F3): Click this button to locate and move the insertion point to the next occurrence of text that you are searching for. Toggle Highlight Search (Alt+Shift+H): Click this button to turn highlighting search text on and off.
Toggle Bookmark (Ctrl+F2): Highlight a line and then click this button to insert a bookmark on, or remove a bookmark from, the current line. Next Bookmark (F2) and Previous Bookmark (Shift+F2): Click these buttons to locate the next bookmark or previous bookmark in the XML source.
Next Matching Word (Ctrl+L) and Previous Matching Word (Ctrl+K): Select a word in the XML source, and then click these buttons to locate the next or previous occurrence of that word.
Shift Line Left (Ctrl+D) and Shift Line Right (Ctrl+T): Click these buttons to reduce or increase the indentation of a selected line by one tab stop.
Start Macro Recording (Ctrl+J S) and Stop Macro Recording (Ctrl+J E): Click these buttons to start or stop recording a macro containing keystrokes and cursor movements. You can use the Palette window to drag new workflow services, approvals, users, and workflow tasks into a workflow displayed in Source Editor or Design view windows. When you select objects for editing, the Palette window displays (typically in the upper right side of the Identity Manager IDE), and provides access to different items — depending on the editing view in which you are working.
If you are working in Design view, you will only see items loaded from the workflow library. If you are working in Source Editor view, you will see items from the workflow library and XPRESS categories.
In either view, you can drag items from the Palette window into the design or into the XML source.
Use the Identity Manager IDE Properties window to view a properties sheet for the XML element associated with an object node selected in the Explorer. The Properties window also provides access to a Property Editor where you can edit an object’s XPRESS statements. For additional information about the Properties and Property Editor windows, see Editing Object Properties. The Output window displays messages from the Identity Manager IDE when it finds errors during debugging. The Output window opens automatically when you run the Debugger, or you can open this window by selecting Window > Output from the main menu bar. The Debugger provided for the Identity Manager IDE is similar to the Java debugger and to the Debugger provided with the BPE — you can set line, global, view, or form cycle breakpoints in the code, start the Debugger, and have the code stop in the XML.
The Identity Manager IDE Debugger also enables you to add a watch to show the value of a particular variable.
Breakpoints window lists all of the breakpoints you have set for the current project, including a short description of the breakpoint and a boolean flag that indicates whether the breakpoint is currently enabled or disabled.
The Identity Manager IDE automatically launches the Call Stack window when you run the Debugger. When the Debugger reaches a breakpoint, the execution stack (a series of calls that the thread performed to get to the breakpoint) displays in the Call Stack window.
The Local Variables window lists all variables that are in scope at the current point of execution when the Debugger stops at a breakpoint. The Local Variables window remains blank when debugging is inactive or when execution is not stopped at a breakpoint. If the current element is an XPRESS end tag, the result of the last evaluation displays in the Local Variables window when you stop the Debugger. The Local Variables window does not display variables while XPRESS execution is in progress. The Debugger allows you to use watches, which enable you to track changes made to variable or expression values when you run the Debugger. When you specify a watch, the Watches window lists all of the variables, expressions, types, and values that are being watched when you debug the project.
Window shortcuts help you navigate, activate, and select operations in the Identity Manager IDE windows. For a detailed description of available keyboard shortcuts and instructions for using them, refer to the online help. To assign shortcuts, select Tools > Options, and when the Options dialog displays, select Keymap. To use Identity Manager IDE effectively, you must also understand some basic concepts about the Identity Manager IDE project.
A project is a location where Identity Manager IDE stores information about repository connections (such as the default server and password), options, Debugger breakpoints, open sources, and automatically saved files. Sun Identity Manager: Select this project type to download source files from Identity Manager. Sun Identity Manager with Existing XML Objects: Select this project type if you have existing XML files containing Identity Manager objects on your local file system (similar in concept to creating a new Java project from existing sources).


For example, if you have an existing deployment with Identity Manager objects stored in CVS, you can specify the Sun Identity Manager with Existing XML Objects project type to retrieve those objects from CVS and create a project with those files. Consequently, if you use XML files that contain multiple objects (including many of the XML files in the Identity Manager samples directory), the object nodes will not display in the Projects window, nor will you be able to use any of the custom editor components offered by Identity Manager IDE, such as the Palette or Properties editors. When the New Project wizard displays (Figure 1-11), select Sun Identity Manager from the Categories list to indicate what type of project you are creating. Select the Sun Identity Manager project to create a new project using source files from Identity Manager. Select the Sun Identity Manager with Existing XML Objects project to edit XML files that already exist on your local file system. The Name and Location panel displays so you can specify a file system location in which to store this project. If you are creating a Sun Identity Manager with Existing XML Objects project, the Existing XML Objects Location panel displays as shown in Figure 1-13. Specify the directory path and folder where your XML objects are stored, and then click Next. When you set up a remote connection, Identity Manager IDE uses this connection to upload or download objects. Enable the Secure Connection box if you want Identity Manager IDE to use SSL when opening the connection. Enable the Remember Password box if you want Identity Manager IDE to remember and automatically enter your password for future sessions. After setting all of the connection parameters, click Test Connection to check the status of your connection to the project environment. If the Login dialog displays, provide your login information, and then click OK to test whether you can access the Identity Manager server specified in the project properties.
If the connection fails, an error message displays to provide information about the failure. You can also test connections in Identity Manager IDE when you edit an existing project’s properties. Click OK to close the pop-up, and note that your project is now available in the Identity Manager IDE Projects window (upper left corner). When the Open Project dialog displays (Figure 1-16), browse to the project folder you want to use and click Open Project Folder.
If you already have one or more projects open, the Open as Main Project check box (upper right corner) becomes active. In the Project window, right-click on the project name and select Properties from the pop-up menu. Identity Manager IDE enables you to work with repository objects on your local file system, rather than working directly in the repository (as with the BPE). Email Template: Templates used to send notification of various changes and actions to users and administrators. Form: An object associated with a Web page that contains rules about how a browser should display user view attributes on that page. Library: An object used to organize closely related objects, typically rules, into a single object in the repository. MetaView: In Identity Manager, a meta view is a unified view of all resources, providing a common data model in which to view a set of resources and how attributes on these resources flow from one to another. Rule: Objects in the Identity Manager repository that contain functions written in the XPRESS, XML Object, or JavaScript languages.
Workflow Process: A workflow is a logical, repeatable process during which documents, information, or tasks are passed from one participant to another. Workflow Subprocess: An object used to create a workflow subprocess to include in a workflow. One of the advantages to using the Identity Manager IDE, is that it enables you to download and modify objects outside of the repository. Right-click the Objects node (or any object type node in Projects window) and when the pop-up menu displays, select Repository > Download objects. The Download Objects From Repository dialog displays so you can browse the objects in the Repository.
You can download multiple objects from the repository by pressing the Ctrl key as you select the objects from the list. The selected object nodes, and children that represent individual elements in the object, will be displayed in the Explorer. Right-click the object node and when the pop-up menu displays, select Repository > Reload objects.
You can select multiple objects to upload by pressing the Ctrl key as you select the objects from the list. The Identity Manager IDE allows you to check out a particular view (such as a user view) from the repository for editing. To check out a view, right-click the Objects folder in Project window and select Repository > Checkout view from the popup menu. After editing, right-click on the view to check it back into the repository — just like any other XML object.
Select Sun Identity Manager Objects in the Categories list and choose one of the object types from the File Types list.
By default, Identity Manager IDE automatically specifies the current project directory and current project’s objects folder, but you can specify a different location. Consequently, if you use XML files containing multiple objects (including some files distributed with Identity Manager, such the wfresource.xml sample), the objects do not display as nodes in the Project window, they are not available in the Palette, nor does the context menu include any Identity Manager IDE actions. However, if you put these XML files into your project’s Objects directory, Identity Manager IDE handles the files as plain text so you can view the files in the Files tree, and you can open and edit the files directly.
To edit an object’s XML, double-click on the object node you want to edit in the Project or Files window. The object’s unfiltered XML displays in the Source Editor, so you can edit, check, and validate the XML as needed. When you select objects for editing, the Palette window displays with items from the workflow library and XPRESS categories. When you install the Identity Manager IDE, it registers the waveset.dtd definition file, which enables auto-completion for XML elements and attributes. To use the auto-completion feature, begin typing an XML element or attribute, and then press Ctrl+Spacebar. If you load a file into the Identity Manager IDE with malformed XML, or if you edit a file and the edits do not conform to the definition (DTD) file, an error icon displays on the object’s top-level parent in both the Project and File windows. XML added directly to the XML editor is not lost, but a node for the added object will not display until you fix the XML. You can immediately validate a object’s XML by right-clicking in the Source Editor and selecting Validate XML from the context menu.
The Identity Manager IDE provides a graphical Debugger that you can use to debug Identity Manager forms, rules, and workflows. This section describes how to use the Identity Manager IDE Debugger, and if you have previously used a code debugger for a procedural programming language, you should be familiar with the terms used here. The Identity Manager IDE Debugger is enabled by default, but you should always disable it when you are finished debugging to prevent someone from accidently connecting it to an application server in your production environment. Setting a breakpoint is a global setting; consequently, the Identity Manager IDE suspends incoming request threads when it reaches that breakpoint.
The user specified in the project’s properties must have the Identity Manager Administrator capability. However, be aware that the Debugger can suspend threads that lock other users out of the system and display variables containing sensitive data from other users’ sessions. You must assign a private copy of the application server to users running the Debugger. If multiple users are developing on the same application server and one user connects a Debugger to the server, the other users will hit breakpoints and be locked out.
For more information about working with workflows, forms, and views refer to the Sun Java™ System Identity Manager Workflows, Forms, and Views publication.
To start the Identity Manager IDE Debugger, select Run > Debug Main Project from the main menu bar.
When you start a debugging session, the Identity Manager IDE automatically opens a set of Debugger windows that display runtime information about your program. You use breakpoint commands in the Debugger to halt the execution of an object before executing a specific line of code.
When you are using the Debugger, breakpoints apply regardless of where you launched the form or workflow. You can view a summary of all source breakpoints in the Breakpoints window (typically located in the lower-left corner of the Identity Manager IDE).
When it stops at a breakpoint, the Debugger also displays variables (that are in scope) at the current execution point.
The easiest way to set a breakpoint is to click in the left margin of the Source Editor, immediately adjacent to the tag where you want to add a breakpoint. Breakpoint Type menu: Identity Manager is the only option that is available from this menu, and it is selected by default. When a Glassfish domain is created it already comes with a default set of JVM options (including memory related options), as you keep working on your project your application will increasingly grow and consume more memory, until it reaches the point where the default Glassfish memory configuration isn’t appropriate to run your app anymore. Observe that the Information dialog box indicating that the Calibration was successful.
Observe that the memoryleak project node appears under Projects tab window. Observe that two arrays, one with a single float and another with a single double, are being allocated in a loop and saved in a HashMap. Observe that the Live Profiling Results window gets displayed on the right side of the IDE. The Allocated Objects (third column from the right) is the number of objects that the profiler is monitoring.
The Live Objects is the number of the Allocated Objects that are still on the JVM's heap and are therefore taking up memory.


The two Live Bytes columns show the amount of heap memory being used by the Live Objects.
Right click double[] and select Take Snapshot and Show Allocation Stack Traces. In this exercise you learned how to use the profiler to monitor the creation of objects by a Web application. One additional note on the sample application - it does not require a web server in order to run. The process of finding out the offending code fragment is similar to what you've done in Exercise 1. Before you start this exercise, it is important for you to read the above and have a good understanding of the context. Observe that the HttpUnit project node appears under Projects tab window. The blue line is the percentage of execution time spent by the JVM doing garbage collection and is graphed against the y-axis on the right edge of the graph.
The red line is surviving generations and is graphed against the y-axis scale on the left edge of the graph. Observe that the two of the classes have huge values for Generation, in comparison to all the other classes: String and char [] array. Observe the code fragment that calls HttpUnit's getResponse() method on line 46 in Figure-2.30 below, which ends up making the call that results in the memory leak. Observe the code that actually has the memory leak: it adds Strings to an ArrayList and they never get removed. Observe that there are 1896 int[] arrays on the heap (in the example picture below), whose total size amounts to 4414336 bytes. We have found something on the heap that should not be there - in this case, this appears to be an array that was used during the calculation that should have been garbage collected after the calculation. Right click this in the References panel and click Show nearest GC Root. One last thing to note - the profiler's heapwalker can also be used on any binary heap dump file produced by one of Sun's JVMs. In this exercise,  you have learned how to use the HeapWalker of the NetBeans profiler to analyze a memory usage problem, specifically to find a reference to an object that prevents it from being garbage collected. I'm running these programs within NetBeans at the moment but want them to run on their own. You can search all projects in the Project window, or select and search a specific location. The validation information displays in the Output window, and typically contains hyperlinks that take you to a line in the Source Editor View so you can view or fix the XML. You can drag these items from the Palette and drop them into Design View to create an activity node in the diagram (which also updates the XML source and the node tree in the Project and Files views).
You can drag items from the Palette and drop them into a line in the Source Editor to create XML text at that point in the XML source. The Output window identifies errors in your XML source, and typically provides a hyperlink to the line in the Source Editor so you can correct the problem. Validation information displays in the Output window, and typically contains hyperlinks to the line in the Source Editor View so you can view or fix the XML. A properties sheet consists of the name and property values (such as file sizes, modification times, or result information) for a selected node. You can use this editor dialog to change the object’s value, type, style (to simple or calculated), add or delete expressions, or move the expression up or down. These messages usually include hyperlinks to the lines in your source code that caused the errors.
Another nice feature is that the Debugger is integrated with the Rule Tester and Form Previewer (discussed later in this chapter). You can enable or disable a breakpoint directly in the Breakpoints window by changing the Enabled property. This list is called a stack trace, and it displays the structure of the execution stack at this point in the program's life. Some of these shortcuts are common to all file types, while others are only available when editing certain file types.
You can associate more than one project with a repository, but only one repository per project. Enter a project name, a directory location, and a project folder name into the fields provided, and then click Next. If you edit any of these properties, click Test Connection to verify that you can still connect to your project environment.
You might use an email template, for example, to notify an approver of a pending request, or to notify a user that his password has been reset. Forms can incorporate business logic, and often are used to manipulate view data before it is presented to the user. Organizing objects into libraries makes it easier for workflow and form designers to identity useful objects. Within Identity Manager, rules store frequently used logic or static variables for reuse in forms, workflows, and roles.
Identity Manager workflows comprise multiple processes that control user accounts, such as account creation, update, enabling, disabling, and deletion. You can double-click child nodes to go to their XML elements and view them in the property sheet. Select the value from the list or double-click the property name to rotate through the available values.
NetBeans displays a list of the elements and attributes that can be used to automatically complete the element.
Click this link and Identity Manager IDE highlights the line just below the malformed XML in the Source Editor window so you can easily locate and correct the problem. You can use this Debugger to set breakpoints and watches, step through code, examine and modify variables, examine classes and the callstack, follow threads, and run multiple sessions. Given the powerful repercussions of misuse, exercise caution when assigning the right to run the Debugger. The Debugger suspends incoming request threads when it reaches a designated breakpoint — and this action happens regardless of which user is making the request. While most debuggers allow you to set breakpoints only on source locations; the Identity Manager IDE Debugger also permits you to set breakpoints at conceptual execution points, such as Refresh view. You can also click on a breakpoint in the Breakpoints window to navigate to that breakpoint in the Source Editor. In the example shown in Figure-1.24, there are 11,727 instances of char[] that are being monitored.
You saw the types of indications given by the profiler when an application has a memory leak. It essentially acts as a web browser so that you can write unit tests to verify that the correct pages are being sent back from your web application.
There is also this thread out on the HttpUnit mailing lists where he reported what he found.
The underlying issue has to do with the way that HttpUnit processes web pages that include JavaScript.
HttpUnit has a nice feature where if what you want to test is the response from a servlet then it can host the servlet for you, in the same JVM as your test application.
Time spent by the JVM doing garbage collection is time that is not available for it to run your application. In a typical Java application there can be dozens or even hundreds or thousands of places where Strings are allocated. You will see a straight-line back to the main() method since there is only one way it is being called. Change or replace the existing value and then click OK to save your changes and close the property editor dialog.
By default this number will be approximately ten percent of the objects actually allocated by your application. So if the blue line indicates a large percentage you may want to consider tuning the JVM by configuring a larger heap size (refer to the -Xmx parameter documentation) or perhaps switching to a different garbage collection algorithm.
When the value for surviving generations is low it indicates that most of the objects on the heap have been around about the same amount of time. For each class you can see information about the number of objects created, the number that are still in use (live), and a particularly interesting statistic called Generations. The age of an object is simply the number of the Java virtual machine's garbage collections it has survived.
There must be some accidental reference to it that is being made (and that should be cleared). So we don't need the array anymore, but it cannot be garbage collected - that is a memory leak. You can then step-into the Refresh view and watch the underlying form processing in progress. By monitoring only a subset of the created objects the profiler is able to dramatically reduce the overhead it places on the JVM, which then allows your application to run at close to full speed. As a result, float[] and double[] continue to move higher in the list. If, however, the value for surviving generations is increasing at a high rate over time then it indicates your application is allocating new objects while maintaining references to many of the older objects it already allocated. So if, for example, an object is created at the beginning of an application and the garbage collector has run 466 times then the age of that object at that point in time is 466.
To calculate the Generation value for a class, just count up the number of different ages across all of its objects that are currently on the heap.



How to send money online through moneygram
How to make fast money from home 3d