Monday, October 24, 2011

java.net.MalformedURLException: no protocol:



Problem:
This is one of the Common Exceptions which we come across daily in our lives. I encountered this issue when trying to create a xml out from a xsl template.

Exception i encountered was:
"ERROR | board.common.xml.CBXMLDocument | 999-999-0001: createTransformer: MalformedURLException: Error=java.net.MalformedURLException: no protocol: ; Message=no protocol: [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] []
2011-10-23 17:41:59,564 | ERROR | .cda.render.CBRenderXmlPrinter | 999-999-0001: CBRenderXmlPrinter.getObjectInXMLFormat(): Exception: Error=java.lang.NullPointerException; Message=null [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] []"

Solution:
The error was because i wasnt passing the protocol with the url. I appended the file protocol with the url and it worked fine. Do let me know if you too faced the same issue.
Please let me know if you still encounter this issue, mail me @ rahamat_234@yahoo.com


Similar Exceptions:

- java.net.MalformedURLException: no protocol:
- java.net.MalformedURLException: unknown protocol: ntp
- java.net.MalformedURLException



Saturday, August 27, 2011

java.sql.SQLException: ResultSet.next was not called



Problem:
This is one of the Common Exceptions which we come across almost daily in our lives. I encountered this issue when trying to iterate from a resultset.

Exception i encountered was:
"java.sql.SQLException: ResultSet.next was not called
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:208)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.jav
a:511)
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1563)
at TestingVCMIDChannel.getChannelVCMIDwithChannelName(TestingVCMIDChanne
l.java:111)
at TestingVCMIDChannel.main(TestingVCMIDChannel.java:217)"

Solution:
I did a terrible mistake of calling the results method out of the while loop where i was iterating the results set. Do check the results.getValue() here, do let me know if you too faced the same issue.
Please let me know if you still encounter this issue, mail me @ rahamat_234@yahoo.com


Similar Exceptions:

- java.sql.SQLException: ResultSet.next was not called
- oracle.jdbc.driver.DatabaseError.throwSqlException
- oracle.jdbc.driver.OracleResultSetImpl.getInt


Thursday, April 28, 2011

cvs server: Up-to-date check failed for "..............."



Problem:>
This is one of the Common Exceptions which we come across daily in our lives. I encountered this issue when trying to check-in code.

Exception i encountered was:
"cvs server: Up-to-date check failed for `Web-content/WEB-INF/struts-config.XML"
The server reported an error while performing the "cvs commit" command.
EresumeX: cvs server: Up-to-date check failed for `Web-content/WEB-INF/struts-config.XML'
EresumeX: cvs [server aborted]: correct above errors first!

Solution:
You will get this error if some one has updated the file in CVS after you have checkout the file. So save your changes and then checkout the same latest file and apply your changes and check-in, it should work.
Please let me know if you still encounter this issue, mail me @ rahamat_234@yahoo.com


Similar Exceptions:

- cvs server: Up-to-date check failed for `Web-content/WEB-INF/struts-config.XML
- cvs server:Up-to-date check failed for 'team/test/MyTest.java



Monday, April 18, 2011

Could not find End Of Central Directory



Problem:
This is one of the Common Exceptions which we come across almost daily in our lives. When i was trying to run a unix command which requires a zip file to a processed.

Exception i encountered was:
"'/nfs/home/ttipton/vig/04-15/UpdatedmiuExport.zip' could not be processed. [Could not find End Of Central Directory]"

Solution:
The real culprit for this exception was that the zip file was around 3 gb of size and unix wasn't able to unzip it before processing it. I unzipped the files onto my local system and split it into three zip files of 1 gb each. This way the zip file can be unzipped appropriately and will not cause any issue.


Similar Exceptions:


- End-of-central-directory signature not found. Either this file is not a zip file, or it constitutes one disk of a multi-part archive
- Error opening file [file path] Could not find End Of Central Directory



Tuesday, October 26, 2010

invalid element "{http://schemas.xmlsoap.org/wsdl/}definitions" in configuration file (line 2)



Problem:
This is one of the Common Exceptions which we come across daily in our lives. When i was trying to run wscompile command to generate java client classes from a WSDL file.

Exception i encountered was:
"invalid element "{http://schemas.xmlsoap.org/wsdl/}definitions" in configuration file (line 2)"

Solution:
The real culprit for this exception was config.xml file. I just copy pasted the complete WSDL file into the config.xml file instead of just refering WSDL file.

For example:
Syntax for Config.xml file:

*******************************************************************************************************************************************************************

The wscompile command reads the config.xml file, which has the information about web service. This is how config.xml file looks:

<?xml version="1.0" encoding="UTF-8"?>
<configuration
xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
<service> or <wsdl> or <modelfile>
</configuration>
The <configuration> element may contain exactly one <service>, <wsdl>, or <modelfile> element.

The <service> Element

If you specify this element, wscompile reads the service endpoint interface that describes the service and generates a WSDL file. In the <interface> subelement, the name attribute specifies the service endpoint interface, and the servantName attribute specifies the class that implements the interface. For example:

<service name="CollectionIF_Service"
targetNamespace="http://echoservice.org/wsdl"
typeNamespace="http://echoservice.org/types"
packageName="stub_tie_generator_test">
<interface name="stub_tie_generator_test.CollectionIF"
servantName="stub_tie_generator_test.CollectionImpl"/>
</service>
The <wsdl> Element

If you specify this element, wscompile reads the service's WSDL file and generates the service endpoint interface. The location attribute specifies the URL of the WSDL file, and the packageName attribute specifies the package of the classes generated by wscompile. For example:

<wsdl
location="http://tempuri.org/sample.wsdl"
packageName="org.tempuri.sample" />

The <modelfile> Element

This element is for advanced users.

If config.xml contains a <service> or <wsdl> element, wscompile generates a model file that contains the internal data structures that describe the service. If you've already generated a model file in this manner, then you can reuse it the next time you run wscompile. For example:

<modelfile location="mymodel.xml.gz"/>

*******************************************************************************************************************************************************************

Command:
java com.sun.xml.rpc.tools.wscompile.Main -gen:client -d <<Give the destination folder>> <<config.xml>> C:\Rahamat\Axis\wscompile\config.xml

Similar Exceptions:
     - Exception Occured invalid element "{http://schemas.xmlsoap.org/wsdl/}definitions" in configuration file (line 2)

Wednesday, May 5, 2010

java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL



Problem :
We come across this exception when DB connection is involved. This is the issue when we migrate DB from Oracle 9i to 10g.

Exception I Encountered Was :

============================================================================================
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL>
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)>
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)>
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:1353)>
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:195)>
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:165)>
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <at com.hp.smartquote.standalone.SQStandaloneConnectionFactory.getConnection(SQStandaloneConnectionFactory.java:54)>
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <at com.hp.smartquote.standalone.SQStandaloneUtil.getConnection(SQStandaloneUtil.java:155)>
<May 5, 2010 9:43:16 AM GMT> <Notice> <StdErr> <BEA-000000> <at com.hp.smartquote.standalone.SQStandaloneUtil.getUserRecord(SQStandaloneUtil.java:88)>
============================================================================================

Solution:

In my code after setting all the default connection properties i was setting caching properties. This was causing the exception. When i deleted this part from code it started working fine. Hope it works for you too. For detailed explanation see the example too.

Example:
My Java file for connection was SQStandaloneConnectionFactory.java.
In this file i was setting the cache properties as:
===================================================================
dataSource.setConnectionCachingEnabled(true);
Properties cacheProps = new Properties();
cacheProps.setProperty("MinLimit", "1");
cacheProps.setProperty("MaxLimit", "6");
cacheProps.setProperty("InitialLimit", "1");
cacheProps.setProperty("ConnectionWaitTimeout", "6");
cacheProps.setProperty("ValidateConnection", "true");
dataSource.setConnectionCacheProperties(cacheProps);
====================================================================
I Just removed this properties from my code and it started working fine.

Similar Exception:
- Invalid Oracle URL specified error during startup
- ORA-17067: Invalid Oracle URL specified