3

我一直在尝试使用 Roo 1.3.1 当前版本设置 DRBE 项目。我还在最新 Eclipse 版本的 STS 最新版本中设置了项目,所有全新安装以避免冲突。然后我通过 Roo shell 设置 JPA、用户、数据库和密码,然后尝试获取数据库模式。Roo 抱怨没有正确的 jdbc 驱动程序并建议下载它。我这样做了,但不幸的是,由于 slf4j-nop 和 slf4j-api 的一些未满足的依赖关系,Roo 无法安装它。

我也尝试单独安装依赖项,但它们都相互之间存在循环依赖关系,因此无法安装 jdbc 驱动程序(至少目前如此)

roo> jpa setup --provider HIBERNATE --database MYSQL
roo> database properties set --key database.url --value jdbc:mysql://localhost:3306/dbdb
roo> database properties set --key database.password --value $$$$
roo> database properties set --key database.username --value uuuu
roo> database reverse engineer --package ~.model --schema PUBLIC --includeNonPortableAttributes
Located add-on that may offer this JDBC driver
1 found, sorted by rank; T = trusted developer; R = Roo 1.3 compatible
ID T R DESCRIPTION -------------------------------------------------------------
01 Y Y 5.1.18.0001 #jdbcdriver driverclass:com.mysql.jdbc.Driver. This...
--------------------------------------------------------------------------------
[HINT] use 'addon info id --searchResultId ..' to see details about a search result
[HINT] use 'addon install id --searchResultId ..' to install a specific search result, or
[HINT] use 'addon install bundle --bundleSymbolicName TAB' to install a specific add-on version
JDBC driver not available for 'com.mysql.jdbc.Driver'
roo> addon install id --searchResultId 01
roo> Target resource(s):
-------------------
   Spring Roo - Wrapping - mysql-connector-java (5.1.18.0001)

Required resource(s):
---------------------
slf4j-nop (1.6.1)
slf4j-api (1.6.1)

Deploying...
done.

但它确实没有部署任何东西或解决依赖关系。我处于一个循环中,每次我尝试对数据库进行逆向工程时,它都会要求我安装 jdbc 包。它要求我安装捆绑包。我愿意。它说它已经部署了捆绑包,但它没有。我重试...等等。

如果我启动一个旧的 1.2.5.RELEASE Roo shell,我碰巧已经安装了它,甚至没有要求我在 Roo 上安装任何包(我想我在过去的某个时候已经做过)

我也试过用osgi安装

roo> osgi obr url add --url http://spring-roo-repository.springsource.org/repository.xml
roo> osgi obr start --bundleSymbolicName org.springframework.roo.wrapping.mysql-connector-java

但它引发了我抱怨 MalformedURLException 的异常,因为捆绑名称上没有协议......

org.osgi.framework.BundleException: Unable to cache bundle: org.springframework.roo.wrapping.mysql-connector-java
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2870)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:138)
    at org.apache.felix.gogo.command.Basic.start(Basic.java:724)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:137)
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:92)
    at org.springframework.roo.felix.FelixDelegator.perform(FelixDelegator.java:234)
    at org.springframework.roo.felix.FelixDelegator.obrStart(FelixDelegator.java:167)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:47)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:325)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:71)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:44)
    at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:242)
    at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:149)
    at org.springframework.roo.shell.eclipse.EclipseShell.executeCommand(EclipseShell.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:202)
    at org.springframework.ide.eclipse.core.java.ClassUtils.invokeMethod(ClassUtils.java:137)
    at org.springframework.ide.eclipse.core.java.ClassUtils.invokeMethod(ClassUtils.java:97)
    at org.springframework.roo.shell.eclipse.Bootstrap.execute(Bootstrap.java:90)
    at org.springframework.ide.eclipse.roo.ui.internal.RooShellTab$CommandJob.run(RooShellTab.java:588)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.net.MalformedURLException: no protocol: org.springframework.roo.wrapping.mysql-connector-java
    at java.net.URL.<init>(URL.java:586)
    at org.apache.felix.framework.util.SecureAction.createURL(SecureAction.java:254)
    at org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:148)
    at org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:77)
    at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:878)
    at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
    at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
    at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2866)
    ... 38 more
java.net.MalformedURLException: no protocol: org.springframework.roo.wrapping.mysql-connector-java

我还尝试清理 .m2 文件夹,以防万一 maven 本地 repo 损坏了某些东西的版本……但没有运气。它现在发布了 Roo shell 抱怨并要求发布 1.6.1 的这些 slf4j 库的 1.7.5 版

我在过去的项目中使用 Springsource 和 Roo 来加快我的开发速度,但这并没有让我加快速度......

提前感谢任何愿意阅读本文的人:)

注意:我可以让它工作的唯一方法是从MySQL 的网站手动下载 jdbc 驱动程序,解压缩并通过 osgi 将其推送到 Roo shell。

roo> osgi start --url file:///Users/..../Downloads/mysql-connector-java-5.1.35/mysql-connector-java-5.1.35-bin.jar

是的,我现在可以工作了,但是 Spring 和 Spring Roo 不就是一个可以加快我们的开发周期的框架和工具吗?我是不是搞错了什么?jdbc 连接这么少见吗?

我仍然想知道是否有更好/更简单/自动的方法来做到这一点。

4

0 回答 0