简体   繁体   English

ActiveJDBC检测:无法检测Jar中的模型类

[英]ActiveJDBC Instrumentation: Unable to instrument the model classes which are in Jar

I am using activejdbc 1.4.9. 我正在使用activejdbc 1.4.9。 I created one jar (using maven) which has two ActiveJDBC Model Classes. 我创建了一个jar(使用maven),它具有两个ActiveJDBC模型类。 I added the jar to the application. 我将罐子添加到应用程序中。 Application has three more model classes. 应用程序还有三个模型类。 When I compile and try to run the application (gradle based), activejdbc is instrumenting only 3 classes which are in application but not instrumenting the classes which are in jar. 当我编译并尝试运行应用程序(基于渐变)时,activejdbc仅检测应用程序中的3个类,而不检测jar中的类。 When I try to write the data into the two models which are in jar, It is throwing exception as 当我尝试将数据写入jar中的两个模型时,它抛出异常

org.javalite.activejdbc.DBException: Failed to retrieve metadata from DB. org.javalite.activejdbc.DBException:无法从数据库检索元数据。 Are you sure table exists in DB ? 您确定数据库中存在表吗?

Now I have certain doubts. 现在我有一些疑问。 Please help me to resolve and understand few things. 请帮助我解决和了解几件事。

  1. How instrumentation happens ? 仪器如何发生?
  2. When we create a jar, will it include instrumented classes ? 当我们创建一个jar时,它会包含检测类吗?
  3. Why it is throwing this error ? 为什么会引发此错误?

It is throwing this error in case classes have not been instrumented. 如果未检测类,则会引发此错误。 This means that before placing your model classes into a jar file, you need to instrument them. 这意味着在将模型类放入jar文件之前,需要对其进行检测。 Does not matter which build method you use though. 不管使用哪种构建方法都没有关系。 This http://javalite.io/instrumentation explains what is instrumentation and how to do it. http://javalite.io/instrumentation解释了什么是工具以及如何执行。 Instrumentation does not create jars, it merely adds some byte code into your classes. 检测不会创建jar,而只是将一些字节代码添加到您的类中。 In all scenarios you need: 在所有情况下,您都需要:

  1. Write code :) 写代码:)
  2. Compile
  3. Instrument 仪器

after this, you can do any of the following: 之后,您可以执行以下任一操作:

  • run app using class files in the file system 使用文件系统中的类文件运行应用
  • package class files into jar file and use that on your classpath 将类文件打包到jar文件中,并在类路径上使用
  • package jar file into a larger app (WAR, EAR, RAR, etc.) and deploy your app 将jar文件打包到更大的应用程序(WAR,EAR,RAR等)中,然后部署您的应用程序

making sense? 有道理?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有Eclipse调试功能的ActiveJDBC工具 - ActiveJDBC instrumentation with Eclipse debug Cobertura无法仪器 - Cobertura Unable to Instrument Gradle 和 JaCoCo:来自单独子项目的仪器类 - Gradle and JaCoCo: instrument classes from a separate subproject 将目录添加到jar,用于插入外部jar或类 - Add directory to the jar which will be for insert external jars or classes 无法执行从gradle构建的jar文件(包含依赖项) - unable to execute jar file(consists dependencies), which is build from gradle 无法找到检测目标包firebase错误 - Unable to find instrumentation target package firebase error 如何为字节码检测设置Intellij / jar清单? - How do I set up Intellij / jar manifests for bytecode instrumentation? Intellij构建错误:任务':classes'的执行失败,@ NotNull检测失败 - Intellij build error: Execution failed for task ':classes' @NotNull instrumentation failed 错误:任务 ':app:packageRelease' 的执行失败。 > 无法计算 /../AndroidStudioProjects/../classes.jar 的哈希值 - Error:Execution failed for task ':app:packageRelease'. > Unable to compute hash of /../AndroidStudioProjects/../classes.jar 无法检测文件:java.lang.NoClassDefFoundError android / content / ComponentCallbacks - Unable to instrument file: java.lang.NoClassDefFoundError android/content/ComponentCallbacks
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM