[jira] Commented: (JCR-1907) ClassCastException when using OracleFileSystem with JBoss JNDI
[
https://issues.apache.org/jira/browse/JCR-1907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894988#action_12894988
]
Tihomir Surdilovic commented on JCR-1907:
-
I know this is very old but still wanted to confirm with devs that this is no
longer an issue in 2.1 as now the code uses ConnectionFactory.unwrap() and does
not directly pass the java.sql.Connection when creating blobs:
http://svn.apache.org/viewvc/jackrabbit/tags/2.1.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/Oracle10R1ConnectionHelper.java?revision=934953&view=co
private Blob createTemporaryBlob(Connection con, InputStream in) throws
Exception {
/*
* BLOB blob = BLOB.createTemporary(con, false, BLOB.DURATION_SESSION);
* blob.open(BLOB.MODE_READWRITE); OutputStream out =
blob.getBinaryOutputStream(); ... out.flush();
* out.close(); blob.close(); return blob;
*/
Method createTemporary =
blobClass.getMethod("createTemporary", new
Class[]{Connection.class, Boolean.TYPE, Integer.TYPE});
Object blob =
createTemporary.invoke(null, new
Object[]{ConnectionFactory.unwrap(con), Boolean.FALSE,
durationSessionConstant});
Method open = blobClass.getMethod("open", new Class[]{Integer.TYPE});
Can anyone please comment?
Thanks.
> ClassCastException when using OracleFileSystem with JBoss JNDI
> --
>
> Key: JCR-1907
> URL: https://issues.apache.org/jira/browse/JCR-1907
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
>Affects Versions: 1.5.0
> Environment: - WindowsXP, JBoss AS 4.2.0.GA, JackRabbit 1.5.0, Oracle
> Driver : ojdbc14_10g.jar
>Reporter: Eduardo Andrade
>Priority: Minor
>
> When using OracleFilesystem with JNDI connection on JBOSS, the JBoss gives a
> org.jboss.resource.adapter.jdbc.WrappedConnection instance and oracle driver
> code expects a oracle.jdbc.OracleConnection instance.
> To avoid the exception : java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection,
> couldn't it be done something like this ? :
> public static Connection getConnection(Connection conn) {
> if (conn instanceof WrappedConnection) {
> return ((WrappedConnection) conn).getUnderlyingConnection();
> }
> return conn;
> }
> Here are the relevant repository.xml config and the Exception thrown :
>
>
>
>
>
>
> 13:07:33,827 ERROR [RepositoryImpl] failed to start Repository: failed to
> load repository properties: failed to persist repository properties: null
> javax.jcr.RepositoryException: failed to load repository properties: failed
> to persist repository properties: null: failed to persist repository
> properties: null: null
> at
> org.apache.jackrabbit.core.RepositoryImpl.loadRepProps(RepositoryImpl.java:1291)
> at
> org.apache.jackrabbit.core.RepositoryImpl.(RepositoryImpl.java:276)
> at
> org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:618)
> at
> pt.gedi.ecm.services.RepositorioImpExp_ServiceImpl.iniciaRepositorio(RepositorioImpExp_ServiceImpl.java:123)
> at
> pt.gedi.ecm.utils.ECMCodeForBase.iniciaRepositorio(ECMCodeForBase.java:74)
> 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 pt.gedi.base.utils.ECMCodeForBase.callMethod(ECMCodeForBase.java:33)
> at
> pt.gedi.base.services.StartupServiceImpl.startup(StartupServiceImpl.java:188)
> 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireC
[jira] Commented: (JCR-1907) ClassCastException when using OracleFileSystem with JBoss JNDI
[
https://issues.apache.org/jira/browse/JCR-1907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12655678#action_12655678
]
Eduardo Andrade commented on JCR-1907:
--
Yes, i already done what Stefan suggested (thanks!) but i feel that i will have
troubles more ahead.
The class OraclePersistenceManager extends BundleDbPersistenceManager and this
one has a atribute ConnectionRecoveryManager connectionManager;
This class also has a getConnection() Method but Jackrabbit code invokes it
explicitly and if I have a problem on this one, i may have to copy the entire
init(PMContext context) method from BundleDbPersistenceManager to another class
MyOraclePersistenceManager that extends OraclePersistenceManager and change the
line new ConnectionRecoveryManager(...) to MyConnectionRecoveryManager(...)
that knows how to get the OracleConnection from JBoss WrappedConnection.
Is there a more elegant solution ?
Thank you very much for your answers.
Regards,
Eduardo Andrade
> ClassCastException when using OracleFileSystem with JBoss JNDI
> --
>
> Key: JCR-1907
> URL: https://issues.apache.org/jira/browse/JCR-1907
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
>Affects Versions: 1.5.0
> Environment: - WindowsXP, JBoss AS 4.2.0.GA, JackRabbit 1.5.0, Oracle
> Driver : ojdbc14_10g.jar
>Reporter: Eduardo Andrade
>Priority: Minor
>
> When using OracleFilesystem with JNDI connection on JBOSS, the JBoss gives a
> org.jboss.resource.adapter.jdbc.WrappedConnection instance and oracle driver
> code expects a oracle.jdbc.OracleConnection instance.
> To avoid the exception : java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection,
> couldn't it be done something like this ? :
> public static Connection getConnection(Connection conn) {
> if (conn instanceof WrappedConnection) {
> return ((WrappedConnection) conn).getUnderlyingConnection();
> }
> return conn;
> }
> Here are the relevant repository.xml config and the Exception thrown :
>
>
>
>
>
>
> 13:07:33,827 ERROR [RepositoryImpl] failed to start Repository: failed to
> load repository properties: failed to persist repository properties: null
> javax.jcr.RepositoryException: failed to load repository properties: failed
> to persist repository properties: null: failed to persist repository
> properties: null: null
> at
> org.apache.jackrabbit.core.RepositoryImpl.loadRepProps(RepositoryImpl.java:1291)
> at
> org.apache.jackrabbit.core.RepositoryImpl.(RepositoryImpl.java:276)
> at
> org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:618)
> at
> pt.gedi.ecm.services.RepositorioImpExp_ServiceImpl.iniciaRepositorio(RepositorioImpExp_ServiceImpl.java:123)
> at
> pt.gedi.ecm.utils.ECMCodeForBase.iniciaRepositorio(ECMCodeForBase.java:74)
> 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 pt.gedi.base.utils.ECMCodeForBase.callMethod(ECMCodeForBase.java:33)
> at
> pt.gedi.base.services.StartupServiceImpl.startup(StartupServiceImpl.java:188)
> 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> at
[jira] Commented: (JCR-1907) ClassCastException when using OracleFileSystem with JBoss JNDI
[
https://issues.apache.org/jira/browse/JCR-1907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12655675#action_12655675
]
Thomas Mueller commented on JCR-1907:
-
Hi,
I understand the problem now. Jackrabbit wants to store an empty string to
FSENTRY_NAME, but for Oracle an empty string is the same as NULL. And the
column is defined NOT NULL, so Oracle throws an exception... Oracle is the only
database I know that thinks an empty string is the same as NULL.
I'm not sure what is the best solution for this problem. The most simple
solution is what Stefan proposed: Extends OracleFileSystem and override the
getConnection() method.
> ClassCastException when using OracleFileSystem with JBoss JNDI
> --
>
> Key: JCR-1907
> URL: https://issues.apache.org/jira/browse/JCR-1907
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
>Affects Versions: 1.5.0
> Environment: - WindowsXP, JBoss AS 4.2.0.GA, JackRabbit 1.5.0, Oracle
> Driver : ojdbc14_10g.jar
>Reporter: Eduardo Andrade
>Priority: Minor
>
> When using OracleFilesystem with JNDI connection on JBOSS, the JBoss gives a
> org.jboss.resource.adapter.jdbc.WrappedConnection instance and oracle driver
> code expects a oracle.jdbc.OracleConnection instance.
> To avoid the exception : java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection,
> couldn't it be done something like this ? :
> public static Connection getConnection(Connection conn) {
> if (conn instanceof WrappedConnection) {
> return ((WrappedConnection) conn).getUnderlyingConnection();
> }
> return conn;
> }
> Here are the relevant repository.xml config and the Exception thrown :
>
>
>
>
>
>
> 13:07:33,827 ERROR [RepositoryImpl] failed to start Repository: failed to
> load repository properties: failed to persist repository properties: null
> javax.jcr.RepositoryException: failed to load repository properties: failed
> to persist repository properties: null: failed to persist repository
> properties: null: null
> at
> org.apache.jackrabbit.core.RepositoryImpl.loadRepProps(RepositoryImpl.java:1291)
> at
> org.apache.jackrabbit.core.RepositoryImpl.(RepositoryImpl.java:276)
> at
> org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:618)
> at
> pt.gedi.ecm.services.RepositorioImpExp_ServiceImpl.iniciaRepositorio(RepositorioImpExp_ServiceImpl.java:123)
> at
> pt.gedi.ecm.utils.ECMCodeForBase.iniciaRepositorio(ECMCodeForBase.java:74)
> 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 pt.gedi.base.utils.ECMCodeForBase.callMethod(ECMCodeForBase.java:33)
> at
> pt.gedi.base.services.StartupServiceImpl.startup(StartupServiceImpl.java:188)
> 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abstrac
[jira] Commented: (JCR-1907) ClassCastException when using OracleFileSystem with JBoss JNDI
[
https://issues.apache.org/jira/browse/JCR-1907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12655670#action_12655670
]
Eduardo Andrade commented on JCR-1907:
--
Hello Thomas,
the reason why I used OracleFileSystem and OraclePersistenceManager is because
i was having another exception :
ORA-01400: cannot insert NULL into ("REPOSITORIO"."FSENTRY"."FSENTRY_NAME")
when using org.apache.jackrabbit.core.fs.db.DbFileSystem and
org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager.
Oracle DB is Oracle 10g. Oracle driver is ojdbc14_10g.jar.
Here is the exception :
14:31:59,706 ERROR [DatabaseFileSystem] failed to initialize file system
org.apache.jackrabbit.core.fs.FileSystemException: failed to create folder
entry: /
at
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.createDeepFolder(DatabaseFileSystem.java:1392)
at
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.verifyRootExists(DatabaseFileSystem.java:1360)
at
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:199)
at
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$2.getFileSystem(RepositoryConfigurationParser.java:761)
at
org.apache.jackrabbit.core.config.RepositoryConfig.getFileSystem(RepositoryConfig.java:666)
at
org.apache.jackrabbit.core.RepositoryImpl.(RepositoryImpl.java:259)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:618)
at
pt.gedi.ecm.services.RepositorioImpExp_ServiceImpl.iniciaRepositorio(RepositorioImpExp_ServiceImpl.java:123)
at
pt.gedi.ecm.utils.ECMCodeForBase.iniciaRepositorio(ECMCodeForBase.java:74)
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 pt.gedi.base.utils.ECMCodeForBase.callMethod(ECMCodeForBase.java:33)
at
pt.gedi.base.services.StartupServiceImpl.startup(StartupServiceImpl.java:188)
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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
at
org.apache.catalina.core.StandardConte
[jira] Commented: (JCR-1907) ClassCastException when using OracleFileSystem with JBoss JNDI
[
https://issues.apache.org/jira/browse/JCR-1907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12655648#action_12655648
]
Thomas Mueller commented on JCR-1907:
-
Could you try using org.apache.jackrabbit.core.fs.db.DatabaseFileSystem? Newer
Oracle version should work with that (but I didn't actually test it). If it
doesn't work for you, what version of Oracle (database and drivers) do you use,
and what is the exception (message and stack trace)?
> ClassCastException when using OracleFileSystem with JBoss JNDI
> --
>
> Key: JCR-1907
> URL: https://issues.apache.org/jira/browse/JCR-1907
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
>Affects Versions: 1.5.0
> Environment: - WindowsXP, JBoss AS 4.2.0.GA, JackRabbit 1.5.0, Oracle
> Driver : ojdbc14_10g.jar
>Reporter: Eduardo Andrade
>Priority: Minor
>
> When using OracleFilesystem with JNDI connection on JBOSS, the JBoss gives a
> org.jboss.resource.adapter.jdbc.WrappedConnection instance and oracle driver
> code expects a oracle.jdbc.OracleConnection instance.
> To avoid the exception : java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection,
> couldn't it be done something like this ? :
> public static Connection getConnection(Connection conn) {
> if (conn instanceof WrappedConnection) {
> return ((WrappedConnection) conn).getUnderlyingConnection();
> }
> return conn;
> }
> Here are the relevant repository.xml config and the Exception thrown :
>
>
>
>
>
>
> 13:07:33,827 ERROR [RepositoryImpl] failed to start Repository: failed to
> load repository properties: failed to persist repository properties: null
> javax.jcr.RepositoryException: failed to load repository properties: failed
> to persist repository properties: null: failed to persist repository
> properties: null: null
> at
> org.apache.jackrabbit.core.RepositoryImpl.loadRepProps(RepositoryImpl.java:1291)
> at
> org.apache.jackrabbit.core.RepositoryImpl.(RepositoryImpl.java:276)
> at
> org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:618)
> at
> pt.gedi.ecm.services.RepositorioImpExp_ServiceImpl.iniciaRepositorio(RepositorioImpExp_ServiceImpl.java:123)
> at
> pt.gedi.ecm.utils.ECMCodeForBase.iniciaRepositorio(ECMCodeForBase.java:74)
> 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 pt.gedi.base.utils.ECMCodeForBase.callMethod(ECMCodeForBase.java:33)
> at
> pt.gedi.base.services.StartupServiceImpl.startup(StartupServiceImpl.java:188)
> 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> at
> org.springframework.beans.factory.supp
[jira] Commented: (JCR-1907) ClassCastException when using OracleFileSystem with JBoss JNDI
[
https://issues.apache.org/jira/browse/JCR-1907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12655645#action_12655645
]
Stefan Guggisberg commented on JCR-1907:
> To avoid the exception : java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection,
> couldn't it be done something like this ? :
>
> public static Connection getConnection(Connection conn) {
> if (conn instanceof WrappedConnection) {
>return ((WrappedConnection) conn).getUnderlyingConnection();
> }
> return conn;
> }
for obvious reasons i'm rather reluctant adding a jboss dependency to
jackrabbit-core ;)
there's an 'unwrap' method in jdbc 4 (since java 6) but as of now most drivers
won't
support it.
i suggest you create your own class which extends OracleFileSystem and override
the getConnectionMethod().
cheers
stefan
> ClassCastException when using OracleFileSystem with JBoss JNDI
> --
>
> Key: JCR-1907
> URL: https://issues.apache.org/jira/browse/JCR-1907
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
>Affects Versions: 1.5.0
> Environment: - WindowsXP, JBoss AS 4.2.0.GA, JackRabbit 1.5.0, Oracle
> Driver : ojdbc14_10g.jar
>Reporter: Eduardo Andrade
>Priority: Minor
>
> When using OracleFilesystem with JNDI connection on JBOSS, the JBoss gives a
> org.jboss.resource.adapter.jdbc.WrappedConnection instance and oracle driver
> code expects a oracle.jdbc.OracleConnection instance.
> To avoid the exception : java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection,
> couldn't it be done something like this ? :
> public static Connection getConnection(Connection conn) {
> if (conn instanceof WrappedConnection) {
> return ((WrappedConnection) conn).getUnderlyingConnection();
> }
> return conn;
> }
> Here are the relevant repository.xml config and the Exception thrown :
>
>
>
>
>
>
> 13:07:33,827 ERROR [RepositoryImpl] failed to start Repository: failed to
> load repository properties: failed to persist repository properties: null
> javax.jcr.RepositoryException: failed to load repository properties: failed
> to persist repository properties: null: failed to persist repository
> properties: null: null
> at
> org.apache.jackrabbit.core.RepositoryImpl.loadRepProps(RepositoryImpl.java:1291)
> at
> org.apache.jackrabbit.core.RepositoryImpl.(RepositoryImpl.java:276)
> at
> org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:618)
> at
> pt.gedi.ecm.services.RepositorioImpExp_ServiceImpl.iniciaRepositorio(RepositorioImpExp_ServiceImpl.java:123)
> at
> pt.gedi.ecm.utils.ECMCodeForBase.iniciaRepositorio(ECMCodeForBase.java:74)
> 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 pt.gedi.base.utils.ECMCodeForBase.callMethod(ECMCodeForBase.java:33)
> at
> pt.gedi.base.services.StartupServiceImpl.startup(StartupServiceImpl.java:188)
> 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFact
