Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Friday, November 21, 2014

Increase Weblogic memory in Integrated Weblogic server of Jdeveloper

Go to JDEV_HOME\system12.1.2.0.40.66.68\DefaultDomain\bin and open setDomainEnv.cmd  or setDomainEnv.sh based on whether it is a windows or linux machine.

Scroll down until you see WLS_MEM_ARGS, below that enter

In the case of Windows:
set USER_MEM_ARGS = -Xms64m  -Xmx2048m  -XX:MaxPermSize=1024m

In the case of Linux:
USER_MEM_ARGS="-Xms64m  -Xmx2048m  -XX:MaxPermSize=1024m"
export USER_MEM_ARGS

Sunday, November 16, 2014

Calling a web service using wsimport from a proxy internet connection

When you try to access a basic web service using the wsimport command from your system to a valid web service over a proxy network there is a chance that you might be getting the below error

[ERROR] Connection timed out: connect

Failed to read the WSDL document: http://www.webservicex.net/geoipservice.asmx?W
SDL, because 1) could not find the document; /2) the document could not be read;
 3) the root element of the document is not <wsdl:definitions>.


[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s):

 At least one WSDL with at least one service definition needs to be provided.


        Failed to parse the WSDL.


To resolve this issue you should specify the proxy server host and port also along with the wsimport command.

>wsimport -httpproxy:<Proxy Host>:<Proxy Port> http://www.webservicex.net/geoipservice.asmx?WSDL

Then the wsimport will work fine.

Thanks.

Wednesday, February 19, 2014

How to find the Class/Object which invoke a method ?


Throwable t = new Throwable(); 
StackTraceElement[] elements = t.getStackTrace(); 
String calleeMethod = elements[0].getMethodName(); 
String callerMethodName = elements[1].getMethodName(); 
String callerClassName = elements[1].getClassName(); 

Saturday, February 15, 2014

How to Set send from in mail session



Use the setFrom() method:
Session mailSession = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(mailSession);
message.setFrom(new InternetAddress("sendingaddress@company.com"));

How to over ride Netbeans wizard toolbar save button function?


Read here :

https://blogs.oracle.com/geertjan/entry/bye_savecookie_hello_org_netbeans

How to get the selected row of a tree table?


//TreeViewer viewer use your viewer
IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();

How to auto adjust window size based on Image size in Java Swing


1. Put image as Icon / ImageIcon to the JLabel then
  • Test for MaximumSize for JFrame that returned Toolkit for concrete monitor
  • If PreferedSize is lower than MaximumSize size then call JFrame#pack()
  • otherwise have to call setSize()

2.Put image as Icon / ImageIcon by using Custom Painting to theJComponentJPanelJLabel e.i. then
  • then this JComponent must to returns PreferredSize
    a) call JFrame#pack() if PreferedSize is lower than MaximumSize,
    b) otherwise have to call JFrame#setSize()
    c) by assume that you don't use Image#getScalledInstance

3.Use Icon in the JLabel, there is only one issue that image can be smaller then expected size on the screen, but no issue with that, is pretty possible to centering image to the JLabel.CENTERto the JLabel

Tuesday, February 11, 2014

How to put Conditional Breakpoints in Netbeans.

Conditional Breakpoints in NetBeans

As of NetBeans 6.x, most types of breakpoints (line, method, field, exception) can be conditioned by a user defined expression.
The expression is evaluated in the place of breakpoint hit and must be of boolean type.

Examples of conditions:
  • x > 1 && y < 10
  • text.equals(name)

In order to modify these conditions, open the "Breakpoint Properties" dialog using one of these methods:
  • Right-click the breakpoint and click Breakpoint > Properties
  • Open the Breakpoints window, right-click on the breakpoint and select Properties