Wednesday, March 30, 2011

Key Learnings Abdul Azeem Khan

Problem:  
Incorrect Syntax Near “.” during DataAdapter.Fill

Impact:
Your program hangs and you are not able to access the data from the database


Solution:
If you have a SQL statement such as this:
            string statement = "Select title, addDateTime, keyword_id, keyword, lang_id" +
"FROM tableX"; 


the problem is caused due to the lack of space after "lang_id", to solve the problem just put in an extra space, so it would be "lang_id ".
 

Tuesday, March 29, 2011

Key Learnings Abdul Azeem Khan

Problem: 
 java.lang.IllegalAccessException: Class com.sun.xml.ws.fault.SOAPFaultBuilder can not access a member of class Services.CustomException with modifiers "public"

Impact :
When working with custom Exceptions in Web Services, and when you throw them as faults, your Web Service will stall and be no longer funcational.

Solution:

1) Always make a separate package to store your custom exception.
2) Derive your custom exception from Exception class
3) You have to include getFaultInfo() within your custom exception class and this is the key
4) In your @WebMethod include the throws clause and specify the name of your custom exception.

If you follow the steps listed above, there should be no error mentioned above. 

Monday, March 28, 2011

KeyLearnings for Abdul Azeem Khan

Prolem:  

getting an "IllegalStateException" when using the RequestDispatcher? 
1)java.lang.IllegalStateException: Header already sent 
2)java.lang.IllegalStateException: Cannot forward as Output Stream or Writer has already been obtained

Impact

Slows down your servlet communication, and at times can make your application behave intermittently.


Solution:


Make sure you only have one RequestDispatcher.forward("url") coded in your servlet and make sure it is always placed at the very end.


Also there is an interesting tip adapted from:


http://www.jguru.com/faq/view.jsp?EID=501393


Which states that:


If you want your response-writers to be modular (one object to build the nav bar, one object to build the banner ad, one object to build the body, one object to build the page footer, etc.), you have two choices:
  1. use JavaBeans or Java method calls to build up the HTML in the response, or
  2. use RequestDispatcher.include() to bring in content from many little servlets from inside a master response-builder servlet.


Tuesday, March 22, 2011

Key Learning Abdul Azeem Khan

Problem :
Target "compile-test-single" does not exist in the project "FileUploadExample". It is used from target "profile-test-single".

Impact:
In Netbeans you can no longer run any Enterpise, Web or Client application. A pretty serious issue

Solution:

The problem occurs when you accidentally hit a profiler button. To resolve the issue

Click on Profile > Attach Profiler > And Select External Application

Make sure to select External Application and no Internal Application

Monday, March 21, 2011

KeyLearnings for Abdul Azeem Khan

Problem:
Do you get any of the following WCF related communication exceptions
  •  CommunicationException"
  • "CommunicationObjectAbortedException"  
  • "IOException" and "SocketException"
     
Impact:
This can halt communication between client and server using one-way, request/response or two-way communication modes.


Solution:
You need to configure the "Namespace Reservation" setting on your computer using netsh tool developed by microsoft.

For Windows Xp use the following code:
step1: httpcfg set urlacl /u {http://URL:Port/ | https://URL:Port/} /aACL
step2: httpcfg.exe set urlacl /u http://myhost:8000/ /a "O:AOG:DAD (A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)"


For Windows Vista and Windows 7 use the following code:
netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user