Showing posts with label Bug-Fix. Show all posts
Showing posts with label Bug-Fix. Show all posts

Thursday

SOAPUI : java.lang.Exception: Failed to load url

BUG:
When i try to import the WSDL in SoapUI-5.2.1, i got an error.
Detailed error log in C:\Program Files\SmartBear\SoapUI-5.2.1\bin\error.log is below:

java.lang.Exception: Failed to load url; https://10.xxx.xxx.xxx:xxxx/../../..?wsdl, 0 -
                at com.eviware.soapui.impl.wsdl.support.wsdl.UrlWsdlLoader.load(UrlWsdlLoader.java:171)
                at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.readCleanWsdlFrom(WsdlLoader.java:123)
                at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:101)
                at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:488)
                at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:477)
                at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(AbstractDefinitionCache.java:94)
                at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:209)
                at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
                at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:131)
                at java.lang.Thread.run(Unknown Source)

Also when i open the url in the browser, i see the following certificate error which says that the connection uses TLS 1.2.

























FIX:
It means that the service has configured only for TLS1.2 and SSL has not allowed.
You should add the following parameter to the SOAPUI vmoptions file (C:\Program Files\SmartBear\SoapUI-5.2.1\bin\SoapUI-5.2.1.vmoptions) and restart SOAPUI.

-Dsoapui.https.protocols=TLSv1.2,SSLv3

Tuesday

Clearcase unable to contact albd_server on host 'remote server'

BUG:
I got following error when i attempt to open/start view.
  • clearcase unable to contact albd_server on host 
FIX:
Open Clearcase properties as following:
  • Windows Start >> Run  >> type  cc.cpl >> Service Startup tab
  • You will see "Status of the ALBD Service" as Stopped. Then click "Start Clearcase".




Friday

Ant scp error: com.jcraft.jsch.JSchException: reject HostKey: 10.xx.xx.xx

BUG:
I got the following error in scp task when run ant.
my build file:

<scp todir="${username}:${password}@${ip}:${dir}" >
       <fileset dir="${parentDir}/">
            <include name="**/${dirToCopy}"/>
         </fileset>
</scp>

ERROR:
com.jcraft.jsch.JSchException: reject HostKey: 10.xx.xx.xx

FIX:
Add trust attribute.
<scp todir="${username}:${password}@${ip}:${dir}" trust="true" >
         <fileset dir="${parentDir}/">
            <include name="**/${dirToCopy}"/>
         </fileset>
</scp>

Tuesday

Address already in use: bind /127.0.0.1:9999

BUG:
While i'm trying to start JBOSS, i got following error.
             Address already in use: bind /127.0.0.1:9999
FIX:
Open command prompt, then try  netstat -aon.You will see the detail.


 


To kill the process try   taskkill /f /pid PID.

java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener

BUG:
java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener

FIX:
Download jaxws-rt-2.1.4.jar and copy it under WEB-INF/lib

java.lang.NoClassDefFoundError: com/sun/org/apache/xml/internal/resolver/CatalogManager

BUG:
 java.lang.NoClassDefFoundError: com/sun/org/apache/xml/internal/resolver/CatalogManager

FIX:
Download resolver.jar and copy it under WEB-INF/lib

https://mvnrepository.com/artifact/com.sun.org.apache.xml.internal/resolver/20050927

Friday

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

BUG:
I was getting below error. I tried slf4j-api-1.7.5.jar, slf4j-api-1.6.1.jar but it didn't fix.

        SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

FIX:
Use slf4j-jdk14 in addition to slf4j-api.
Download slf4j-jdk14-1.7.5.jar: 

https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14/1.7.5
For maven:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-jdk14</artifactId>
    <version>1.7.5</version>
</dependency>

Thursday

java.lang.ClassCastException: weblogic.jdbc.wrapper.Struct_oracle_sql_STRUCT cannot be cast to oracle.sql.STRUCT

BUG:

I'm deploying my application on Weblogic 10.3.6. And trying to connect Oracle database to call stored function and i'm using OracleCallableStatement and OracleTypes.STRUCT.
But i'm getting the below error:

java.lang.ClassCastException: weblogic.jdbc.wrapper.Struct_oracle_sql_STRUCT cannot be cast to oracle.sql.STRUCT

FIX:

import java.sql.CallableStatement;
import java.sql.Types;
import java.sql.Connection;

...
CallableStatement statement = null;
...
statement = conn.prepareCall("{?=call YOUR_SHEMA.your_stored_function_name(?)}");
statement.registerOutParameter(1, Types.STRUCT, "YOUR_SHEMA.your_return_object_name");
statement.setLong(2, "your_input_parameter");
statement.execute();

Object attributeList[]  = ((java.sql.Struct)statement.getObject(1)).getAttributes();

if(attributeList != null) {
    //examples
       Timestamp date = (Timestamp)attributeList[6];
       String text = attributeList[8].toString();
}

OR:
If you use weblogic extension version then you can use vendorConnection with OracleCallableStatement and OracleTypes.STRUCT.

import java.sql.Connection;
import weblogic.jdbc.extensions.WLConnection;

...
Connection con = dataSource.getConnection();
oracle.jdbc.OracleConnection conn2 = (oracle.jdbc.OracleConnection)(((WLConnection)con).getVendorConnection());
return conn2;
...

Tuesday

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

PROBLEM:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

SOLVE:
right click project >> select properties >> select project facets >> select runtimes >> select your server from list.

Cannot change version of project facet Dynamic Web Module to 2.5

PROBLEM:


















SOLVE:
Open navigator:





















Open "org.eclipse.wst.common.project.facet.core.xml".
Change " <installed facet="jst.web" version="3.0"/>" 
to <installed facet="jst.web" version="2.5"/> and save.
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <fixed facet="java"/>
  <fixed facet="jst.web"/>
  <installed facet="java" version="1.6"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="jst.web" version="2.5"/>
</faceted-project>

Monday

java.lang.IllegalArgumentException: No enum const class java.util.concurrent.TimeUnit.MİLLİSECONDS

BUG:
I got the below error when i started JBOSS server.
java.lang.IllegalArgumentException: No enum const class java.util.concurrent.TimeUnit.MİLLİSECONDS

FIX:
1. Double click to the server.
2. Click "Open launch configuration"
3. Add to the Vm arguments '-Duser.language=en'
4. Then save and start your server.

Tuesday

Spring - applicationContext.xml cannot be opened because it does not exist


BUG:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist

private static final ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext("applicationContext.xml");

ClassA classA = (ClassA)factory.getBean("ClassA");

FIX:
You should keep your spring files in source folder. (src, resources vs.) WEB-INF is not a source folder.
Move your applicationContext.xml file in a sub-folder of the src folder.




java.lang.reflect.InvocationTargetException

InvocationTargetException means that the method you called threw an different exception.
To see the real exception details wrap the method with a try-catch block and log it.

Wednesday

java.io.InvalidClassException: com.oracle.pitchfork.interfaces.LifecycleCallbackException; local class incompatible:

BUG:
java.io.InvalidClassException: com.oracle.pitchfork.interfaces.LifecycleCallbackException; local class incompatible:

FIX:
Define a serialVerionUID in your class:
private static final long serialVersionUID = 6529685098267757690L;

Tuesday

How to solve JXL error : jxl.read.biff.BiffException: Unable to recognize OLE stream

BUG:
I got following error while i was reading the uploaded excel file (.xlsx) by using jxl library.
how to solve JXL error : jxl.read.biff.BiffException: Unable to recognize OLE stream

FIX:
JXL library does not support .xslx format, you should use Apache POI (WorkbookFactory) instead of JXL.(poi.jar)

org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML.

BUG:
While i was trying to read uploaded excel by apache poi (HSSFWorkbook) i got following error:

Error:  org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML.
 You are calling the part of POI that deals with OLE2 Office Documents. 
 You need to call a different part of POI to process this data (eg XSSF instead of HSSF)

FIX:
The error is taken only with the older .xls (binary) files. 
For both .xls and .xlsx files you can use WorkbookFactory. Download poi-ooxml-3.9.jar and add it to classpath.

Workbook workbook = WorkbookFactory.create(new FileInputStream("E:/Code.xlsx"));
Sheet firstSheet = workbook .getSheetAt(0);
Iterator<Row> rowIter = firstSheet.rowIterator(); 
while(rowIter.hasNext()) {
Object row = rowIter.next();
       Iterator<Cell> cellIterator = ((Row) row).cellIterator();

 }

java.lang.NoClassDefFoundError: org/dom4j/Namespace at org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller

BUG:
While i was trying to read uploaded excel by apache poi i got following error:
java.lang.NoClassDefFoundError: org/dom4j/Namespace

at org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller.<clinit>(PackagePropertiesUnmarshaller.java:49)

FIX:
I downloaded dom4j.jar and add it to classpath.
You can download the jar from here.

Root cause of ServletException.java.lang.NoClassDefFoundError: org/openxmlformats/schemas/drawingml/x2006/main/ThemeDocument

BUG:
While i was trying to read uploaded excel by apache poi i got following error:
   Workbook wb = WorkbookFactory.create(new FileInputStream(filename));

 Error:    Root cause of ServletException.java.lang.NoClassDefFoundError:           org/openxmlformats/schemas/drawingml/x2006/main/ThemeDocument

FIX:
I downloaded poi-ooxml-schemas.jar and add it to classpath.
You can download the jar from here.

Parsing wsdl error: soapenc:Array' to a(n) 'type definition

BUG:   While I was parsing wsdl file by using wsimport command (JAX-WS), I got this error: soapenc:Array' to a(n) 'type definition

FIX:   soapenc:Array is 'RPC-Encoding' web service style. Apache Axis 1 supports RPC encoded so parse the wsdl by Apache Axis 1.

You can use Soap-UI for parsing:
     Tools >> Axis1 Artifacts >> (write wsdl and output directory) >> Generate

java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 2

BUG:
I have the following String:
           String keyword = '\AMore\s*Code\Z';
and i want to replace regexs as following:
             keyword.replace("[\\A", "").replace("[\\Z", "").replace("[\\s*", " ") : "";
But i got the following error:
java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 2

FIX:
Use the java.util.regex.Pattern to escape special characters in regex:
  keyword = Pattern.compile("\\\\A").matcher(keyword).replaceAll(" ");