Thursday, August 2, 2012

Exception:
javax.ejb.ObjectNotFoundException: No such entity!

Scenario:

findByPrimaryKey() method called on an EJB entity bean.
Not able to find a record with the provided key/id.
 
Solution:

There are two cases here : 
  1. There is something wrong in the code, probably querying a wrong EJB to retrieve information, resulting in the exception.
  2. Probably you want to catch the exception and do something meaningful, when there is no record with the given key/id.


 

Monday, July 23, 2012

XML TO PDF (XSL Exception):

Exception:

SystemId Unknown; Line #0; Column #0; java.lang.IllegalStateException: endElement() called for fo:root where there is no current element.

The above exception occurs while the xml is transformed and reason is "xml not constructed properly.

Explanation :

In this case, this exception happened, as the <li>data</li> list items are constructed with out a parent <ul></ul> tag element.

After all the list items are placed in a parent <ul></ul> unordered list tag, this exception got fixed.

Solution :

The xml that has to be transformed into PDF or other formats should be constructed properly. 



Detailed exception :


2012-07-21 09:04:30,424 WARN  [org.apache.fop.fo.FOTreeBuilder] (http-127.0.0.1-8080-2) Mismatch: table-cell (http://www.w3.org/1999/XSL/Format) vs. list-item (http://www.w3.org/1999/XSL/Format)
2012-07-21 09:04:30,424 WARN  [org.apache.fop.fo.FOTreeBuilder] (http-127.0.0.1-8080-2) Mismatch: table-row (http://www.w3.org/1999/XSL/Format) vs. table-cell (http://www.w3.org/1999/XSL/Format)
2012-07-21 09:04:30,424 WARN  [org.apache.fop.fo.FOTreeBuilder] (http-127.0.0.1-8080-2) Mismatch: table-body (http://www.w3.org/1999/XSL/Format) vs. table-row (http://www.w3.org/1999/XSL/Format)
2012-07-21 09:04:30,424 WARN  [org.apache.fop.fo.FOTreeBuilder] (http-127.0.0.1-8080-2) Mismatch: table (http://www.w3.org/1999/XSL/Format) vs. table-body (http://www.w3.org/1999/XSL/Format)
2012-07-21 09:04:30,424 WARN  [org.apache.fop.fo.FOTreeBuilder] (http-127.0.0.1-8080-2) Mismatch: flow (http://www.w3.org/1999/XSL/Format) vs. table (http://www.w3.org/1999/XSL/Format)
2012-07-21 09:04:30,424 WARN  [org.apache.fop.fo.FOTreeBuilder] (http-127.0.0.1-8080-2) Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. flow (http://www.w3.org/1999/XSL/Format)
2012-07-21 09:04:31,440 WARN  [org.apache.fop.fo.FOTreeBuilder] (http-127.0.0.1-8080-2) Mismatch: root (http://www.w3.org/1999/XSL/Format) vs. page-sequence (http://www.w3.org/1999/XSL/Format)
2012-07-21 09:04:31,440 ERROR [org.apache.fop.fo.FOTreeBuilder] (http-127.0.0.1-8080-2) javax.xml.transform.TransformerException: java.lang.IllegalStateException: endElement() called for fo:root where there is no current element.
2012-07-21 09:04:31,441 ERROR [STDERR] (http-127.0.0.1-8080-2) SystemId Unknown; Line #0; Column #0; java.lang.IllegalStateException: endElement() called for fo:root where there is no current element.

Wednesday, July 18, 2012

JBoss exception


java.lang.IllegalArgumentException:
Container org.jboss.web.tomcat.service.TomcatInjectionContainer@b4a6bc failed to resolve persistence unit null

Solution:
Have the following attribute in the application web.xml   metadata-complete="true" web-app element.