Showing posts with label Exception. Show all posts

Date in Credential scope does not match YYYYMMDD from ISO-8601 version of date from HTTP: '20160114T083022Z' != '20160114', from '20160114T083022Z'.

I got this response message while working around AWS Version 4 Signing ProcessThere ain't much to explain. Just add 

  • x-amz-date header with date format yyyyMMdd'T'HHmmss'Z'
  • And use yyyyMMdd date format in StringToSign and Credential parameter of Authorization header.

Related
Authorization header requires 'Credential' parameter.
Authorization header requires 'Signature' parameter.
Authorization header requires 'SignedHeaders' parameter.

Authorization header requires 'SignedHeaders' parameter.

I got this response message while working around AWS Version 4 Signing Process. There ain't much to explain. Just add SignedHeaders=SignedHeaders in your Authorization header.

SignedHeaders=SignedHeaders will look like...
SignedHeaders=content-type;host;x-amz-date

Complete Authorization Header
Authorization: algorithm Credential=access key ID/credential scope, SignedHeaders=SignedHeaders, Signature=signature

TO
Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/iam/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7

Related
Authorization header requires 'Credential' parameter.
Authorization header requires 'Signature' parameter.

Reference
http://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html


Authorization header requires 'Signature' parameter.

I got this response message while working around AWS Version 4 Signing Process. There ain't much to explain. Just add Signature=signature in your Authorization header.

Signature=signature will look like...
Signature=5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7

Complete Authorization Header
Authorization: algorithm Credential=access key ID/credential scope, SignedHeaders=SignedHeaders, Signature=signature

TO
Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/iam/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7

Related
Authorization header requires 'Credential' parameter.
Authorization header requires 'SignedHeaders' parameter.

Reference
http://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html


Authorization header requires 'Credential' parameter.

I got this response message while working around AWS Version 4 Signing Process. There ain't much to explain. Just add Credential=access key ID/credential scope in your Authorization header.

Credential=access key ID/credential scope will look like...
Credential=AKIDEXAMPLE/20150830/us-east-1/iam/aws4_request

Complete Authorization Header
Authorization: algorithm Credential=access key ID/credential scope, SignedHeaders=SignedHeaders, Signature=signature

TO
Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/iam/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7

Related
Authorization header requires 'Signature' parameter.
Authorization header requires 'SignedHeaders' parameter.

Reference
http://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html


net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean: .

net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean: .
 at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:872)
 at net.sf.jasperreports.components.table.fill.FillTableSubreport.prepareSubreport(FillTableSubreport.java:166)
 at net.sf.jasperreports.components.table.fill.FillTable.prepare(FillTable.java:417)
 at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:150)
 at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:330)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:382)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:357)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2031)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:755)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:262)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:122)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:551)
 at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:411)
 at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:122)
 at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:583)
 at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:929)
 at com.org.openxcell.channel.ftp.processor.InvoiceProcessor.createStandardPackage(InvoiceProcessor.java:643)
 at com.org.openxcell.channel.ftp.processor.InvoiceProcessor.main(InvoiceProcessor.java:676)
Caused by: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean: .
 at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:132)
 at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:97)
 at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:108)
 at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:1373)
 at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1274)
 at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1250)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1003)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:120)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:551)
 at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:736)
 at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:58)
 at org.apache.commons.javaflow.bytecode.StackRecorder.execute(StackRecorder.java:95)
 at org.apache.commons.javaflow.Continuation.continueWith(Continuation.java:170)
 at org.apache.commons.javaflow.Continuation.startWith(Continuation.java:129)
 at org.apache.commons.javaflow.Continuation.startWith(Continuation.java:102)
 at net.sf.jasperreports.engine.fill.JRContinuationSubreportRunner.start(JRContinuationSubreportRunner.java:52)
 at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:847)
 ... 17 more
Caused by: java.lang.NoSuchMethodException: Unknown property '' on class 'class com.org.openxcell.channel.ftp.processor.SalesOrderItemDataSource'
 at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1322)
 at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:770)
 at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)
 at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426)
 at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:112)
 ... 33 more

I got above exception because I've table with subDataset containing <field> tag along with <fieldDescription> tag in it.
<field name="firstname" class="java.lang.String">
 <fieldDescription><![CDATA[]]></fieldDescription>
</field>
Solution
Remove <fieldDescription> tag from <field> tag.
<field name="firstname" class="java.lang.String"/>

net.sf.jasperreports.engine.JRRuntimeException: java.lang.StackOverflowError

I got following exception when one of my table in Jasper report grows to next page.
log4j:WARN No appenders could be found for logger (net.sf.jasperreports.engine.fill.BaseReportFiller).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
net.sf.jasperreports.engine.JRRuntimeException: java.lang.StackOverflowError
 at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:872)
 at net.sf.jasperreports.components.table.fill.FillTableSubreport.prepareSubreport(FillTableSubreport.java:166)
 at net.sf.jasperreports.components.table.fill.FillTable.prepare(FillTable.java:417)
 at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:150)
 at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:330)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:382)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:357)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2031)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:755)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:262)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:122)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:551)
 at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:411)
 at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:122)
 at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:583)
 at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:929)
Caused by: java.lang.StackOverflowError
 at java.util.HashMap$EntryIterator.<init>(Unknown Source)
 at java.util.HashMap$EntrySet.iterator(Unknown Source)
 at java.util.AbstractMap.hashCode(Unknown Source)
 at java.util.Objects.hashCode(Unknown Source)
 at java.util.HashMap$Node.hashCode(Unknown Source)
 ...
net.sf.jasperreports.engine.JRException: The report filling thread was interrupted.
 at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:126)
 at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:583)
 at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:929)
 ...
Caused by: net.sf.jasperreports.engine.fill.JRFillInterruptedException: Report filling process interrupted.
 at net.sf.jasperreports.engine.fill.BaseReportFiller.checkInterrupted(BaseReportFiller.java:535)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:369)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:357)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBackground(JRVerticalFiller.java:1819)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:252)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:122)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:551)
 at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:411)
 at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:122)
 ... 4 more
net.sf.jasperreports.engine.JRRuntimeException: java.lang.StackOverflowError
 at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:872)
 at net.sf.jasperreports.components.table.fill.FillTableSubreport.prepareSubreport(FillTableSubreport.java:166)
 at net.sf.jasperreports.components.table.fill.FillTable.prepare(FillTable.java:417)
 at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:150)
 at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:330)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:382)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:357)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2031)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:755)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:262)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:122)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:551)
 at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:411)
 at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:122)
 at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:583)
 at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:929)
 ...
Caused by: java.lang.StackOverflowError
 at java.util.AbstractMap.hashCode(Unknown Source)
 at java.util.Objects.hashCode(Unknown Source)
 at java.util.HashMap$Node.hashCode(Unknown Source)
 ...

Jasper Exception StackOverflowError

Solution 1
Remove org.apache.log4j jar from your build path and I guess its nearly impossible for you to do so, as you used this log4j everywhere in your code. Solution 2 will save you.

Solution 2
Move your log4j.properties file in src folder. This will work.

Reference
http://community.jaspersoft.com/jasperreports-library/issues/5015#comment-709695

Top 10 Interview questions on Exception handling in Java



Can we write try without catch?
Yes we can write try without catch but we must write finally.
try{
   try code...
}finally{
   ...
}

Can we write just try without catch and finally?
try{
   try code...
}
No, We can't write just try. (Already stated this in answer 1)


What is finally block?
finally block used to close resources used in try.
=> finally block will be executed even if exception occurs try block.
=> finally block will be execute even you write return variable from try block.
=> finally block will not be executed when System.exit(exitcode) executed in try block.
try {
   /* finally will be executed */
   /* int a = 1 /0; */  
   /* return; */ 
 
   /* finally will not be executed */
   System.exit(0);
} catch (Exception e) {
   e.printStackTrace();
}finally{
   System.out.println("Finally executed.");
}

Can we write try within try?
try {
   try code...
   try {
      try code... 
   } catch (Exception e) {
      e.printStackTrace();
   }  
} catch (Exception e) {
   e.printStackTrace();
}
Yes we can write nested try-catch.


What is the difference between throw and throws?
-> throw is used for throwing an exception from program.
throw new NullPointerException();
-> throws is used in method definition. When method is causing an exception and it is not handled by method itself then exception is passed to caller method.
public void readFile(String filepath) throws IOException{
   ...
}

Which is super class of all exception?
Throwable is super class of all exception including Class `Exception`.
public class IOException extends Exception

public class Exception extends Throwable

What is difference between checked and unchecked exception?
This is explained with example. Read more on http://www.javaquery.com/2015/05/difference-between-checked-vs-unchecked.html


Does the sequence of catch matter? or Following code will compile?
try {
   try code...
} catch (Exception e) {
   e.printStackTrace();
} catch (NullPointerException ne){
   ne.printStackTrace();
}
Yes, Sub class must be caught first. NullPointerException is sub class of Exception. Above program will give compile time error Unreachable catch block for NullPointerException. It is already handled by the catch block for Exception.


What is try-with-resources?(Java 7 or above)
This is explained with example. Read more on http://www.javaquery.com/2015/04/what-is-try-with-resources-in-java-7-or.html


Can we catch multiple exception in one catch?(Java 7 or above)
Yes we can.
catch (IOException|SQLException ex) {
   throw ex;
}


Difference between Checked vs Unchecked Exceptions in Java

Checked Exception and Unchecked Exception

Checked Exception
When there is possible chances of Failure Checked Exceptions are Introduced. Checked Exceptions are the one checked at compile time by Java. Checked Exceptions must be caught within try-catch block or throw that exception in its definition using throws keyword.

Any Exception that is direct sub-class of Exception but doesn't inherit java.lang.RuntimeException are Checked Exception.


Example of Checked Exception
You want to read any file on system using FileReader, So there is chances of File not found on specified path this is called Checked Exception(Possible chances of Failure).
import java.io.*;

public class CheckedException {

   public static void main(String[] args) {
 /* Create object of File by providing absolute path */
 File objFile = new File("D:\\myfile.txt");
 BufferedReader objBufferedReader = null;
 FileReader objFileReader = null;
 try {
    /* Get FileReader on File */
    objFileReader = new FileReader(objFile);
    /* Get BufferedReader from FileReader */
    objBufferedReader = new BufferedReader(objFileReader);
       String strFileline = "";
    /* Read file line by line */
    while((strFileline = objBufferedReader.readLine()) != null){
   System.out.println(strFileline);
    }
 } catch (FileNotFoundException e) {
    /* Checked Exception */
    e.printStackTrace();
 } catch (IOException e) {
    /* Checked Exception */
    e.printStackTrace();
 }finally{
    /* Close the resources used for file reading */
    try {
  if(objBufferedReader != null){
     objBufferedReader.close();
  }
  
  if(objFileReader != null){
     objBufferedReader.close();
  }
    } catch (IOException e) {
  e.printStackTrace();
    }
 }
   }
}

Unchecked Exception
Exception that are not checked by Java Compiler at compile time called Unchecked Exception. Any Exception that inherits java.lang.RuntimeException are UnChecked Exception.


Example of Unchecked Exception
Dividing two Integer numbers is best example of Unchecked Exception. You are getting two values after evaluation of your logic and not sure what will be the values and divide it, that leads to java.lang.ArithmeticException.
public class UnCheckedException {

   public static void main(String[] args) {
 int x = 10;
 int y = getY();
 System.out.println(x / y);
   }

   /**
    * This is example of getting value from some method call.
    * There is possibilities of getting value `0`.
    *  
    * Java compiler can't identify such errors
    */
   public static int getY(){
 return 2-2;
   }
}

What is try-with-resources in Java 7 or above?

try-with-resources + java 7 + feature

Java designer has finally came up with better solution for closing resource. try-with-resources introduced in Java 7. Its one of noticeable feature of Java 7 and currently used by developers around the world.

The try-with-resources statement ensures that all your resources like BufferedReader, FileInputStream, ObjectInputStream, etc... closed at the end of statement. Any object that implements java.lang.AutoCloseable, which includes all objects which implement java.io.Closeable, can be used as a resource.

Source Code
import java.io.BufferedReader;
import java.io.FileReader;

public class TryWithResourcesExample {
   public static void main(String[] args) {
      /**
       * Resources declared in parentheses `()` after `try` keyword 
       * implements java.io.Closeable interface.
       * 
       * Note: 
       * - Even if exception occurs both the resources will be closed.  
       * - close methods of resources are called in the opposite order of their creation.
       */
      try(
      /* Create object of FileReader */
   FileReader objFileReader = new FileReader("D:\\Dropbox\\Notes.txt");
   /* Create object of BufferedReader using object of FileReader */
   BufferedReader objBufferedReader = new BufferedReader(objFileReader);
 ){
   /* Print the first line of file */
   System.out.println(objBufferedReader.readLine());
      }catch(Exception ex){
   ex.printStackTrace();
      }
   }
}

Note
  • - Even if exception occurs all resources will be closed.
  • - close methods of resources are called in the opposite order of their creation.


Unknown Source in Exception or Stacktrace of Java

Unknown Source in Exception or Stacktrace of Java

Its very rare situation when you face this issue in Java Programming. Possibly there are very few people have seen this error. This exception occur when you compile your Java code with no "debugging information" flag.

Why such provision in Java?
This option given by Java to prevent hacking. When you compile your code "without debugging information" then it won't show line number in exception instead it shows "Unknown Source".


Solution For any Integrated Development Environment (IDE)
I've not tested this setting with any IDE but find the code compilation settings in your IDE and set flag as per your requirement.

-g ~ This will compile code with debugging information [Shows line number in exception]
-g:none ~ This will compile code without debugging information [Won't show line number/Unknown Source]


Source Code
/**
 * ------------------------------------------
 * This will shows line number in exception
 * ------------------------------------------
 * javac -g UnknownSourceExample.java 
 * java UnknownSourceExample
 * 
 * ------------------------------------------
 * This won't shows line number in exception
 * ------------------------------------------
 * javac -g:none UnknownSourceExample.java 
 * java UnknownSourceExample
 */
public class UnknownSourceExample{
 public static void main(String args[]){
  System.out.println(10/0);
 }
}

Output
Exception in thread "main" java.lang.ArithmeticException: / by zero
        at UnknownSourceExample.main(UnknownSourceExample.java:3)
------------------------------------------  
Exception in thread "main" java.lang.ArithmeticException: / by zero
        at UnknownSourceExample.main(Unknown Source)

Jenkins / ANT Compilation
We've just setup Jenkins for scheduled war compilation and on exception we face UnknownSource issue. We are still in learning phase and didn't know that we've to set debug attribute in build.xml of ANT. If you are also facing same issue then here is the solution that may help you.

Find code compilation tag <javac> in your build.xml, add debug and debuglevel attribute in it and now build your project through Jenkins so it'll show line number in exception instead Unknown Source. Your tag will look like as follow...
<javac debug="true" debuglevel="lines,vars,source" destdir="bin" srcdir="src"/>

Your security settings have blocked an application signed with an expired or not-yet-valid certificate from running

We are using applet in our project and Its signed by code signing certificate. It was working fine before expiry date of code signing certificate. We renewed our code signing certificate and signed and executed applet again and but we got the following exception...
com.sun.deploy.security.BlockedException: Your security settings have blocked an application signed with an expired or not-yet-valid certificate from running
    at com.sun.deploy.security.SandboxSecurity.showBlockedDialog(Unknown Source)
    at com.sun.deploy.security.TrustDecider.askUser(Unknown Source)
    at com.sun.deploy.security.TrustDecider.validateChain(Unknown Source)
    at com.sun.deploy.security.TrustDecider.isAllPermissionGranted(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.isTrustedByTrustDecider(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.getTrustedCodeSources(Unknown Source)
    at com.sun.deploy.security.CPCallbackHandler$ParentCallback.strategy(Unknown Source)
    at com.sun.deploy.security.CPCallbackHandler$ParentCallback.openClassPathElement(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Root Cause
After all possible solution from Internet like exception site list and few other I started looking for all tiny bit of applet and found that we are using bouncy castle jar in our applet. I decompiled jar using jd-gui and found that bouncy castle jar is also signed. So I pulled out certificate details of bouncy castle by using following command.
$>"C:\Program Files\Java\jdk1.6.0_25\bin\jarsigner.exe" -verify -verbose -certs bouncy-castle.jar
The developer integrate this jar in our applet left the job and used same code signing certificate for bouncy castle.

Solution
I signed my applet and bouncy castle jar with renewed code signing certificate and Its working like as always. It may possible this solution doesn't help you but this is for those who uses other jar in their applet and face the same issue.

Conclusion
You have to sign all jar that you are using in your applet.

java.net.ConnectException: Connection timed out: connect

internet disconnected

This exception caused by several issues. Issue may be solved by ensuring following checklist.

- Connected to Internet / Local Area Network (LAN)
Make sure you are connected to internet or local area network.

- Behind Firewall
Firewall is common issue faced by many developer. We were facing same issue.
java.net.ConnectException: Connection timed out: connect
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
 at java.net.Socket.connect(Socket.java:529)
 at java.net.Socket.connect(Socket.java:478)
 at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
 at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
 at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
 at sun.net.www.http.HttpClient.(HttpClient.java:233)
 at sun.net.www.http.HttpClient.New(HttpClient.java:306)
 at sun.net.www.http.HttpClient.New(HttpClient.java:323)
 at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)
 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
 at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)
 at ReadWebpage.main(ReadWebpage.java:24)

Scenario
We were writing an applet program in Java to read webpage from internet. We can't even make request to well know search engine www.google.com even if its allowed in firewall rule. We called upon our network admin he said you must pass your request through proxy server. We set proxy in our Java code for HttpURLConnection and all went good.

Code
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("192.168.0.202", 8080));
HttpURLConnection con = (HttpURLConnection) data.openConnection(proxy);
Use of Proxy
You need to take care for proxy connection and it depends upon whether you are write program for applet or desktop application. If you are writing code for applet then in production applet, you don't need proxy connection as server will have all access and will work without proxy. If you are working on desktop application that run within the Local Area Network then you must set proxy in case of firewall.

java.sql.SQLException: Incorrect syntax near '@P1'.

Scenario: 
We were calling MSSQL Stored Procedure using hibernate. My colleague called me to check out error and even I was clueless. It was working fine at database level. And while checking out calling code it seems alright but it thrown an error as follow.

org.hibernate.exception.SQLGrammarException: could not execute query
  at Incorrect syntax near '@P1'..()
  at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
  at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
  at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
  at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
  at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
  at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:778)
  at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:144)
  at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
  at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
  at org.hibernate.loader.Loader.doQuery(Loader.java:674)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
  at org.hibernate.loader.Loader.doList(Loader.java:2220)
  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
  at org.hibernate.loader.Loader.list(Loader.java:2099)
  at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
  at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
  at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
  at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
  at com.gwtplatform.dispatch.server.AbstractDispatchImpl.doExecute(AbstractDispatchImpl.java:153)
  at com.gwtplatform.dispatch.server.AbstractDispatchImpl.execute(AbstractDispatchImpl.java:111)
  at com.gwtplatform.dispatch.server.AbstractDispatchServiceImpl.execute(AbstractDispatchServiceImpl.java:80)
  at sun.reflect.GeneratedMethodAccessor1479.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
  at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
  at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
  at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
  at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
  at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
  at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
  at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
  at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
  at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
  at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
  at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
  at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
  at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
  at org.mortbay.jetty.Server.handle(Server.java:324)
  at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
  at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
  at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
  at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
  at could not execute query.(Native Method)
  at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
  at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
  at org.hibernate.loader.Loader.doList(Loader.java:2223)
  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
  at org.hibernate.loader.Loader.list(Loader.java:2099)
  at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
  at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
  at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
  at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
  at com.gwtplatform.dispatch.server.AbstractDispatchImpl.doExecute(AbstractDispatchImpl.java:153)
  at com.gwtplatform.dispatch.server.AbstractDispatchImpl.execute(AbstractDispatchImpl.java:111)
  at com.gwtplatform.dispatch.server.AbstractDispatchServiceImpl.execute(AbstractDispatchServiceImpl.java:80)
  at sun.reflect.GeneratedMethodAccessor1479.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
  at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
  at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
  at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
  at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
  at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
  at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
  at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
  at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
  at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
  at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
  at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
  at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
  at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
  at org.mortbay.jetty.Server.handle(Server.java:324)
  at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
  at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
  at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
  at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
  ... 53 more
Caused by: java.sql.SQLException: Incorrect syntax near '@P1'.
  at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
  at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
  at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
  at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
  at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
  at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:778)
  at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:144)
  at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
  at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
  at org.hibernate.loader.Loader.doQuery(Loader.java:674)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
  at org.hibernate.loader.Loader.doList(Loader.java:2220)
  ... 50 more

Solution:
My colleague forgot to put comma , after each parameter. Follow below queries one with error and other without.

EXEC MY_STORED_PROC :PARAM1 :PARAM2 /* Query that throwing error because of missing comma. */
EXEC MY_STORED_PROC :PARAM1, :PARAM2 /* Query that works fine. */

java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1ObjectIdentifier

For those who don't know, Bouncycastle is lightweight cryptography API.

Scenario:
We created applet that uses bouncycastle classes to generate digital certificate. My colleague worked on bouncy castle and it was working fine so far. I created new method in applet and signed it with code signing certificate in my machine. I uploaded applet on test server and it thrown error given below.  

Java Release note: Only digitally signed (Code signing) Applet will work 2014 onward
basic: exception: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1ObjectIdentifier.
java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1ObjectIdentifier
 at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.instantiateApplet(Unknown Source)
 at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
 at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1ObjectIdentifier
 at java.lang.Class.getDeclaredConstructors0(Native Method)
 at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
 at java.lang.Class.getConstructor0(Unknown Source)
 at java.lang.Class.newInstance(Unknown Source)
 at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
 at java.awt.event.InvocationEvent.dispatch(Unknown Source)
 at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
 at java.awt.EventQueue.access$200(Unknown Source)
 at java.awt.EventQueue$3.run(Unknown Source)
 at java.awt.EventQueue$3.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
 at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
 at java.awt.EventQueue$4.run(Unknown Source)
 at java.awt.EventQueue$4.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.asn1.ASN1ObjectIdentifier
 at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
 at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
 at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
 at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 ... 24 more
Solution:
After trying all options from internet at last we were clueless. I told him to sign applet in your system. He did it and worked fine. Reason is as follow...

We both having 64 bit system. In my system I installed 32 bit java and he has 64 bit java in his system. Thats the problem may be bouncy castle created using 64 bit Java. If you are getting same issue. Try to sign your applet using 64 bit java from
C:\Program Files (x86)\Java\jdk1.6.0_25\bin\jarsigner.exe

java.sql.SQLException: Incorrect syntax near '@P0'.

I'm creating sample code for one of my article of hibernate and database. I got exception while calling Stored Procedure from java in hibernate.

So I googled and after trying different option found the solution and thought let me post it in proper way so you guys don't need to waste your time to check other options.

EXCEPTION
Caused by: java.sql.SQLException: Incorrect syntax near '@P0'.
 at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
 at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2894)
 at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2334)
 at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:643)
 at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:506)
 at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:979)
 at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
 at org.hibernate.loader.Loader.getResultSet(Loader.java:1778)
 at org.hibernate.loader.Loader.doQuery(Loader.java:662)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
 at org.hibernate.loader.Loader.doList(Loader.java:2211)
 ... 7 more
CODE WITH ERROR
Query callStoredProcedure = session.createSQLQuery("EXEC SP_MSSQL_HIBERNATE (:param1, :param2, :param3)").addEntity(User.class);
callStoredProcedure.setInteger("param1", 10);
callStoredProcedure.setInteger("param2", 10);
callStoredProcedure.setString("param3", "javaQuery");
      
List userList = callStoredProcedure.list();
SOLUTION
  • If you are calling MSSQL stored procedure then SQL query must be without Parentheses ( and ).
    e.g EXEC SP_MSSQL_HIBERNATE :param1, :param2, :param3
  • If you are calling MYSQL stored procedure then SQL query must be with Parentheses ( and ).
    e.g CALL SP_MYSQL_HIBERNATE (:param1, :param2, :param3)


java.lang.SecurityException: JVM Shared, not allowed to set security manager

Java, Applet
I created custom security manager for Applet to get all permission. In below code I'm allowing applet to exit and its not good practice but situation driving me that way for while. I'm also searching for better option. If you guys have solution please comment it.
class customSecurityManager extends SecurityManager{
    SecurityManager original;

    customSecurityManager(SecurityManager original) {
      this.original = original;
    }

    /** Deny permission to exit the VM(uncomment line).*/
    public void checkExit(int status) {
      //throw(new SecurityException("Not allowed"));
    }

    /* Allow this security manager to be replaced,in fact allow pretty much everything. */
    public void checkPermission(Permission perm) {
    }

    public SecurityManager getOriginalSecurityManager() {
       return original;
    }
}
It works pretty well in many systems but one system was throwing an exception as follow...
java.lang.SecurityException: JVM Shared, not allowed to set security manager
 at sun.plugin2.applet.SecurityManagerHelper.checkPermissionHelper(Unknown Source)
 at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
 at java.lang.System.setSecurityManager0(Unknown Source)
 at java.lang.System.setSecurityManager(Unknown Source)
 at SecurityApplet.init(SecurityApplet.java:103)
 at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
 at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
 at j ava.lang.Thread.run(Unknown Source)
After doing lots of search over internet and trying different options finally found solution for applet. Loading applet in separate JVM did the job.
<applet>
...
<param name="separate_jvm" value="true">
...
</applet>

java.lang.IllegalStateException: More than the maximum number of request parameters (GET plus POST) for a single request ([512]) were detected.


This is very unusual error thrown by Jboss server. Error it self explain that you are passing more than 512 parameters in request. Which is not good practice but if situation drives you in that way. There is solution available for it.

"To change this limit, set the maxParameterCount attribute on the Connector." this message seems informative but actually its wrong message in case of JBoss 7 or may be in future versions.

Error message you've
java.lang.IllegalStateException: More than the maximum number of request parameters (GET plus POST) for a single request ([512]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
 org.apache.tomcat.util.http.Parameters.addParameter(Parameters.java:199)
 org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:383)
 org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:229)
 org.apache.catalina.connector.Request.parseParameters(Request.java:2874)
 org.apache.catalina.connector.Request.getParameter(Request.java:1291)
 org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:363)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
Solution:
We need to use org.apache.tomcat.util.http.* library to solve this error. You don't need to import or download this library. It already available in Jboss. All you need to increase value of Parameter Count.

Jboss 7
Step 1: Open standalone.xml file available in "jboss7\standalone\configuration" folder.
Step 2: Paste below code after </extensions> tag and change value as per your requirement.
<system-properties>
   <property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT" value="2000"/>
</system-properties>
Jboss 6 or lower (I didn't try but it has to work in lower version of Jboss as suggested by informative message)
Step 1: Open standalone.xml file available in "jboss6\standalone\configuration" folder.
Step 2: Find connector tag same as follow and add maxParameterCount attribute.
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" maxParameterCount="1000" /> 

com.jacob.com.ComFailException: Can't get object clsid from progid

JACOB + jacob-project

Exception Stacktrace:
com.jacob.com.ComFailException: Can't get object clsid from progid
 at com.jacob.com.Dispatch.createInstanceNative(Native Method)
 at com.jacob.com.Dispatch.(Dispatch.java:99)
 at com.jacob.activeX.ActiveXComponent.(ActiveXComponent.java:58)
ActiveXComponent comp = new ActiveXComponent("ABCXYZ");
This exception thrown by JACOB library when you try to create ActiveXComponent. Its coming because you are trying to create ActiveXComponent of program that is not installed in your system.


Solution:
You need to find proper CLSID or ProgID or VersionIndependentProgID for your program. Lets create Microsoft Excel's ActiveXComponent
ActiveXComponent comp = new ActiveXComponent("clsid:{00024500-0000-0000-C000-000000000046}");
ActiveXComponent comp = new ActiveXComponent("Excel.Application.14");
ActiveXComponent comp = new ActiveXComponent("Excel.Application");
1. Create ActiveXComponent using CLSID.
2. Create ActiveXComponent using version specific program id.
3. Create ActiveXComponent using version independent program id.

If you want to find CLSID or ProgID or VersionIndependentProgID for your program. Download OLEViewer and browser Object Classes > All Objects


OLEViewer


How to increase PermSize/MaxPermSize in JBoss?


Quick definition of PermSize:
The permanent generation is used to hold reflective data of the VM itself such as class objects and method objects. These reflective objects are allocated directly into the permanent generation, and it is sized independently from the other generations

If you are working around big Enterprise Application, you may face memory issues in Jboss. In order to solve this you need to increase JVM PermSize for Jboss. Lets see the steps to increase Jboss PermSize.

Note: I tested this settings under jboss-as-7.1.1.Final

For Windows:

Step 1:
Goto bin folder of Jboss

Step 2: Open standalone.conf.bat file in notepad or other editor.

Step 3: Find set "JAVA_OPTS=-Xms64M -Xmx512M -XX:MaxPermSize=256M" and change the MaxPermSize as per your requirement and save it.

Step 4: Restart the Jboss.


For Linux:

Step 1:
Goto bin folder of Jboss either terminal or places.

Step 2: Open standalone.conf file in gedit(Ubuntu) or in terminal.

Step 3: Find JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000" and change the MaxPermSize as per your requirement and save it.

Step 4: Restart the Jboss.

Jboss console log :
Caused by: java.lang.OutOfMemoryError: PermGen space
        at sun.misc.Unsafe.defineClass(Native Method) [rt.jar:1.6.0_24]
        at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45) [rt.jar:1.6.0_24]
        at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381) [rt.jar:1.6.0_24]
        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.6.0_24]
        at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377) [rt.jar:1.6.0_24]
        at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:59) [rt.jar:1.6.0_24]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:28) [rt.jar:1.6.0_24]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_24]
        at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_24]
        at net.sf.beanlib.provider.BeanPopulator.invokeMethodAsPrivileged(BeanPopulator.java:221) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.BeanPopulator.doit(BeanPopulator.java:194) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.BeanPopulator.processSetterMethod(BeanPopulator.java:172) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.BeanPopulator.populate(BeanPopulator.java:270) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.replicator.ReplicatorTemplate.populateBean(ReplicatorTemplate.java:174) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:173) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71) [beanlib-hibernate-5.0.1beta.jar:]
        at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.BeanTransformer.transform(BeanTransformer.java:224) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.BeanPopulator.doit(BeanPopulator.java:201) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.BeanPopulator.processSetterMethod(BeanPopulator.java:172) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.BeanPopulator.populate(BeanPopulator.java:270) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.replicator.ReplicatorTemplate.populateBean(ReplicatorTemplate.java:174) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:173) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71) [beanlib-hibernate-5.0.1beta.jar:]
        at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.provider.BeanTransformer.transform(BeanTransformer.java:224) [beanlib-5.0.1beta.jar:]
        at net.sf.beanlib.hibernate.HibernateBeanReplicator.copy(HibernateBeanReplicator.java:133) [beanlib-hibernate-5.0.1beta.jar:]
        at net.sf.beanlib.hibernate.HibernateBeanReplicator.copy(HibernateBeanReplicator.java:111) [beanlib-hibernate-5.0.1beta.jar:]

Developer Info: If you are using jsupload and you do not need cross-domain, try version compiled with standard linker?

I worked around gwtupload plugin created by "Manolo Carrasco". Sample application : gwtupload custom package with sample application


I was getting same message popup so many time. I dig down and found the solution for this alert box with gwt environment. I haven't tried jsupload so it may not work for it.

Unable to auto submit the form, it seems your browser has security issues with this features.
Developer Info: If you are using jsupload and you do not need cross-domain, try version compiled with standard linker?

Solution: I checked my lib folder and found there are two jars of commons-io and commons-fileupload with different version. Old version that don't support gwtupload plugin's requirement. I removed old version of commons-io and commons-fileupload from lib folder and everything working fine.