Tuesday, January 03, 2012

Message: The entity "nbsp" was referenced, but not declared.

While parsing an XML using Stax I encountered this error.

Even though the data was inside CDATA tags it was still giving this error which was puzzling. On further analysis I found out that Control Characters (^M) was causing this problem.

To fix it in Unix/Linux, just remove control characters and I found this nifty command to do it:
tr -d "\r" < inputfile > outputfile

Sunday, August 07, 2011

vesamenu.c32: Not a COM32R image

This was the error message which came on booting Mint 11 Live CD on a new machine.  The bootable CD was created using Ubuntu 'Startup Disk Creator'. After googling I found the solution was to type live at the prompt

boot: live

Source: http://www.linuxquestions.org/questions/linux-mint-84/trying-to-boot-linux-mint-9-from-usb-flash-drive-vesamenu-c32-not-a-com32r-image-829397/

Thursday, July 14, 2011

javax.naming.NameNotFoundException: No object bound to name java:comp/env/jdbc/xxxx

While adding a new JDBC JNDI lookup in the application, I encountered the following exception on Glassfish 2.1.1.
Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/jdbc/xxxx
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:856)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:407)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 104 more


Solution:
For Glassfish 2.1.1 add the following in the web.xml file



        jdbc/xxx
        javax.sql.DataSource
        Container
        Shareable

Thursday, March 10, 2011

JQuery UI Autocomplete with Stripes

While trying to integrate JQuery UI Autocomplete problem, the autocomplete was working with static JavaScript method but not working with values sent from the server.

Now the new JQueryUI expects JSON instead of the deprecated version which expected Strings separated by new line character. Even when I was sending JSON data, the values were not displayed at all.

The problem was that I was using ' to quote the strings instead of "

Friday, February 04, 2011

attempted to return null from a method with a primitive return type (void).


Problem:
I was encoutering this excpetion while inserting a row in the database using myBatis 3. 

Solution:
I had forgotton to change my mapper file xml tag from <select> to <insert>.

org.apache.ibatis.binding.BindingException: Mapper method 'xxx' (interface in.xx.xxxx..xxxDAO) attempted to return null from a method with a primitive return type (void).
 org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40)
 $Proxy34.XXXX(Unknown Source)
 xxx.xxx.XXXXServiceImpl.save(XXXServiceImpl.java:94)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)
 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
 org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopP

Friday, January 07, 2011

SEVERE: Could not start SOLR. Check solr/home property



StackTrace
INFO: created /debug/dump: solr.DumpRequestHandler
Jan 8, 2011 10:30:22 AM org.apache.solr.servlet.SolrDispatchFilter init
SEVERE: Could not start SOLR. Check solr/home property
java.lang.RuntimeException: java.io.IOException: read past EOF
at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1068)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:579)
at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137)
at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:594)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)


Cause
I copied the SOLR directory to another machine and when I fired up SOLR received this error.

Solution:
The error message was misleading as even though I started the server with -Dsolr.solr.home option the error was still the same.

The index was somehow corrupted and when I deleted the $SOLR_HOME/solr/data/index directory and restarted SOLR it worked fine. Obviously after that the data had to be reindexed

Thursday, November 25, 2010

Exception in thread "main" java.lang.NoClassDefFoundError: org/jvnet/staxex/XMLStreamReaderEx

Exception in thread "main" java.lang.NoClassDefFoundError: org/jvnet/staxex/XMLStreamReaderEx
at com.sun.xml.stream.buffer.stax.StreamReaderBufferCreator.storeElementAndChildren(StreamReaderBufferCreator.java:174)
at com.sun.xml.stream.buffer.stax.StreamReaderBufferCreator.storeDocumentAndChildren(StreamReaderBufferCreator.java:158)
at com.sun.xml.stream.buffer.stax.StreamReaderBufferCreator.store(StreamReaderBufferCreator.java:139)
at com.sun.xml.stream.buffer.stax.StreamReaderBufferCreator.create(StreamReaderBufferCreator.java:82)
at com.sun.xml.stream.buffer.MutableXMLStreamBuffer.createFromXMLStreamReader(MutableXMLStreamBuffer.java:113)
at com.sun.xml.stream.buffer.XMLStreamBuffer.createNewBufferFromXMLStreamReader(XMLStreamBuffer.java:398)
at com.sun.xml.ws.api.addressing.WSEndpointReference.<init>(WSEndpointReference.java:174)
at com.sun.xml.ws.api.addressing.WSEndpointReference.<init>(WSEndpointReference.java:166)
at com.sun.xml.ws.api.addressing.AddressingVersion.<init>(AddressingVersion.java:436)
at com.sun.xml.ws.api.addressing.AddressingVersion.<init>(AddressingVersion.java:67)
at com.sun.xml.ws.api.addressing.AddressingVersion$1.<init>(AddressingVersion.java:146)
at com.sun.xml.ws.api.addressing.AddressingVersion.<clinit>(AddressingVersion.java:69)
at com.sun.tools.ws.wsdl.parser.MemberSubmissionAddressingExtensionHandler.getNamespaceURI(MemberSubmissionAddressingExtensionHandler.java:62)
at com.sun.tools.ws.wsdl.parser.WSDLParser.register(WSDLParser.java:129)
at com.sun.tools.ws.wsdl.parser.WSDLParser.<init>(WSDLParser.java:119)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:109)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.tools.ws.Invoker.invoke(Invoker.java:116)
at com.sun.tools.ws.WsImport.main(WsImport.java:52)
erEx

Solution:
During the setup of Metro 1.5 I had also copied the webservices-rt.jar and other files in JDK_HOME/jre/lib/endorsed directory.
Removing the files from endorsed directory removed this error and led to generation of files.

Monday, November 01, 2010

org.postgresql.util.PSQLException: The column {n} index is out of range {m}

The cause of the error was that in the Query for {n} dynamic parameters, {m} parameters were being inserted

Tuesday, October 19, 2010

Cannot find message resources under key org.apache.struts.action.MESSAGE with

Received error while using <bean:write> tag
Cannot find message resources under key org.apache.struts.action.MESSAGE

Cause:
A int value was being displayed using <bean:write>
<bean:write property="xxxProperty" name="xxForm />

Solution:
Used format attribute to provide the format of Integer
<bean:write property="xxxProperty" name-"xForm" format="#" />

and it worked.

P.S.- Working in Struts 1 again makes me realize how painful it was :-)

Tuesday, October 07, 2008

java.lang.NoSuchMethodError: com/ibm/ejs/ras/TraceComponent.isAnyTracingEnabled()Z

Include the com.ibm.ws.webservices.thinclient_6.1.0.jar file is in the classpath.
Remove other jars if present (such as ras.jar, com.ibm.ws.runtime_6.1.0.jar) which contain TraceComponent class

Monday, October 06, 2008

java.lang.NoSuchFieldError: com/ibm/mq/MQC.MQCT_NONE

com.ibm.mq.jar is required in the classpath of the java class.
This jar is supplied with WAS

Thursday, July 24, 2008

Unable to use CSS style on the page

I was going nuts why I am unable to view the style on the pages using Struts 2 with AJAX.

I have to investigate but once I removed this line from my JSP it ran fine :-)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Saturday, August 25, 2007

Show Hide using display.style in javascript problem in Firefox

An already javascript function was used to show/hide an array of elments in an HTML page.
It worked perfectly in IE but in Firefox it gave a problem when we used to show/hide multiple times on an element. A new row/column was added in every iteration of show hide.

On investigation, a single line code change made in work fine in both IE and firefox

Old Code
function showHideElement(elementId, showHideFlag) {
var elementObj = document.getElementById(elementId);
if(showHideFlag == 1) {
elementObj.style.display = 'block';
} else if(showHideFlag == 0) {
elementObj.style.display = 'none';
}
}
New Code
function showHideElement(elementId, showHideFlag) {
var elementObj = document.getElementById(elementId);
if(showHideFlag == 1) {
elementObj.style.display = '';
} else if(showHideFlag == 0) {
elementObj.style.display = 'none';
}
}
A single line change from elementObj.style.display = 'block' to elementObj.style.display = '' stopped creation of blank rows/columns on every iteration of show hide

http://www.ozzu.com/ftopic41924.html
http://www.velocityreviews.com/forums/t160487-firefox-and-stylequotdisplayblockquot-on-table-row.html

Friday, August 10, 2007

Wednesday, July 11, 2007

No form found under 'null' in locale 'en_US'. A form must be defined in the Commons Validator configuration when dynamicJavascript=&q

As soon as I put &lt;html:javascript /&gt; tag in the jsp, I get this error.
It indicates that it is unable to find a formset.

Solution: Did not add the form name with the tag
ex:

The path of an ForwardConfig cannot be null

Usually, this is an indication that you have validation turned on, the
validation is failing, and the "input" attribute is not set (i.e. it's
NULL)
Source

I was adding validator and forgot to do 'validation="true"' add the 'input' attribute in action mapping

Tuesday, March 27, 2007

java.sql.SQLException: ORA-01008: not all variables bound

One of the cause of this error can be found in the following snippet of code:

query = "select * from AAA where condn = ?";
pstmt = con.prepareStatement(query);
pstmt.setString(1, firstValue);
// ResultSet rs = pstmt.executeQuery(query); // Wrong Usage - Do not provide query again
ResultSet rs = pstmt.executeQuery(); // Correct Usage

Another reason is that you have not mapped all '?' with corresponding values




Thursday, July 27, 2006

ORA-00911: invalid character

The exception was because I had a semicolon(;) after the preparedstatement query.
Removal of it resolved the problem

Tuesday, May 09, 2006

Database Explorer in Eclipse 3.1

Hi,

These are two Plugins which can be used for exploring the DB.
Hence it will reduce the dependency on PL/SQL Dev and Toad.
1. SourceForge.net: Eclipse SQLExplorer plugin
2. SourceForge.net: DBEdit Plugin for Eclipse

Installation is simple, just extract them in the plugin directory of Eclipse.
After you restart your Eclipse you can see one more Perspective(SQLExplorer/DBEdit) which will depend on which plugin you have installed.

Hopefully once we move to Eclipse 3.2 we will get all this features from the Data Tools Platform.

The  installation instruction for SQL Exlplorer are present on this link
http://www.onjava.com/pub/a/onjava/2005/05/11/sqlexplorer.html



Thursday, March 23, 2006

Cannot create JDBC driver of class '' for connect URL 'null'

If you get this Exception while using Tomcat 5.5.9 or 5.5.*
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at com.vsnl.pcr.dao.DataAccessObject.getConnection(DataAccessObject.java:119) ... 29 more

Possible Solution:
Check the database lookup entry in either context.xml or server.xml
In Tomcat 5.5.9 there are no <ResouceParams> tag and the parameters are passed alongiwth the resource tag.

e.g Resource Entry in Tomcat 5.5.9


<resource name="jdbc/XYZ"
auth="Container"
scope="Shareable"
type="javax.sql.DataSource"
driverclassname="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:XYZ"
username="xyz"
password="xyz"
maxactive="10"
maxidle="100"
maxwait="3000">
</resource>




In Tomcat 5.0.28


<resource name="jdbc/XYZ" scope="Shareable" type="javax.sql.DataSource">
<resourceparams name="jdbc/XYZ">
<parameter>
<name>factory</name>
<value>
org.apache.commons.dbcp.BasicDataSourceFactory
</value>
</parameter>
<!-- DBCP database connection settings -->
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:XYZ</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>username</name>
<value>xyz</value>
</parameter>
<parameter>
<name>password</name>
<value>xyz</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>3000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>100</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>

</resourceparams>
</resource>

One Last Point: Dont forget to put your classes12.jar/ojdbc14.jar file in /commons/lib folder.

Two useful links which help me discover this.. :-) (after I had already wasted a lot of time)
1. Java Forums
2. Tomcat Docs