Monday, July 13, 2009

Weblogic 10 java.lang.ArrayIndexOutOfBoundsException: 110162

I was having a frustrating problem (see stack trace below) when deploying a spring-security enabled application on weblogic over the last couple of weeks, and was having extreme difficulties tracking down the issue.

My codebase is using jaxen (via spring-security-core), which caused "java.lang.ArrayIndexOutOfBoundsException: 110162" on weblogic deployment. Jaxen comes with a whole heap of transitive dependencies.

The solution for me was to exclude all jaxen transitive dependencies:
* dom4j.dom4j
* jdom.jdom
* xerces.xercesImpl
* xml-apis.xml-apis
* xom.xom

Hope this helps someone else in the world. It certainly frustrated me for a considerable amount of time.

< 13/07/2009 11:41:58 AM EST> < obEnterpriseServerJRockit> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1247449318795> java.lang.ArrayIndexOutOfBoundsException: 110162
at serp.bytecode.lowlevel.ConstantPoolTable.readUnsignedShort(ConstantPoolTable.java:88)
at serp.bytecode.lowlevel.ConstantPoolTable.readUnsignedShort(ConstantPoolTable.java:153)
at org.apache.openjpa.lib.meta.ClassAnnotationMetaDataFilter.matches(ClassAnnotationMetaDataFilter.java:67)
at weblogic.application.utils.ClassFinderMetaDataEnumaration.hasMoreElements(ClassFinderMetaDataEnumaration.java:55)
at weblogic.servlet.internal.WebAnnotationProcessorImpl.getAnnotatedClasses(WebAnnotationProcessorImpl.java:127)
at weblogic.servlet.internal.War.getAnnotatedClasses(War.java:774)
at weblogic.servlet.internal.War.getAnnotatedClasses(War.java:755)
at weblogic.servlet.internal.WebAppHelper.processAnnotations(WebAppHelper.java:112)
at weblogic.servlet.internal.WebAppHelper.(WebAppHelper.java:57)
at weblogic.servlet.internal.WebAppServletContext.(WebAppServletContext.java:402)
at weblogic.servlet.internal.WebAppServletContext.(WebAppServletContext.java:452)
at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:402)
at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:582)
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:298)
at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:360)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:56)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:46)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:147)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:189)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:87)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:719)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1186)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:157)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:464)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)

Wednesday, March 25, 2009

Java Mail - SMTP Transport Provider - Apache CXF

I just recently ported from Codehaus XFire to Apache CXF.

There's lots of little gotchas in that migration process. One problem is that existing libraries that worked, might not work now because CXF depends on a whole heap of libraries that could be identical to older/newer versions of libraries your project is already depending on. You might get some ClassNotFound exceptions, etc ... it's probably because you've got multiple instances of it sitting in your jars.

One of these annoying gotchas has to do with the mail api. CXF includes a whole heap of geronimo libraries out of the box. One of them it requires is geronimo-javamail_1.4_spec (v1.3). This overrides javamail. v1.3 is old. There is also a bug with SMTPS in this version since the provider class name is called by the name "SMTPTSransport" which is obviously a spelling problem. Secondly, the provider classes are not automatically pulled back by Maven (since they don't seem to be defined in the pom properly).

The way around this is to include the following maven dependencies in addition to your CXF maven dependencies:
* org.apache.geronimo.specs.geronimo-javamail_1.4_spec:1.7
* org.apache.geronimo.javamail.geronimo-javamail_1.4_provider:1.6

The providers miraculously become available, and your code fires up again.


Just another tip for those that fight the endless cycle of dependency and classloader problem resolution. Hope it helps someone.

Wednesday, January 14, 2009

Macbook Pro 17" - Battery Exploded

Apple strikes again ... nothing more to say really, except: I need contents insurance!



Wednesday, January 07, 2009

Plagiarism at it's best

http://www.smh.com.au/news/national/students-uni-assignments-used-in-scam/2009/01/06/1231004022935.html

Tuesday, November 18, 2008

JVM Tuning, Performance and Allocation

This is an excellent article, initially around JVM tuning but more specifically about the state of memory management, thread allocation, detecting positive and false positive memory leaks due to application/session scoped attributes, and much more.

One of the cleanest articles I've read in a while.

http://www.javaworld.com/javaworld/jw-06-2006/jw-0619-tuning.html?page=1

A few bits of feedback for it though
* The diagrams could do with legends around what the circles mean
* A section on diagnostic tools and utilities would be good, eg JStat, JProbe, YourKit Java Profiler, etc...

Sunday, November 09, 2008

XML Charts - Some cool updates

XML SWF charts got an upgrade. Really like the look of these charts now. Nice work.

XML Charts

Saturday, October 25, 2008

New Macbook 13" Display Corruption - Hard Reset Required

So there are a lot of people with issues with the new glossy Macbook screen. Lots of people have reported washed out colours, and sub par display quality.

Considering I'm an avid Macbook Pro fan, it's hard to move backwards in the world to a Macbook. I can't hack the resolution, and argh, why would ANYONE want a glossy finish to their LCD? Bring back matte (there's a slogan in that)!

Anyway, my biggest issue with the new Macbook (up until now) has been using the multi-touch trackpad, which serves three purposes: 1) it's a button 2) it provides movement 3) it does the funky spinning and enlarging of items in windows, thing. I just can't get the hang of it (and I'd fit myself quite snugly into the nerd category). It's probably just a "improves over time" thing, but my fingers keep getting tangled.

The other night something ghastly happened. My wife was using her Macbook, and she thought she was in the 1980's again. You know those old CRT TV's, the ones where you had to smack them on the side to correct the display every 20 or 30 minutes, when they were spitting static through the rear speaker dome? Well a similar thing happened. Check out the pics:




So my wife hard resetted the mac (heaven forbid!) [EDIT: twice - thanks for the clarification!], and everything was ok again. This is obviously some corruption in the display drivers, but errrk! That's TERRIBLE! Looking forward to downloading the first firmware update for the macbook 13". There's a few obvious things that need fixing.


The other thing that absolutely bugs me: out of the box OSX tries to log the current user out of their account after X seconds of inactivity. This is an absolutely stupid feature, and should be fixed up as part of the default build.

In summary:
There are obviously some teething issues with the new Macbook. I'm hoping that this is money well spent. Or should I trade it in for an old 15" Macbook Pro? I'll be watching the first couple of firmware/driver updates very carefully!


EDIT: Happened repeatedly today: 30/10/2008. I guess this is a hardware fault afterall. Time to call up and take this baby back to factory.



The new Macbook 13"

EDIT 2: After running apple diagnostics this was the result (31/10/2008 1pm):





Final:
Returning as Dead on Arrival. Apple Staff were helpful.

Lesson learned:

Don't buy your mac from the online apple store. It is MUCH better to get face to face contact with a sales rep, so that in a case similar to mine, you can go to the store and have it swapped over straight away by the Apple store or qualified Apple Reseller. They'd also do a harddrive copy as well, whereas in my scenario I'm gonna have to go and buy a big enough backup drive to do the backup myself and pay out of my own pocket and time to transfer everything over.

Monday, October 06, 2008

instantiate Podcast

New, pretty easy on the ears. A few nerds from downunder (me being one of them) have started a new podcast called instantiate.

Sign up, and listen in. We'll do one every now and then.

The instantiate Podcast

Friday, September 12, 2008

Macbook Pro - replaced with a 500g samsung drive!

On Wednesday night, I updated my Macbook Pro 2.33 Ghz, 4gb machine from a 160gb 5400rpm hd to a 5400rpm Samsung 500gb hd.

I never thought it would be so easy, but it was, with great thanks to http://www.ifixit.com/Guide/Mac/

One last thing to say about this - Mac OSX Leopard rocks. I've never done a harddrive replacement and restore in 4 hours before (on PC), but this time, with the help of TimeMachine - I'd replaced the harddrive performed a clean OS install and copied all files from backup in 4 hours. Unbelievable.

I'm telling you, Leopard is worth the $AU160 just for TimeMachine.

Just Brilliant.

SoapUI

http://www.soapui.org/ - Webservice Testing and Exploring

Just awesome!

Monday, September 01, 2008

Maven and multi-module JEE projects

Some really good links on this:
How to setup a JEE project using maven

To get a multi-module JEE Project working in eclipse, you will need to do one of two things:

1. Edit [ root ]/.classpath and add the classpath locations for each of your submodules, OR:
2. Add http://eclipse-tools.sourceforge.net/updates/ to your eclipse download configuration. Once done, try and install "Multi Project Import/Export Plugin". In MyEclipse you might have Pulse, and you may be able to find it in there. For usage instructions, see: Multi-module project in Eclipse

For information on how to use the multi-module project in Eclipse, read this: Multi-module project plugin

Friday, August 15, 2008

OSGi - How do I use it/implement it

An simple, short and dejargonised look into OSGi.

http://www.theserverside.com/tt/articles/article.tss?l=OSGiforBeginners

Monday, August 11, 2008

Setting up an internal maven repo proxy

http://www.theserverside.com/tt/articles/article.tss?l=SettingUpMavenRepository


Seems like an excellent article describing how to use artifactory.

I work for a telco, and we've previously used promimity. The box it was housed on has gone kaplonk, so I'm looking to set up a new one.

Friday, August 08, 2008

Maven Sucks

Good post about Maven, but backs maven a little more than it deserves!

Maven Sucks article

A checked-out resource is overdue, and will be destroyed: com.mchange.v2.c3p0.impl.NewPooledConnection@2d8ecc and Overdue resource check-out stackTrc

This post is for those, like me, who like to paste their problems into the google search box.

Problem

I was experiencing a problem with C3P0, Hibernate, PostgresQL, whereby after random periods of time (eg 1 minute, 20 minutes, 4 hours), I would get the following quoted exception stack.


INFO | jvm 1 | 2008/08/05 21:46:49 | 2008-08-05 21:46:49,000 [Timer-0] (BasicResourcePool.java:1392) INFO - A checked-out resource is overdue, and will be destroyed: com.mchange.v2.c3p0.impl.NewPooledConnection@2d8ecc
INFO | jvm 1 | 2008/08/05 21:46:49 | 2008-08-05 21:46:49,000 [Timer-0] (BasicResourcePool.java:1395) INFO - Logging the stack trace by which the overdue resource was checked-out.
INFO | jvm 1 | 2008/08/05 21:46:49 | java.lang.Exception: DEBUG ONLY: Overdue resource check-out stack trace.
INFO | jvm 1 | 2008/08/05 21:46:49 | at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:506)
INFO | jvm 1 | 2008/08/05 21:46:49 | at com.mchange.v2.c3p0.impl.C3P0 PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
INFO | jvm 1 | 2008/08/05 21:46:49 | at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:129)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1290)
INFO | jvm 1 | 2008/08/05 21:46:49 | at au.com.impulsestudios.theapp.surveillance.dao.SurTasksDAOExt.cancelTasksFromThePast(SurTasksDAOExt.java:160)
INFO | jvm 1 | 2008/08/05 21:46:49 | at au.com.impulsestudios.theapp.surveillance.taskmanagement.TaskExecutor.run(TaskExecutor.java:107)
INFO | jvm 1 | 2008/08/05 21:46:49 | at java.lang.Thread.run(Thread.java:595)
INFO | jvm 1 | 2008/08/05 21:46:49 | 2008-08-05 21:46:49,000 [Thread-17] (JDBCExceptionReporter.java:71) WARN - SQL Error: 0, SQLState: 08006
INFO | jvm 1 | 2008/08/05 21:46:49 | 2008-08-05 21:46:49,000 [Thread-17] (JDBCExceptionReporter.java:72) ERROR - An I/O error occured while sending to thebackend.
INFO | jvm 1 | 2008/08/05 21:46:49 | 2008-08-05 21:46:49,000 [Thread-17] (SurTasksDAOExt.java:168) ERROR - Error trying to cancel tasks from the past. See exception stack. org.hibernate.exception.JDBCConnectionException: could not execute update query
INFO | jvm 1 | 2008/08/05 21:46:49 | org.hibernate.exception.JDBCConnection Exception: could not execute update query
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:334)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:209)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1126)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
INFO | jvm 1 | 2008/08/05 21:46:49 | at au.com.impulsestudios.theapp.surveillance.dao.SurTasksDAOExt.cancelTasksFromThePast(SurTasksDAOExt.java:163)
INFO | jvm 1 | 2008/08/05 21:46:49 | at au.com.impulsestudios.theapp.surveillance.taskmanagement.TaskExecutor.run(TaskExecutor.java:107)
INFO | jvm 1 | 2008/08/05 21:46:49 | at java.lang.Thread.run(Thread.java:595)
INFO | jvm 1 | 2008/08/05 21:46:49 | Caused by: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:214)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:300)
INFO | jvm 1 | 2008/08/05 21:46:49 | at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
INFO | jvm 1 | 2008/08/05 21:46:49 | ... 7 more
INFO | jvm 1 | 2008/08/05 21:46:49 | Caused by: java.net.SocketException: socket closed
INFO | jvm 1 | 2008/08/05 21:46:49 | at java.net.SocketInputStream.socketRead0(Native Method)
INFO | jvm 1 | 2008/08/05 21:46:49 | at java.net.SocketInputStream.read(SocketInputStream.java:129)
INFO | jvm 1 | 2008/08/05 21:46:49 | at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
INFO | jvm 1 | 2008/08/05 21:46:49 | at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:254)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1163)
INFO | jvm 1 | 2008/08/05 21:46:49 | at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
INFO | jvm 1 | 2008/08/05 21:46:49 | ... 12 more


Resolution

Make sure you have the correct postgresql java drivers installed for the version of postgresql you are deploying against! I was deploying against 8.2, but developing against 8.1. When I deployed I received the above errors. When I developed locally (on 8.1) I didn't.

After I fixed this up it worked like a charm.

PostgreSQL Driver Download Page

Friday, August 01, 2008

Growl

Got a MAC? Get growl. It is awesome. It provides you with desktop popup notifications for "all" your applications that support it. The design is fully customisable with themes and the ability to set the usual opacity/transparency.

I'm using it with conversation, firefox (seems to work OOTB), thunderbird (need to install a plugin), adium, and more.

Very useful, and helpful for me - someone who never has less than 20 windows open across 4 leopard screens :)

Tuesday, July 29, 2008

JNDI object with [java:/jdbc/xxxx] not found: JNDI implementation returned null

Getting this error?

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested @@exception is javax.naming.NameNotFoundException: JNDI object with [java:/jdbc/pgds] not found: JNDI implementation returned null


Have a look at my issue:
http://pastebin.com/f6bdf6331

Using MyEclipse? Deploying to Jboss?
Took me about a week to figure this one out.

Solution
You're probably deploying MyEclipse bundled jboss*jar libraries to the WEB-INF/lib directory. The Jboss AS classloader seems to pick up these libraries before the out of the box jboss ones. Looks like it was trying to bind the datasource to the wrong version of the DataSource classes. Removed them from Project Properties->Libraries and wallaaa, works.

I am now 40 gray hairs worse off, but it's worth it if this tip helps you. Let me know if it does.

Saturday, May 24, 2008

c3p0 with Java, Postgres and Hibernate

Works an absolute charm. I'm working on a java service that is polling gigs of data via webservices a day. There can be up to 30 webservice transactions per second. This puts a lot of weight on your database connections, particularly if you don't have database pooling.

I was running into an issue where my postgres conf had only granted the postgres daemon 30 non-superuser connections at any given time. Rather than increase the number of maximum connections (what would be the maximum anyway? realistically?) I wanted to hard limit the available connections through connection pooling, with all the obvious benefits of connection pooling. I also wanted to be able to track connection leaks - and the debug features within the library are certainly helpful.

Enter c3p0. What an absolute charm.

Read about it. You should know about it. I didn't.

Tuesday, March 11, 2008

Office 2007 Conundrum

http://www.smh.com.au/news/perspectives/when-standards-aint-standards/2008/03/11/1205125864040.html


Microsoft Office 2007 is a fabulous piece of software. It is not a minor upgrade, as most previous versions have been. It does everything much better. But, despite the fact that it's now been released for more than a year, hardly anybody is using it.

I deal with many people with whom I have to swap files all the time, and not one of them is using the vastly superior new version. I have to back-save everything I do into the vastly inferior old version.


What a conundrum. The writer of this article answered their own confusion in the second paragraph - why on earth does a piece of software require you to back-save? Versioning should be captured and automatically handled by some forward thinking on the software vendor's behalf!

I'm afraid the underlying inferiority is not older versions of office, but alas, office itself!

Friday, January 11, 2008

#1 Kiddie Book

Thanks to Mr Masson for the link to this one.

Apparently I'll be needing to purchase this book soon!

Baby Book Link

Wednesday, January 02, 2008

Installing languages for use in functions in PG DB

I spent a while on this one!

If you are trying to write PL/PGSQL and you can't figure out why your create function is failing with:

ERROR: language "plpgsql" does not exist


...it's because the PL/PGSQL language hasn't yet been installed against your database template.

Run the following command to install into your database....

createlang --username=postgres plpgsql [database]

There are actually heaps of other languages you can choose to use in your database to implement functions/SPs also.