Hello, I have some issues with a function. I'm almost sure it is a "user error" somewhere in my setup, however cannot determine it yet. Will try to explain.
I have an integration tests which boots up an Apache Karaf and executes commands on it via SSH. This Karaf is connected to an H2 database (let's say - "karafdb"). From within the test itself I am trying to create a new H2 function in the karafdb. To do this, I currently get a java.sql.Connection via JDBC, using the AUTO_SERVER=true connection property. Then execute the following statements: DROP ALIAS IF EXISTS DBFill; CREATE ALIAS DBFill FOR "cspu.it.H2Procedures.dbFill"; (cspu is an abbreviated package name). Then I get the following error: org.h2.jdbc.JdbcSQLSyntaxErrorException: Class "com.seeburger.portal.ums.it.H2Procedures" not found; SQL statement: DROP ALIAS IF EXISTS DBFill; [90086-200] at org.h2.message.DbException.getJdbcSQLException(DbException.java:576) at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) at org.h2.message.DbException.get(DbException.java:194) at org.h2.util.JdbcUtils.loadUserClass(JdbcUtils.java:199) at org.h2.engine.FunctionAlias.loadClass(FunctionAlias.java:138) at org.h2.engine.FunctionAlias.load(FunctionAlias.java:114) at org.h2.engine.FunctionAlias.init(FunctionAlias.java:99) at org.h2.engine.FunctionAlias.newInstance(FunctionAlias.java:73) at org.h2.command.ddl.CreateFunctionAlias.update(CreateFunctionAlias.java:48) at org.h2.command.CommandList.executeRemaining(CommandList.java:50) at org.h2.command.CommandList.update(CommandList.java:67) at org.h2.command.Command.executeUpdate(Command.java:251) at org.h2.server.TcpServerThread.process(TcpServerThread.java:406) at org.h2.server.TcpServerThread.run(TcpServerThread.java:183) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.lang.ClassNotFoundException: cspu.it.H2Procedures not found by com.h2database [48] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1565) at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:78) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1950) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:315) at org.h2.util.JdbcUtils.loadUserClass(JdbcUtils.java:192) ... 11 more at org.h2.message.DbException.getJdbcSQLException(DbException.java:576) at org.h2.engine.SessionRemote.done(SessionRemote.java:611) at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:237) at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:228) at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:201) at cspu.it.UMSSyncBulkRoundtripIT.createDBFillProcedure(UMSSyncBulkRoundtripIT.java:332) ... at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451) The class H2Procedures, which H2 cannot find is in the same package as the test class (UMSSyncBulkRoundtripIT), only H2Procedures is in the maven source folder (not the test folder). If possible, I would prefer to get this running, so to create a function from an existing compiled class. This is because my Java source function is pretty large and contains class fields and several private methods. I saw another possibility is to define the function directly as source code. If that would be the "solution", are such fields and additional private methods supported in such as source code approach syntax? If yes, how ? Sorry for the long text, any help would be appreciated! Regards, Vassil -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/h2-database/2289dedc-0f0d-4383-9fef-924681c3d1fen%40googlegroups.com.
