Monday, September 26, 2016

Setup Directory Path for Android Job in Jenkins using Gradle Wrapper

Problem

In one of the Android project the gradlew file was not in the root directory path of the project


Solution

In the Gradle Wrapper set the following attributes:

Root Build Script: ${workspace}/<dir_name>/
From Root Build Script Dir: Check this value




Wednesday, February 22, 2012

Message: An invalid XML character (Unicode: 0xb) was found in the CDATA section.

Once again the XML parsing failed due to a control character (^K)

A simple way to fix in unix was to use the following command and remove such characters from the file

perl -p -i -e 's/[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]//g' <xmlfile.xml>

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