14 December 2009

Glassfish v3 and NetBeans 6.8

Finally they are out but after using the combo, I have realized that the best integration of both was glassfish v2.1 and netbeans 7.1.

The new combo has got some troubles in integration I think (or I may be doing something wrong!). Whenever I try to restart the glassfish from netbeans, it stops but does not start properly, when browsing an application I get blank pages. Again I stop the server and start it from the console it works fine.

Creating virtual server is still a nightmare as it was in Beta release of GF.

Keep getting this exception in server log all the time:
SEVERE: PWC3989: An exception or error occurred in the container during the request processing
java.lang.ClassCastException: com.sun.grizzly.config.ContextRootInfo cannot be cast to org.apache.catalina.Context
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:511)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:273)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.comet.CometEngine.executeServlet(CometEngine.java:473)
at com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:341)
at com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:84)
at com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:161)
at com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:137)
at com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:88)
at com.sun.grizzly.http.TaskBase.run(TaskBase.java:189)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
 One reason may be enabling the Comet support in GF, but no exact idea.

Don't put anything unknown inside C:\Program Files\sges-v3\glassfish\domains\domain1\docroot, you'll start receiving this warning and any JSP application will stop working.

WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required
        at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:89)
        at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:375)
        at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
        at org.apache.jasper.compiler.Jsr199JavaCompiler.compile(Jsr199JavaCompiler.java:200)
        at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:380)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:449)
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:620)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.comet.CometEngine.executeServlet(CometEngine.java:473)
        at com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:341)
        at com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:84)
        at com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:161)
        at com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:137)
        at com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:88)
        at com.sun.grizzly.http.TaskBase.run(TaskBase.java:189)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Unknown Source)
 Waiting for the fixes!!

11 December 2009

tormac.info++

tormac.info is a torrent search engine which uses Google custom search service to search 250+ torrent sites.
Created it after getting frustrated jumping from one torrent site to another site for a video.


It also displays latest feeds updated on a few torrent sites.

News:
  • Netbeans 6.8 and Glassfish v3 released today.
  • Got a new 1.4kva UPS
  • updated natmac.org home page

18 November 2009

General Problems encountered when parsing RSS or ATOM feeds

RSS and ATOM are XML specifications for web syndication. 9am completely depends on RSS/ATOM feeds discovered on the web, it uses Argotic Syndication Framework .Net library for parsing the feed, it is able to do the job most of the time, but whenever it encounters an unwanted element in the feed it throws an exception, which is expected. But my question is why these unwanted elements are there at first place? Have a look at these two RSS 2.0 feeds:

<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Liftoff News</title>
<link>http://liftoff.msfc.nasa.gov/ </link>
<description>Liftoff to Space Exploration.</description>
<language>en-us</language>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss </docs>
<generator>Weblog Editor 2.0</generator>
<managingEditor>editor@example.com</managingEditor>
<webMaster>webmaster@example.com</webMaster>
<item>
<title>Star City</title>
<link>http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp </link>
<description>How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's Star City </description>
<pubDate>Tue, 03 Jun 2003 09:39:21 GMT</pubDate>
<guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573 </guid>
</item>
</channel>
</rss>
Listing 1

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<item>DDI NEWS</item>
<link>http://www.ddinews.com </link>
<description>The latest news from Doordashan news - India's largest broadcaster</description>
<copyright>Copyright: (C) Doordarshan News</copyright>
<item>
<title>Climate talks make progress, pressure on US </title>
<description>Environment ministers made progress on Tuesday towards a scaled-down climate deal in Copenhagen next month, with Washington facing pressure to promise deep cuts by 2020 in greenhouse gas emissions. </description>
<link>http://www.ddinews.gov.in/Homepage/Homepage+-+Headlines/Climate+talks+make+progress.htm</link>
<pubDate>11/18/2009 1:53:18 PM</pubDate>
</item>
</channel>
</rss>
Listing 2

Listing 1 shows the correct format of an RSS 2.0 feed. Listing 2 is incorrect since tag <item> is there after tag <channel> which is not the right place for <item> tag. Argotic Syndication Framework throws an exception for the Listing 2 and doesn't parse it further.

This is one of the problems which I have observed along with the following:
1. Tag <language> missing or most of the time it has value "en-us" no matter what is the language used in the feed.
2. Tag <pubDate> is missing or having some wrong value.
3. Mismatch between the actual format of the feed and the format declared in <rss version="??"> tag.
4. Description is missing.
5. Feed Title is missing.
6. Item Title is missing ...most stupid and irritating.
7. Incomplete/Relative url in <link> tag
These are a few problems which I have seen with the web feeds, although I am talking about only RSS 2.0 here, similar problems can be imagined with ATOM/BLOGML and other syndication formats.

15 November 2009

PITA 5: NetBeans 6.8 Beta & Glassfish v3 Problems!

Installed NetBeans 6.8 Beta last week, firstly I had some trouble creating virtual server:
Cause: Unable to create a new instance of 'com.sun.faces.application.resource.ResourceHandlerImpl': java.lang.NullPointerException
had to use default virtual server.

and now after a glassfish update last night, I am not able to build, deploy and undeploy any web app on glassfish. Keep getting this in server log:
org.apache.catalina.LifecycleException: PWC2769: Manager has not yet been started
at org.apache.catalina.session.StandardManager.stop(StandardManager.java:892)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:5383)
at com.sun.enterprise.web.WebModule.stop(WebModule.java:531)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5211)
at com.sun.enterprise.web.WebModule.start(WebModule.java:500)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1604)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:337)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:340)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:163)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:619)
|#]
org.apache.catalina.LifecycleException: java.lang.NullPointerException
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5216)
at com.sun.enterprise.web.WebModule.start(WebModule.java:500)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1604)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:337)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:340)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:163)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at org.glassfish.deployment.common.ClassDependencyBuilder.getAnnotatedClasses(ClassDependencyBuilder.java:57)
at org.glassfish.deployment.common.ClassDependencyBuilder.computeResult(ClassDependencyBuilder.java:41)
at org.glassfish.web.loader.ServletContainerInitializerUtil.checkAgainstInterestList(ServletContainerInitializerUtil.java:405)
at org.glassfish.web.loader.ServletContainerInitializerUtil.getInitializerList(ServletContainerInitializerUtil.java:313)
at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:5258)
at com.sun.enterprise.web.WebModule.callServletContainerInitializers(WebModule.java:551)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5190)
... 37 more
|#]
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.NullPointerException
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:932)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1604)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:337)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:340)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:163)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:619)
|#]
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.NullPointerException
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:118)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:337)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:340)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:163)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:619)
|#]
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.NullPointerException
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:118)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:337)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:340)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:163)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:619)
|#]
|#]
|#]

For now I am using Tomcat and waiting for final release of glassfish v3.
Also I keep getting following error all the time whenever I try to edit a jsp file in NB:
java.lang.NullPointerException
at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport$4.propertyChange(BaseJspEditorSupport.java:176)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
at org.openide.text.CloneableEditorSupport.firePropertyChange(CloneableEditorSupport.java:527)
at org.openide.text.CloneableEditorSupport.fireDocumentChange(CloneableEditorSupport.java:2320)
at org.openide.text.CloneableEditorSupport.closeDocument(CloneableEditorSupport.java:2201)
at org.openide.text.CloneableEditorSupport.access$2500(CloneableEditorSupport.java:123)
at org.openide.text.CloneableEditorSupport$StrongRef.run(CloneableEditorSupport.java:2681)
at org.netbeans.modules.openide.util.ActiveQueue.run(ActiveQueue.java:64)
[catch] at java.lang.Thread.run(Thread.java:619)

Hope this too gets resolved in final 6.8 release.

26 October 2009

PITA 4: MySQL Error Messages

Today while connecting to my DB Server, I got a strange error message:
Got error 28 from storage engine
Tried to check the .err file located in var/lib/mysql (Xubuntu), couldn't open the file, when checked, the file size was more than 50GB.

This was the reason of the above error (No free space on the disk to write!). Stopped MySQL server and deleted the .err file. After starting the server I checked the file for errors and found this error repeated for millions times:
091026 ***** InnoDB: Error: page ***** log sequence number * *********
InnoDB: is in the future! Current system log sequence number 0 330424282.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/mysql/en/backing-up.html for more information.
Since I copied the complete data folder from one computer to another, the log files for InnoDB got corrupted. I could not restore them.

The only option I had to avoid any data loss or corruption was to change the Engine type to MyISAM, which doesn't look for log files and can be repaired with less effort.

04 October 2009

Lucene and MySQL (Correction!)

NOTE: This is just a correction post of Lucene and MySQL, please read that before running the following code.

In my
public void GetSqlData() {
        String IndexStoreDir = "F:/NewsIndex";      
        StandardAnalyzer analyzer = new StandardAnalyzer();
        Connection con = null;
        Statement stmt = null;
        ResultSet rs=null;
        try {
            String connUrl = "jdbc:mysql://localhost:3306/SQLDb"; 
           // put your mysql database name in place of SQLDb
            Connection con = DriverManager.getConnection(connUrl, "root", "SQLPassword");
           // put your mysql password in place of SQLPassword
            stmt = con.createStatement();
            Class.forName("com.mysql.jdbc.Driver");
            stmt.executeQuery("select * from table");
            IndWri = new IndexWriter(IndexStoreDir, analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED);
            int numberOfUpdates=0;
            rs = stmt.getResultSet();

            while (rs.next()) {
                Document docu = new Document();
                Field title= new Field("title", rs.getString("title"), Field.Store.YES, Field.Index.ANALYZED);
                Field content= new Field("content", rs.getString("content"), Field.Store.YES, Field.Index.ANALYZED);
                docu.add(title);
                docu.add(content);
                IndWri.addDocument(docu);
            }
            IndWri.close();
           
        } catch (Exception ex) {
        }
        finally {
            if(rs!=null){try{rs.close();} catch(Exception ex2){}}
            if(stmt!=null){try{stmt.close();} catch(Exception ex1){}}
            if(con != null){try{con.close(); }catch(Exception e){}}

        }
    }


There is no need of addDoc() method. In previous case the index was getting created for (number of fields)*(number of records) number of docs because every time addDoc() method was called which created a new document for a field.

PITA 3: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

I was trying to update around 70k records in a MySQL table through a loop, and kept getting the following exception after 16k+ records:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.

Tried everything which I could get on the web, but nothing happened. Few suggestions which I found on the web are:

1. replace localhost with 127.0.0.1 in MySQL connection string... In some cases this works because Windows Defender removes localhost entry from C:\Windows\system32\drivers\etc\hosts file therefore MySQL won't be able to resolve the host and throw that exception.

2. modify registry to connect from TCP ports greater than 5000... this also didn't work for me, you can see the opened connection by typing the command netstat -b.
Details about this are given here http://support.microsoft.com/kb/196271

3. add wait_timeout = X in my.ini (or my.cnf on *nix env.)... this will help if you have problems with MySQL itself, for that check MySQL error log located in mysql Data directory. If you have any errors about connections setting wait_timeout may help, but in my case there are no errors from MySQL site.

How did I resolve it??... Instead of processing all the records in one execution I processed only 1000 records at a time.

However the exact reason is still unknown.

14 September 2009

PITA 2: Edit my.cnf file in Ubuntu

I tried to bind the local machine's global address to allow the remote connections for mysql (5.1) in my.cnf file, it kept giving me:
Error: no write permission for file "my.cnf"
tried edit etc/mysql/my.cnf and
gedit etc/mysql/my.cnf also tried to change the permission of the file and the mysql folder by chmod with no success.

Until I found out putting sudo is necessary before every command if the user account is not root.
http://ubuntuforums.org/showthread.php?p=7077569

Used sudo
gedit etc/mysql/my.cnf and it worked.

29 August 2009

Feed Crawler Revisit Policy

Every crawler has some revisit policy for crawling a web document. If a web site changes very frequently, the crawler will try to visit the site more than a web site which does not change so frequently, for example a crawler will be more interested in a news site than a static About Us page. This saves time for the crawler and avoids unwanted traffic for the web servers.

A feed crawler is crawler which tries to get the data from web site feeds, which may include: rss, atom, blogml etc. A feed crawler should expect more rapid changes than a normal web crawler and also it should penalize the slow changes. I have used an exponential function to implement the revisit policy for my feed crawler. Following graphs show three different functions which can be used as a revisit policy:
Definitions:

nd : Number of days to wait till next visit
x : Number of visits without a feed update (Blank Visits)
lc : Last Change (or Update)
nv : Next Visit
lv : Last Visit
s: staleness

Function 1: nd = 2(x+1)/x

Function 2: nd = x2-2*x+k

Function 3: nd = ex/2*x

The revisit algorithm works in following way (for Function 3):
s=lv-lc;
IF (s==0)
THEN nv=TOMORROW;
ELSE nv=TODAY + ex/2*x --(any function can be used!)
If a feed is not updated after a certain number of visits the crawler should assume the feed as a dead feed and stop visiting that page. Also if a feed gets updated after certain time after some blank visits (say y), next visit can be calculated in following way (for Function 3):
nv= TODAY + e(y-1)/2*(y-1)
Example: Take Function 2: x2-2*x+k (say k =3)

If a feed is updated after 5 blank visits, then: y=5;
F(y-1)= (y-1)2-2*(y-1)+3
= (5-1)2-2*(5-1)+3
=16-8+3=11
so next visit will be after 11 days.

If a feed is not updated after 5 blank visits, then: k=3 & y=5;
F(y) = (y)2-2*(y)+3
= (5)2-2*(5)+3
=25-10+3=18
now next visit will be after 18 days.

25 July 2009

Lucene and MySQL

I read about the full text search provided by MySQL over the web and had to look for a better option for indexing my data which grows everyday. Sphinx looked a better choice but the Java api is not fully mature yet so I had to choose Lucene which takes little more time than Sphinx in displaying the search results but is far better than MySQL full text search, comparison is given here. In some cases Lucene outperforms other two. Other advantage of Lucene is its sub-projects like: Solr, Compass, Nutch etc.

Here is the sample code for indexing the MySQL data: (Please find the corrected code here for the method getSqlData())

 
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.TopDocCollector;
import java.sql.*;
import java.io.IOException;

/**
*
* @author viksin
*/
public class LuceneImp {

public void getSqlData() {
   String IndexStoreDir = "F:/LuceneIndex";
   ResultSet rs;
   StandardAnalyzer analyzer = new StandardAnalyzer();
   IndexWriter writer = null;

   try {
       String connUrl = "jdbc:mysql://localhost:3306/SQLDb"; 
        // put your mysql database name in place of SQLDb
       Connection con = DriverManager.getConnection(connUrl, "root", "SQLPassword");
       // put your mysql password in place of SQLPassword
       Statement stmt = con.createStatement();
       Class.forName("com.mysql.jdbc.Driver");
       stmt.executeQuery("select * from table");
       writer = new IndexWriter(IndexStoreDir, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
       rs = stmt.getResultSet();
       while (rs.next()) {
      
           addDoc(writer, "title", rs.getString("title"));
           addDoc(writer, "content", rs.getString("content"));

       }
       writer.close();
       rs.close();
       stmt.close();
   } catch (Exception ex) {
   }
}

private static void addDoc(IndexWriter w, String field, String value) throws IOException {
   Document doc = new Document();
   doc.add(new Field(field, value, Field.Store.YES, Field.Index.ANALYZED));
   w.addDocument(doc);
}
}

If you want to add a new sql row to an existing index replace true with false in the following line and run the above program.
 writer = new IndexWriter(IndexStoreDir, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);

You can put a column in the sql table (a flag) for checking and updating the indexing status of the row. In that case the you'll have to add following lines in the above code:
int indexStatus = 0;            
while (rs.next()) {
                indexStatus = rs.getInt("isindexed");
                if (indexStatus != 1) {
                    addDoc(writer, "title", rs.getString("title"));
                    addDoc(writer, "content", rs.getString("content"));
                    addDoc(writer, "link", rs.getString("link"));
                    addDoc(writer, "source", rs.getString("source"));
                    updateIndexStatus(rs.getString("id"));
                }

updateIndexStatus method will look like this:
            
    private static void updateIndexStatus(String Id) {
        try {
           String connUrl = "jdbc:mysql://localhost:3306/SQLDb"; 
           // put your mysql database name in place of SQLDb
           Connection con = DriverManager.getConnection(connUrl, "root", "SQLPassword");
           // put your mysql password in place of SQLPassword
            Statement stmt = con.createStatement();
            Class.forName("com.mysql.jdbc.Driver");
            stmt.executeQuery("update table set isindexed='1' where id="+Id+"");
            stmt.close();
        } catch (Exception ex) {
        }
    }

For searching your index this method can help:
 private static void searchIndex() {
      StandardAnalyzer analyzer = new StandardAnalyzer();
      String qu = "Java and Linux"; // put your keyword here
      String IndexStoreDir = "F:/LuceneIndex";
      try {
          Query q = new QueryParser("title", analyzer).parse(qu);
          int hitspp = 100; //hits per page
          IndexSearcher searcher = new IndexSearcher(IndexStoreDir);
          TopDocCollector collector = new TopDocCollector(hitspp);
          searcher.search(q, collector);
          ScoreDoc[] hits = collector.topDocs().scoreDocs;
          System.out.println("Found " + hits.length + " hits.");
          for (int i = 0; i < hits.length; ++i) {
                int docId = hits[i].doc;
                Document d = searcher.doc(docId);
                System.out.println((i + 1) + ". " + d.get("title"));
            }
            searcher.close();
        } catch (Exception ex1) {
        }
    }

Or you can use Luke for browsing index created by Lucene.

13 June 2009

Phenom II X4 940 BE Temperature Analysis

Little Overclocking and you'll hit the Max Temperature allowed for Phenom II X4 940 BE which is 62°C. I hit that temperature when I overclocked to 3.6 GHz with 1.4 V. Cool'n'Quiet helps in decreasing the CPU temperature by 5-6°C. My current idle temperature is 39°C-45°C with Cool'n'Quiet enabled and full load temperature goes upto 55°C (with playing FarCry2). Here is the analysis (using Biostar TA790GX 128MB):



Figure 1 (Y-axis: Temperature in °C, X-axis: Time in Mins)

Figure 1 shows the temperature for 3 different cases:
  • No Overclocking + Cool'N'Quiet enabled (Blue Line)
  • OCed to 3.4GHz + Cool'N'Quiet disabled + stock voltage (Red Line)
  • No Overclocking + Cool'N'Quiet disabled (Green Line)
Ran the test for one hour for each setting. The maximum temperature I hit was 55°C under full load and the lowest temperature was 39°C. My room temperature stays between 25-35°C so idle CPU temperature is not bad but its not good either. With stock CPU cooler I'll suggest to enable the cool n quiet feature. And if you want to overclock, don't exceed more than 3.4GHz, because that's the max you can go with the stock voltage. The Figure 2 shows the % of CPU usage in three conditions I mentioned above.



Figure 2

When OCed the CPU usage doesn't go more than 60%, but in case of Cool N Quiet enabled the CPU usage is around 90% most of the time.

Opening the case (CoolerMaster CM 690) from both the sides decreases the CPU temperature by 5°C and idle temperature hovers around 34°C-40°C (Figure 3). Will put more fans to improve the air flow, also will apply a new thermal paste some time soon. I am expecting an idle temperature around 30°C.

Figure 3

Here are a few screen shots of CPUID HWMonitor, CoreTemp64, CPU-Z:









07 June 2009

Overclocking Phenom II 940BE with Biostar TA790GX 128MB

I tried the Automate OverClock given in the Bios but it didn’t work, kept getting the blue screens on Vista x64. Tried to get the info about manual overclock option on the Google with no luck. Therefore I explored all the options which were available in the Bios. Here is how to over clock Phenom II 940 by increasing the Multiplier: (Will show how to overclock upto 3.6Ghz)

Step0: Disable Cool N Quiet in the Bios



Step1: Go to your bios T-Series tab, select Manual OverClock option



Step2: Click on the CPU FID/UID Control and Enable the Custom P-States



Step3: Select a Core FID



Note: Select a multiplier which your system can handle, higher multiplier means higher frequency hence it requires higher voltage which means higher CPU temperature. You need a very good cooling system (Cabinet!) for keeping your CPU temp low at higher frequencies.

Step4: Select a suitable voltage according the frequency selected in Step3 by clicking on the Core VID on the same screen. For 3.6Ghz select a voltage 1.4000V or little high but not very high.
Note: Over Clocking reduces the CPU life because of high voltage and temp. So if you want your CPU to last long (5+ years) don't go for over clocking.

24 May 2009

Crysis Ends

Finished playing Crysis, it was a great fun ride with a lot of action and also with a last moment crysis. Last level of Crysis has got a huge memory leak, it starts using 100% RAM and hangs. Patch 1.2 helps and running the game in DX 9 mode improves performance. This is how to set the Crysis in DirectX 9 mode: Open the Game Explorer (Vista) and right click on the Crysis icon.



The game is smaller than I expected, I was thinking in the line of FarCry but still it was fun playing Crysis. Downloading Crysis Warhead. One screenshot from last level of Crysis:



Also finished playing NFS Undercover, it is similar to Carbon, but again its just another NFS (Let me forget the Prostreet Horror!).

19 May 2009

State of Broadband in India

Today I received a surprise call from my Broadband provider, Tata Indicom. The person on the other end talked about their new Fair Usage Policy for those who have unlimited plans. The details of this policy are given here. The Indicom guy said that it was forced by the government (a lie!!). I have an unlimited 384Kbps plan, now according to this policy I can not upload+download more than 70GB (limitation!). I wonder if both speed and data transfer are restricted, why they call it an unlimited plan. On asking the same question from the Indicom guy, he said that this policy enables other users to use the Internet fairly (I use it unfairly!).

I have around 200GB in the downloading queue and with these restrictions in the place it will take around 4 months to download (not to forget the downtime and power cuts!). I can not get rid of Tata Indicom because Airtel does not cover my area (heard they also have similar policy!), Reliance broadband is worse than Indicom, BSNL guys are deaf and they don't really care about a thing in the world (govt employees!). Other option, USB Modems is another nightmare, never heard a good thing about them. Only BSNLs EVDO is good (based on rumours!) but again its availability and support is NIL in the Indian IT Hub.

To be frank, India (
a third world country!!) is still far behing in this field, we pay huge amounts to get nothing but headache in the name of broadband. Lets pray that one day after hundred years we'll get an unlimited 32 Mbps connection.

Here are my speedtest results:



And I pay 1100+ Rs. for this, which works 15 days a month and 15 hrs in a day.

18 May 2009

Gaming Begins

I bought my first PC in 2004 having configuration: 2.5 Gz P4, 128MB of RAM, 40 GB HDD, CD-R, 15'' Monitor. With 16 MB shared graphics I was left with 112MB of RAM but the worst part was its SiS chipset which is known for its bad graphics and also a 4x AGP slot (not 8x !) and with this combination gaming was just a dream. However in 2007 I did a full upgrade with 1GB RAM (Max supported!), an Nvidia FX 5 series 8x 256 MB card and a 160 GB hard drive, this enabled me to play the games which were released in 2005 or before. This was a branded PC from Compaq IL-5030 Series.

This time I decided to assemble a PC with my configuration, which can play latest games coming out in the market as well as next two years games with a little part upgrades. So I went for this configuration:

AMD Phenom II X4 940 BE
ATI 4870 1 GB DDR5
4GB DDR2 800 MHz (will upgrade to 8GB soon!)
Biostar TA 790GX 128MB Mobo with Crossfire (I can put one more Gfx Card :D)
500GB HDD + 320GB (Ext) + 500GB (Ext) - will add another 1.5 TB internal HDD
Here are a few screenshots of NFS Undercover (with 1440x900 @ 75 Hz):







Click on the image to see the full resolution image. FYI currently I am playing NFS and Crysis.

17 May 2009

Re-Turn

After a big confusion between Wordpress and Blogger I had to come back here. Since I rarely write anything, I have decided not to use any of the seven domain names I own. Wordpress (endex.wordpress.com) was my first choice but after coming across its limitations, I had to choose Blogger. My other two sites vikasing.com and viks.in will be redirected here.