Hey JB, thanks in advance! Again... ;-)
Best, Christian ----------------- Software Integration Specialist Apache Member V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer Apache Incubator PMC Member https://www.linkedin.com/pub/christian-mueller/11/551/642 On Tue, Jan 21, 2014 at 10:35 AM, Jean-Baptiste Onofré <[email protected]>wrote: > FYI: > > https://issues.apache.org/jira/browse/SMX4-1668 > > > Regards > JB > > On 01/21/2014 09:55 AM, Christian Müller wrote: > >> Hey ServiceMix fellows, >> >> we are using >> org.apache.servicemix.bundles/org.apache.servicemix.bundles. >> derby/10.9.1.0_1 >> in one of our integration projects to mock our dependency in our >> development environment to an Oracle database (to have the abillity to >> test >> with stable test data and without the need to have a connection to the >> database, e.g. because we are travelling). >> In this project we have to call stored procedure and functions. With >> derby, >> you will do it like this: >> >> DDL: >> CREATE FUNCTION Fn_Get_XXX( >> ps_company_id VARCHAR(4), >> ps_first_name VARCHAR(50), >> ps_surname VARCHAR(50), >> ... ) >> RETURNS XXX >> PARAMETER STYLE JAVA >> LANGUAGE JAVA >> READS SQL DATA >> EXTERNAL NAME 'com.company.product.module.xxx.FnGetXXX.findYYY' >> ; >> >> Java implementation: >> package com.company.product.module.xxx >> >> public final class FnGetXXX { >> >> private FnGetXXX() { >> } >> >> public static List<YYY> findYYY(String companyId, String firstName, >> String lastName, ...) { >> YYY yyy = new YYY(); >> yyy.set...; >> >> List<YYY> result = new ArrayList<YYY>(); >> result.add(yyy); >> return result; >> } >> } >> >> Therefore, derby (not our bundle) tries to access the package >> "com.company.product.module.xxx" and fails with: >> Caused by: java.sql.SQLSyntaxErrorException: The class >> 'com.company.product.module.xxx.FnGetXXX' does not exist or is >> inaccessible. This can happen if the class is not public. >> at >> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown >> Source) >> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown >> Source) >> at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) >> at >> org.apache.derby.impl.jdbc.TransactionResourceImpl. >> wrapInSQLException(Unknown >> Source) >> at >> org.apache.derby.impl.jdbc.TransactionResourceImpl. >> handleException(Unknown >> Source) >> at org.apache.derby.impl.jdbc.EmbedConnection. >> handleException(Unknown >> Source) >> at org.apache.derby.impl.jdbc.ConnectionChild. >> handleException(Unknown >> Source) >> at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown >> Source) >> at org.apache.derby.impl.jdbc.EmbedCallableStatement.<init>(Unknown >> Source) >> at org.apache.derby.impl.jdbc.EmbedCallableStatement20.< >> init>(Unknown >> Source) >> at org.apache.derby.impl.jdbc.EmbedCallableStatement30.< >> init>(Unknown >> Source) >> at org.apache.derby.impl.jdbc.EmbedCallableStatement40.< >> init>(Unknown >> Source) >> at org.apache.derby.jdbc.Driver40.newEmbedCallableStatement(Unknown >> Source) >> at org.apache.derby.impl.jdbc.EmbedConnection.prepareCall(Unknown >> Source) >> at org.apache.derby.impl.jdbc.EmbedConnection.prepareCall(Unknown >> Source) >> at >> org.springframework.jdbc.core.CallableStatementCreatorFactory$ >> CallableStatementCreatorImpl.createCallableStatement( >> CallableStatementCreatorFactory.java:167) >> at >> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:947) >> ... 342 more >> Caused by: java.sql.SQLException: The class >> 'com.company.product.module.xxx.FnGetXXX' does not exist or is >> inaccessible. This can happen if the class is not public. >> at >> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown >> Source) >> at >> org.apache.derby.impl.jdbc.SQLExceptionFactory40. >> wrapArgsForTransportAcrossDRDA(Unknown >> Source) >> ... 359 more >> Caused by: java.sql.SQLException: Java exception: >> 'com.company.product.module.xxx.FnGetXXX not found by >> org.apache.servicemix.bundles.derby [191]: >> java.lang.ClassNotFoundException'. >> at >> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown >> Source) >> at >> org.apache.derby.impl.jdbc.SQLExceptionFactory40. >> wrapArgsForTransportAcrossDRDA(Unknown >> Source) >> at >> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown >> Source) >> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown >> Source) >> at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source) >> at >> org.apache.derby.impl.jdbc.TransactionResourceImpl. >> wrapInSQLException(Unknown >> Source) >> ... 356 more >> Caused by: java.lang.ClassNotFoundException: >> com.company.product.module.xxx.FnGetXXX not found by >> org.apache.servicemix.bundles.derby [191] >> at >> org.apache.felix.framework.BundleWiringImpl. >> findClassOrResourceByDelegation(BundleWiringImpl.java:1499) >> at >> org.apache.felix.framework.BundleWiringImpl.access$400( >> BundleWiringImpl.java:75) >> at >> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass( >> BundleWiringImpl.java:1882) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_45] >> at java.lang.Class.forName0(Native Method)[:1.7.0_45] >> at java.lang.Class.forName(Class.java:190)[:1.7.0_45] >> at >> org.apache.derby.impl.services.reflect.ReflectClassesJava2. >> loadClassNotInDatabaseJar(Unknown >> Source) >> at >> org.apache.derby.impl.services.reflect.DatabaseClasses. >> loadApplicationClass(Unknown >> Source) >> at >> org.apache.derby.iapi.services.loader.ClassInspector.getClass(Unknown >> Source) >> at >> org.apache.derby.iapi.services.loader.ClassInspector.accessible(Unknown >> Source) >> at >> org.apache.derby.impl.sql.compile.QueryTreeNode.verifyClassExist(Unknown >> Source) >> at >> org.apache.derby.impl.sql.compile.StaticMethodCallNode. >> bindExpression(Unknown >> Source) >> at >> org.apache.derby.impl.sql.compile.JavaToSQLValueNode. >> bindExpression(Unknown >> Source) >> at >> org.apache.derby.impl.sql.compile.ResultColumn.bindExpression(Unknown >> Source) >> at >> org.apache.derby.impl.sql.compile.ResultColumnList. >> bindExpressions(Unknown >> Source) >> at >> org.apache.derby.impl.sql.compile.RowResultSetNode. >> bindExpressions(Unknown >> Source) >> at >> org.apache.derby.impl.sql.compile.DMLStatementNode. >> bindExpressions(Unknown >> Source) >> at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown >> Source) >> at org.apache.derby.impl.sql.compile.CursorNode. >> bindStatement(Unknown >> Source) >> at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown >> Source) >> at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown >> Source) >> at >> org.apache.derby.impl.sql.conn.GenericLanguageConnectionConte >> xt.prepareInternalStatement(Unknown >> Source) >> ... 352 more >> >> >> At present, our workaround is to use: >> FuseESB:karaf@root> dev:dynamic-import <bundle-id> >> >> I propose to add a dynamic import by default to this OSGI bundle. What do >> you think? >> >> Best, >> Christian >> ----------------- >> >> Software Integration Specialist >> >> Apache Member >> V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer >> Apache Incubator PMC Member >> >> https://www.linkedin.com/pub/christian-mueller/11/551/642 >> >> > -- > Jean-Baptiste Onofré > [email protected] > http://blog.nanthrax.net > Talend - http://www.talend.com >
