Tuesday, July 14, 2009

Error in Tolven RC1 configPhase3 - ORA-00932

Running configPhase3.bat of Tolven RC1 (with Windows-OpenLdap/Oracle10g/Jboss) was causing errors.

The command prompt showed:
C:\tolven\tolven-RC1\bin>configPhase3.bat
0 [main] INFO root - Start log4j - Configuration: file:/C:/tolven/tolven-RC1/bi
n/tolven-log4j.xml, logFileName: C:\tolven\tolven-RC1\log\tolven.log
18:29:07,570 INFO [TPFBoot] Loaded configDir C:\tolven\tolven-config
18:29:07,695 INFO [TPFBoot] Generated boot.properties: C:\DOCUME~1\sachin\LOC
ALS~1\Temp\tpf_7376485784350116145_boot.properties
18:29:07,757 INFO [TolvenApplicationInitializer] logging system initialized
18:29:07,757 INFO [TolvenApplicationInitializer] application root is C:\tolven\
tolven-RC1\bin
18:29:08,023 INFO [PluginRegistryImpl] configured, stopOnError=true, isValidati
ng=false
18:29:08,132 INFO [ShadingPathResolver] configured, shadow folder is C:\tolven\
tolven-config\build\temp\.jpf-shadow
18:29:08,757 INFO [PluginRegistryImpl] plug-in and fragment descriptors registe
red - 117
18:29:08,804 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.library.jasperreports-0.0.1.zip has
been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/o
rg.tolven.library.jasperreports-0.0.1.zip for {PluginFragment: uid=org.tolven.li
brary.jasperreports@0.0.1} with key org.tolven.library.jasperreports
18:29:08,804 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.assembler.jboss.oracle-0.0.1.zip has
been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/
org.tolven.assembler.jboss.oracle-0.0.1.zip for {PluginFragment: uid=org.tolven.
assembler.jboss.oracle@0.0.1} with key org.tolven.assembler.jboss.oracle
18:29:08,804 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.library.jboss-0.0.1.zip has been rep
laced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/org.tolve
n.library.jboss-0.0.1.zip for {PluginFragment: uid=org.tolven.library.jboss@0.0.
1} with key org.tolven.library.jboss
18:29:08,804 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.assembler.jboss-0.0.2.zip has been r
eplaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/org.tol
ven.assembler.jboss-0.0.2.zip for {PluginFragment: uid=org.tolven.assembler.jbos
s@0.0.1} with key org.tolven.assembler.jboss
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.deploy.source-0.0.2.zip has been rep
laced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/org.tolve
n.deploy.source-0.0.2.zip for {PluginFragment: uid=org.tolven.deploy.source@0.0.
1} with key org.tolven.deploy.source
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.assembler.oracle.persistencexml-0.0.
1.zip has been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime
/plugins/org.tolven.assembler.oracle.persistencexml-0.0.1.zip for {PluginFragmen
t: uid=org.tolven.assembler.oracle.persistencexml@0.0.1} with key org.tolven.ass
embler.oracle.persistencexml
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.component.oracle.init-0.0.1.zip has
been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/o
rg.tolven.component.oracle.init-0.0.1.zip for {PluginFragment: uid=org.tolven.co
mponent.oracle.init@0.0.1} with key org.tolven.component.oracle.init
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.deploy.jboss-0.0.3.zip has been repl
aced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/org.tolven
.deploy.jboss-0.0.3.zip for {PluginFragment: uid=org.tolven.deploy.jboss@0.0.1}
with key org.tolven.deploy.jboss
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.component.application.oracle.indexes
-0.0.1.zip has been replaced with new file:/C:/tolven/tolven-config/repositoryRu
ntime/plugins/org.tolven.component.application.oracle.indexes-0.0.1.zip for {Plu
ginFragment: uid=org.tolven.component.application.oracle.indexes@0.0.1} with key
org.tolven.component.application.oracle.indexes
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.assembler.oracle.orm-0.0.1.zip has b
een replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/or
g.tolven.assembler.oracle.orm-0.0.1.zip for {PluginFragment: uid=org.tolven.asse
mbler.oracle.orm@0.0.1} with key org.tolven.assembler.oracle.orm
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.component.application.jboss-0.0.1.zi
p has been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plu
gins/org.tolven.component.application.jboss-0.0.1.zip for {PluginFragment: uid=o
rg.tolven.component.application.jboss@0.0.1} with key org.tolven.component.appli
cation.jboss
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.deploy.pluginframework-0.0.1.zip has
been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/
org.tolven.deploy.pluginframework-0.0.1.zip for {PluginFragment: uid=org.tolven.
deploy.pluginframework@0.0.1} with key org.tolven.deploy.pluginframework
18:29:08,929 INFO [TolvenApplicationInitializer] integrity check done: errors -
0, warnings - 0
18:29:08,929 INFO [TolvenApplicationInitializer] application plug-in is org.tol
ven.command
18:29:08,929 INFO [StandardPluginManager] plug-in started - org.tolven.library.
pluginframework@0.0.1 (active/total: 1 of 105)
18:29:08,929 INFO [StandardPluginManager] plug-in started - org.tolven.library.
serverconfig@0.0.2 (active/total: 2 of 105)
18:29:08,945 INFO [StandardPluginManager] plug-in started - org.tolven.command@
0.0.3 (active/total: 3 of 105)
18:29:08,945 INFO [StandardPluginManager] plug-in started - org.tolven.config.d
atabase@0.0.1 (active/total: 4 of 105)
18:29:08,960 INFO [StandardPluginManager] plug-in started - org.tolven.library.
bouncy-castle@0.0.1 (active/total: 5 of 105)
18:29:08,960 INFO [StandardPluginManager] plug-in started - org.tolven.config.l
dap@0.0.1 (active/total: 6 of 105)
18:29:08,976 INFO [AdminAssembler] *** start ***
18:29:09,179 INFO [AdminAssembler] tmpDir - c:\tolven\tolven-config\build\repos
itoryTmp
18:29:09,179 INFO [AdminAssembler] stageDir - c:\tolven\tolven-config\build\rep
ositoryStage
18:29:09,179 INFO [AdminAssembler] devLib - c:\tolven\tolven-config\devLib
18:29:09,195 INFO [AdminAssembler] Admin keystore: c:\tolven\tolven-config\cred
entials\admin\tolvendev-admin.jks
18:29:09,195 INFO [AdminAssembler] Admin truststore: c:\tolven\tolven-config\cr
edentials\admin\tolvendev-admin-cacerts.jks
18:29:09,210 INFO [AdminAssembler] Admin secretkey: c:\tolven\tolven-config\cre
dentials\admin\admin-encryptedSecretKey
18:29:09,210 INFO [AdminAssembler] Admin password store: c:\tolven\tolven-confi
g\credentials\admin\admin-password.cfg
18:29:09,804 INFO [AdminAssembler] LDAP key: c:\tolven\tolven-config\credential
s\ldap\tolvendev-ldap-key.pem
18:29:09,804 INFO [AdminAssembler] LDAP certificate: c:\tolven\tolven-config\cr
edentials\ldap\tolvendev-ldap-cert.pem
18:29:09,804 INFO [AdminAssembler] LDAP truststore: c:\tolven\tolven-config\cre
dentials\ldap\tolvendev-ldap-cacerts.pem
18:29:09,804 INFO [AdminAssembler] LDAPClient key: c:\tolven\tolven-config\cred
entials\ldapclient\tolvendev-ldapclient-key.pem
18:29:09,820 INFO [AdminAssembler] Database keystore: c:\tolven\tolven-config\c
redentials\oracle\tolvendev-oracle.jks
18:29:09,820 INFO [AdminAssembler] Database truststore: c:\tolven\tolven-config
\credentials\oracle\root.crt
18:29:09,835 INFO [AdminAssembler] DatabaseClient key: c:\tolven\tolven-config\
credentials\pgadmin\postgresql.key
18:29:09,835 INFO [AdminAssembler] DatabaseClient certificate: c:\tolven\tolven
-config\credentials\pgadmin\postgresql.crt
18:29:09,851 INFO [AdminAssembler] AppServer keystore: c:\tolven\tolven-config\
credentials\jboss\tolvendev-jboss.jks
18:29:09,851 INFO [AdminAssembler] AppServer truststore: c:\tolven\tolven-confi
g\credentials\jboss\tolvendev-jboss-cacerts.jks
18:29:09,851 INFO [AdminAssembler] MDBUser key: c:\tolven\tolven-config\credent
ials\mdbuser\tolvendev-mdbuser-key.pem
18:29:09,867 INFO [AdminAssembler] MDBUser certificate: c:\tolven\tolven-config
\credentials\mdbuser\tolvendev-mdbuser-cert.pem
18:29:09,867 INFO [AdminAssembler] MDBUser keystore: c:\tolven\tolven-config\cr
edentials\mdbuser\tolvendev-mdbuser.p12
18:29:10,164 INFO [TolvenConfigWrapper] Load JSSE keystore for admin
18:29:10,164 INFO [TolvenConfigWrapper] Load JSSE truststore for admin
18:29:10,164 INFO [AdminAssembler] *** end ***
18:29:10,164 INFO [StandardPluginManager] plug-in started - org.tolven.assemble
r.admin@0.0.4 (active/total: 7 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
jasperreports@0.0.1 (active/total: 8 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
remoteclient@0.0.1 (active/total: 9 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
jboss@0.0.1 (active/total: 10 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
tolvenclient@0.0.2 (active/total: 11 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
javaee@0.0.1 (active/total: 12 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
jdbcdriver@0.0.1 (active/total: 13 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.componen
t.application.jboss@0.0.1 (active/total: 14 of 105)
18:29:10,195 INFO [StandardPluginManager] plug-in started - org.tolven.library.
application@0.0.1 (active/total: 15 of 105)
18:29:10,257 INFO [Application] *** start ***
18:29:10,273 INFO [Application] Starting for user: admin to jnp://localhost:109
9
18:29:10,429 INFO [Application] Update MDBUser mdbuser
18:29:10,429 INFO [TolvenClient] jndi: java.naming.provider.url=jnp://localhost
:1099
18:29:10,429 INFO [TolvenClient] jndi: java.naming.factory.initial=org.jboss.na
ming.NamingContextFactory
18:29:10,429 INFO [TolvenClient] jndi: java.naming.factory.url.pkgs=org.jboss.n
aming:org.jnp.interfaces
18:29:11,523 INFO [LoadMDBUsers] Rolling back transaction : load mdbuser for: a
dmin
Application start failed.
org.java.plugin.PluginLifecycleException: can't start plug-in org.tolven.compone
nt.application@0.0.1
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:415)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:245)
at org.tolven.command.TolvenApplication.startRequiredPlugins(TolvenAppli
cation.java:87)
at org.tolven.command.TolvenApplication.startApplication(TolvenApplicati
on.java:56)
at org.java.plugin.boot.Boot.boot(Boot.java:346)
at org.java.plugin.boot.Boot.main(Boot.java:243)
at org.tolven.plugin.boot.TPFBoot.main(TPFBoot.java:102)
Caused by: java.lang.RuntimeException: Could not load mdbuser for: admin
at org.tolven.client.load.LoadMDBUsers.updateMDBUser(LoadMDBUsers.java:3
0)
at org.tolven.component.application.Application.updateMDBUser(Applicatio
n.java:152)
at org.tolven.component.application.Application.doStart(Application.java
:123)
at org.java.plugin.Plugin.start(Plugin.java:82)
at org.java.plugin.PluginManager.startPlugin(PluginManager.java:325)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:407)
... 6 more
Caused by: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.
SQLGrammarException: could not execute query
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)

at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java
:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInt
erceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(Stateles
sInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(R
oleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(Role
BasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
ationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
enticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
ptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
usInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessCo
ntainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRem
otingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:795)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(Se
rverThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.j
ava:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.jav
a:166)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGr
ammarException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException
(AbstractEntityManagerImpl.java:629)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
at org.tolven.security.bean.LoginBean.findUser(LoginBean.java:73)
at org.tolven.security.bean.LoginBean.createOrUpdateUser(LoginBean.java:
314)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationCo
ntextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3Int
erceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invok
e(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsI
nterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java
:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInt
erceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(Stateles
sInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(R
oleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(Role
BasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
ationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
enticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
ptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
usInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessCo
ntainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRem
otingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:795)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(Se
rverThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.j
ava:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.jav
a:166)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientI
nvoker.java:163)
at org.jboss.remoting.Client.invoke(Client.java:1634)
at org.jboss.remoting.Client.invoke(Client.java:548)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
eInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPr
opagationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityC
lientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
roxy.java:107)
at $Proxy19.createOrUpdateUser(Unknown Source)
at org.tolven.client.load.LoadMDBUsers.updateMDBUser(LoadMDBUsers.java:2
5)
at org.tolven.component.application.Application.updateMDBUser(Applicatio
n.java:152)
at org.tolven.component.application.Application.doStart(Application.java
:123)
at org.java.plugin.Plugin.start(Plugin.java:82)
at org.java.plugin.PluginManager.startPlugin(PluginManager.java:325)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:407)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:245)
at org.tolven.command.TolvenApplication.startRequiredPlugins(TolvenAppli
cation.java:87)
at org.tolven.command.TolvenApplication.startApplication(TolvenApplicati
on.java:56)
at org.java.plugin.boot.Boot.boot(Boot.java:346)
at org.java.plugin.boot.Boot.main(Boot.java:243)
at org.tolven.plugin.boot.TPFBoot.main(TPFBoot.java:102)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
eInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPr
opagationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityC
lientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
roxy.java:107)
at $Proxy19.createOrUpdateUser(Unknown Source)
at org.tolven.client.load.LoadMDBUsers.updateMDBUser(LoadMDBUsers.java:2
5)
at org.tolven.component.application.Application.updateMDBUser(Applicatio
n.java:152)
at org.tolven.component.application.Application.doStart(Application.java
:123)
at org.java.plugin.Plugin.start(Plugin.java:82)
at org.java.plugin.PluginManager.startPlugin(PluginManager.java:325)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:407)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:245)
at org.tolven.command.TolvenApplication.startRequiredPlugins(TolvenAppli
cation.java:87)
at org.tolven.command.TolvenApplication.startApplication(TolvenApplicati
on.java:56)
at org.java.plugin.boot.Boot.boot(Boot.java:346)
at org.java.plugin.boot.Boot.main(Boot.java:243)
at org.tolven.plugin.boot.TPFBoot.main(TPFBoot.java:102)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.ja
va:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java
:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
at org.tolven.security.bean.LoginBean.findUser(LoginBean.java:73)
at org.tolven.security.bean.LoginBean.createOrUpdateUser(LoginBean.java:
314)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationCo
ntextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3Int
erceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invok
e(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsI
nterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java
:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInt
erceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(Stateles
sInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(R
oleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(Role
BasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
ationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
enticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
ptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
usInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessCo
ntainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRem
otingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:795)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(Se
rverThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.j
ava:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.jav
a:166)
Caused by: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected -
got BLOB

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.
java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPrepare
dStatement.java:810)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStateme
nt.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPrepa
redStatement.java:850)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1134)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePrep
aredStatement.java:3339)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
dStatement.java:3384)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery
(WrappedPreparedStatement.java:236)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:
186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 46 more
Press any key to continue . . .


And the JBoss Server logs showed:
2009-07-07 18:29:11,398 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 932, SQLState: 42000
2009-07-07 18:29:11,398 ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-00932: inconsistent datatypes: expected - got BLOB


After enabling full DEBUG logging for JBoss server AND Hibernate, the problem was identified as an incorrect SQL Query (see ORA-00932: inconsistent datatypes: expected - got BLOB)!

The basic problem was a wrong SQL query formed by Hibernate - the TOLVENUSER table has 3 columns of type BLOB and the query in question was "SELECT DISTINCT...". Whereas "DISTINCT" does not work with blob columns (in Oracle 10g anyway) and hence the oracle error: ORA_00932.

The approach I had was to customise the offending query to simply remove "DISTINCT", especially since TOLVENUSER table already has a primary key on ID column anyway - the "DISTINCT" was hence redundant in the first place.
This was done by updating a single Java file, org.tolven.security.bean.LoginBean (under TolvenEJB module). In the findUser( String principal) method, find the following line and remove "DISTINCT":
String select = "SELECT DISTINCT u FROM TolvenUser u WHERE u.ldapUID = :principal " +

I then updated this compiled class file direclty into the tolvenEJB.jar file in JBoss's tolven ear file (at "...tolven-jboss-4.2.2.GA\server\tolven\deploy\tolven.ear/tolvenEJB.jar") and restarted Jboss.

And it was smooth running all the way after that (configPhase3 and so on). I'm accessing all Tolven web app pages perfectly now.

ORA-00932: inconsistent datatypes: expected - got BLOB

"ORA-00932: inconsistent datatypes: expected - got BLOB"
This weird single-line error in JBoss's console/log made no sense at all until I added the following snippet in the server's log4j.xml to enable Hibernate logging (thanks to Joe at the Tolven Forum):
<category name="org.hibernate.SQL">
<priority value="DEBUG"/>
</category>

(Also of course modified the server logging threshold to DEBUG)

And then came this stacktrace:

2009-07-13 18:27:47,322 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not execute query [select distinct tolvenuser0_.id as id27_, tolvenuser0_.ldapUID as ldapUID27_, tolvenuser0_.lastLogin as lastLogin27_, tolvenuser0_.creation as creation27_, tolvenuser0_.status as status27_, tolvenuser0_.sponsorship_id as sponsor19_27_, tolvenuser0_.timeZone as timeZone27_, tolvenuser0_.locale as locale27_, tolvenuser0_.emailFormat as emailFor8_27_, tolvenuser0_.demoUser as demoUser27_, tolvenuser0_.likeness_id as likeness18_27_, tolvenuser0_.pbeKeyAlgorithm as pbeKeyA10_27_, tolvenuser0_.salt as salt27_, tolvenuser0_.iterationCount as iterati12_27_, tolvenuser0_.encodedEncryptedPrivateKeyInfo as encoded13_27_, tolvenuser0_.PRIVATE_KEY_SIZE as PRIVATE14_27_, tolvenuser0_.PRIVATE_KEY_ALGORITHM as PRIVATE15_27_, tolvenuser0_.x509EncodedKeySpec as x16_27_, tolvenuser0_.PUBLIC_KEY_ALGORITHM as PUBLIC17_27_ from tolven.TolvenUser tolvenuser0_ where tolvenuser0_.ldapUID=? and (tolvenuser0_.status='ACTIVE' or tolvenuser0_.status='active' or tolvenuser0_.status='new' or tolvenuser0_.status='ACTIVATING' or tolvenuser0_.status='')]
java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected - got BLOB

at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
at org.tolven.security.bean.LoginBean.findUser(LoginBean.java:73)
at org.tolven.security.bean.LoginBean.createOrUpdateUser(LoginBean.java:314)
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 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:795)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
2009-07-13 18:27:47,338 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 932, SQLState: 42000
2009-07-13 18:27:47,338 ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-00932: inconsistent datatypes: expected - got BLOB


Once the erring query was out in the open (in bold above), I tried executing it in an SQL window and identified that the error was being thrown on those columns of this table that were of type BLOB.
And Google quickly told me that Oracle doesn't like using "SELECT DISTINCT..." on any BLOB columns of a table. Voila!

Wednesday, June 24, 2009

VB Macro for deleting or detecting duplicate Outlook Mails

There are so many times that one cant help but wonder at how in spite of all the advances in comfort etc etc, life seems a lot harder than ever... sighhh.

For example, all the haphazard shifting around at office over the last 3 years has resulted in me accumulating a mountain of disorganised backups. Most notable are the outlook backups in PST formats (what are .pst files? They are Outlooks default backup file format extension). I was getting fed-up of helplessly grinding my teeth because of all the duplicate emails in different folders and different PSTs...
..especially when the solution was right in front of my eyes - A simple VB macro!

Finally I took time out to get it done and with a very polished form too as can be seen below screnshots.
To make it easy to carry around, I've stored it as an Excel file.

Download my file or scroll down further to see code to customize.

Excel file containing the macro.

The launched macro!

App in action!
Functionality
The Macro identifies any duplicate items in 2 outlook folders (even those in different PST files) and optionally marks those items.

It does this by simply comparing all the mails (or any Outlook item) in the 2 locations specified and marks the duplicate mails (in both the folders) with a tag of your choice on the Categories attribute of that email. So it only marks duplicate mails and does not do the actual deleting (those who want to automate this step can easily add an extra line in the code to delete instead of mark, but I found it too risky). An option is available to disable even the marking so that you only get the duplicate count in the summary.

Inputs
The actual program inputs are the names of the Outlook PST file and the mail folder of the 2 locations. Of course, if you want to compare 2 folders in the same PST, just provide the same PST name in both sets and choose the different folders.
The other input is the name of the label you want to apply against the Categories attribute for duplicate e-mails.
Finally, there is an option to enable marking of duplicate items.

Steps
Ensure Outlook is running before launching the macro or it will not be able to get the PSTs files loaded in Outlook.
1) Start the Macro.
2) The macro fetches the PST files loaded in your Outlook application and displays the form.
3) Select the PST file in set1. The set1 list gets updated with the folders in this PST file. Select the first folder you need to compare.
4) Similarly, select the PST file in set2. The set2 folder list gets updated with the selected PST file contents. Select the second folder you need to compare here.
5) Next choose whether to Mark the Duplicates or simply show a summary of duplicate sets.
6) Ok Button gets enabled when all the right options are selected.
7) Click on the OK button to start the process! This indexing step of the process may take time for large number of items... a progress bar displays the progress as well as a status bar with basic updates. When the process is done, the status shows the Completed message (and other statistics if you scroll up).
8) Manual step of actual deleting duplicate mails: After running the program, you have to open the Outlook folder that you want to clean up and sort by the Categories column to see those marked in Duplicate like below (the Categories column is hidden by default - this has to be added from the Field Chooser dialog box):
Results showing marked mails under attribute, "Categories"

You can give a quick look to make sure they are really duplicates. Then you simply shift-select those mails and delete! :)

Performance
Efficiency was increased by indexing the 2 folders before identifying duplicates- for 3000 + 1000 emails in the 2 folders, without indexing it took a few hours and still didnt finish (because there would be 3000 * 1000 reading of outlook items)! Now it runs in 5 mins.

Customisation
The current macro only compares the Subject and Creation Date of 2 emails to identify if they are the same (which is actually fairly safe). If you want, you can have more precision by editing the code to check more mail attributes.
Also as mentioned before it is simple to change the code to delete duplicate mails instead of just marking them.

I made the macro portable by embedding it in an Excel document with a launcher button (what you see in the background of the first 2 screens above). The Excel document containing all the code is available here. Of course, you can also create the macro right into your Outlook client itself (you'll have to copy the code manually from the Excel-macro code page to your Outlook-macro code page).

Below is the core code which is called from the form:


Const PST1_NAME = "NewBackup"
Const PST2_NAME = "NewBackup"
Const FOLDER1_NAME = "Inbox"
Const FOLDER2_NAME = "OldInbox"
Const CATEGORY_SEPERATOR = ","
Const FINAL_PROGRESS_ALLOCATED = 20 ' between 1 and 100

Public progressValue 'this holds the percentage completed.
Public progressStatus 'this holds the current status.

' sample with hardcoded psts & folders
Private Sub markDuplicateEmails()
markDuplicates PST1_NAME & SEPERATOR & FOLDER1_NAME, PST2_NAME & SEPERATOR & FOLDER2_NAME, DEFAULT_CATEGORY
End Sub

' actual method which takes dynamic pst\folder source and destination
Public Sub markDuplicates(source, destination, category)
Dim myOlApp, myNameSpace
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")

Dim tmpArray, pst1Name, pst2Name, folder1Name, folder2Name
tmpArray = Split(source, SEPERATOR)
pst1Name = tmpArray(0)
folder1Name = tmpArray(1)
tmpArray = Split(destination, SEPERATOR)
pst2Name = tmpArray(0)
folder2Name = tmpArray(1)

Dim folder1Size, folder2Size
folder1Size = myNameSpace.Folders(pst1Name).Folders(folder1Name).Items.Count
folder2Size = myNameSpace.Folders(pst2Name).Folders(folder2Name).Items.Count

Dim array1() As cstData, array2() As cstData
ReDim array1(folder1Size)
ReDim array2(folder2Size)

Dim outlookItem1, outlookItem2, i, j
Dim theCstmData As Module1.cstData
Dim startTime, endTime

'populate array1
i = -1
startTime = Now
progressStatus = "Indexing set1..."
For Each outlookItem1 In myNameSpace.Folders(pst1Name).Folders(folder1Name).Items
i = i + 1
Set theCstmData.item = outlookItem1
theCstmData.subject = outlookItem1.subject
theCstmData.creationTime = outlookItem1.creationTime
array1(i) = theCstmData
progressValue = 100 * (i / (folder1Size + folder2Size + (folder1Size + folder2Size) * (FINAL_PROGRESS_ALLOCATED / 100)))
DoEvents
Next outlookItem1
progressStatus = "Indexing set1 Complete."
' populate array2
i = -1
progressStatus = "Indexing set2..."
For Each outlookItem2 In myNameSpace.Folders(pst2Name).Folders(folder2Name).Items
i = i + 1
Set theCstmData.item = outlookItem2
theCstmData.subject = outlookItem2.subject
theCstmData.creationTime = outlookItem2.creationTime
array2(i) = theCstmData
progressValue = 100 * ((folder1Size + i) / (folder1Size + folder2Size + (folder1Size + folder2Size) * (FINAL_PROGRESS_ALLOCATED / 100)))
DoEvents
Next outlookItem2
progressStatus = "Indexing set2 Complete."
progressStatus = "Indexing time: " & (Now - startTime) * 60 * 60 * 24

'loop through each item in array1
progressStatus = "Applying Category labels on duplicates..."
For i = 0 To folder1Size - 1
'loop through each item in array 2 comparing each array2Item with current array1item
For j = 0 To folder2Size - 1
' if it is a match mark the item in array2 as duplicate
If array1(i).subject = array2(j).subject And _
array1(i).creationTime = array2(j).creationTime Then
If array1(i).item.Categories = "" Then
array1(i).item.Categories = category
Else
array1(i).item.Categories = array2(j).item.Categories & CATEGORY_SEPERATOR & category
End If
array1(i).item.Save

If array2(j).item.Categories = "" Then
array2(j).item.Categories = category
Else
array2(j).item.Categories = array2(j).item.Categories & CATEGORY_SEPERATOR & category
End If
array2(j).item.Categories = category
array2(j).item.Save
End If
DoEvents
Next j
progressValue = (100 - FINAL_PROGRESS_ALLOCATED) + (FINAL_PROGRESS_ALLOCATED * (i / folder1Size))
Next i
progressStatus = "Total Time: " & (Now - startTime) * 60 * 60 * 24
progressStatus = "All done."
End Sub


Update [25-Jun-09]:
New features
- Option to only count duplicates instead of Marking.
- Now displays even sub-folders recursively
- 2 new status views available to display number of items in selected folder.
- Other performance enhancements
See screenshot below:


Update [03-Jul-09]:
New features
-support for choosing same folder in set1 and set2. This will mark/count duplicate sets of mails in the same folder.

Update [15-Feb-12]:
New features
-Support for identifying Missing mails - choose source and destination folders, and all mails missing in destination will be identified.
-Support for marking labels as well as just counting Duplicates or Missing mails


Note: This was tested on Outlook 2003 but should work on any outlook...
 
Superblog Directory