- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 OpenJPA 作为 JPA 提供程序。我已经创建了支持 JPA2.0 的小型 OSGI 包项目。该 bundle 为其客户端提供持久性功能。
我创建了另一个客户端包来使用上述持久性服务。当我使用 Felix 框架 启动客户端捆绑服务时,出现以下错误,
java.lang.NoClassDefFoundError: javax/naming/NamingException
完整的堆栈跟踪
org.osgi.framework.BundleException: Activator start error in bundle StudentServiceConsumer [120].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2027)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)
at org.apache.felix.gogo.command.Basic.start(Basic.java:729)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:89)
at org.apache.felix.gogo.shell.Console.run(Console.java:62)
at org.apache.felix.gogo.shell.Shell.console(Shell.java:203)
at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:128)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:89)
at org.apache.felix.gogo.shell.Activator.run(Activator.java:75)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/naming/NamingException
at com.student.serviceprovider.serviceimpl.StudentDAOService.persist(StudentDAOService.java:19)
at com.student.serviceconsumer.activator.Activator.start(Activator.java:30)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1977)
... 32 more
Caused by: java.lang.ClassNotFoundException: javax.naming.NamingException not found by org.apache.openjpa [109]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 36 more
**java.lang.NoClassDefFoundError: javax/naming/NamingException**
目前波纹管束处于 Activity 状态
ID|State |Level|Name
0|Active | 0|System Bundle (4.0.3)
1|Active | 1|file:/C:/Felix/felix-framework-4.0.3/bundle/junit.jar (0.0.0)
2|Active | 1|Apache Felix Bundle Repository (1.6.6)
3|Active | 1|Apache Felix Gogo Command (0.12.0)
4|Active | 1|Apache Felix Gogo Runtime (0.10.0)
5|Active | 1|Apache Felix Gogo Shell (0.10.0)
7|Active | 1|WS_J2EE_persistence (7.0.0)
105|Active | 1|file:/C:/Felix/felix-framework-4.0.3/bundle/commons-logging-4.0.6.jar (0.0.0)
106|Active | 1|Apache Commons Lang (2.6.0.v201205030909)
107|Active | 1|Apache Commons Logging Plug-in (1.0.4.v201101211617)
109|Active | 1|OpenJPA Plug-in (1.2.1.201001181728)
114|Active | 1|file:/C:/Felix/felix-framework-4.0.3/bundle/rt.jar (0.0.0)
119|Active | 1|StudentServiceProvider (1.0.0.201303061113)
MENIFEST.MF(服务包)
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: StudentServiceProvider
Bundle-SymbolicName: StudentServiceProvider
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.student.serviceprovider.activator.Activator
Import-Package: org.osgi.framework
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Meta-Persistence: META-INF/persistence.xml
Export-Package: com.student.serviceprovider.model,
com.student.serviceprovider.service,
com.student.serviceprovider.serviceimpl
Bundle-ClassPath: ../lib/com.ibm.ws.jpa.jar,
../lib/commons-collections-20040616.jar,
../lib/j2ee.jar,
../lib/mysql-connector-java-5.1.7-bin.jar,
.
Require-Bundle: org.apache.openjpa;bundle-version="1.2.1",
org.apache.commons.logging;bundle-version="1.0.4"
MENIFEST.MF(客户端包)
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: StudentServiceConsumer
Bundle-SymbolicName: StudentServiceConsumer
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.student.serviceconsumer.activator.Activator
Import-Package: com.student.serviceprovider.model,
com.student.serviceprovider.service,
com.student.serviceprovider.serviceimpl,
org.osgi.framework
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: com.student.serviceconsumer.activator
我对 OSGI 包开发还很陌生。请帮我解决这个问题。
最佳答案
您的客户端包需要导入包javax.naming
。将其添加到 Import-Package
指示的导入包列表中。
顺便说一下,在使用 javax.naming
解决问题后,您可能会发现缺少其他依赖项。您真的不应该手写您的 MANIFEST.MF,因为它容易出错并且包含重复信息。您应该使用类似 bnd 的工具或 Bndtools .
更新: 事实上,OpenJPA 本身无法导入包 javax.naming
,如堆栈跟踪的以下部分所示:“javax.naming.NamingException org.apache.openjpa [109] 找不到。
因此,OpenJPA 被破坏了。
关于java - 获取 java.lang.NoClassDefFoundError : javax/naming/NamingException error when I access the OSGI bundle with JPA support,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15239943/
我得到错误: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.Na
我有一个直接使用 Java Transaction API 资源的 hibernate 应用程序。我正在尝试使用 UserTransaction 来完成一些基本的数据库事务 The UserTrans
我尝试向 activemq 发布消息。但是我在 java 应用程序中遇到一个命名异常。这是代码如下 Properties props = new Properties(); props.se
我在 Weblogic 11g 上运行 Java 6。 我正在开发一个使用 EJB 与数据库通信的 Web 服务项目。目前我正在处理错误,因此我尝试在调用 Web 服务之前取消部署 EJB。我的 EJ
我正在使用 maven 跟踪错误 tomcat 7.0.53。我在 server.xml 的 Resource 标签中使用了 factory="org.apache.commons.dbcp.Basi
当我运行以下命令时: package NonServletFiles; import java.sql.Connection; import java.sql.PreparedStatement; i
我新使用 j2ee,当我使用 netbean 6.9 运行这个项目时。我遇到了这个问题 javax.naming.NamingException: Lookup failed for 'java:co
我在 web.xml 中添加了以下内容: ejb/userManagerBean Session gha.ywk.name.entry.ejb.use
我在 machine1 上部署了一个安全的 ejb,当我在同一台机器上运行客户端代码时,它工作正常。但是当我在任何其他机器上运行客户端代码时,它会抛出错误。粘贴在下面。 在错误中可以看出它没有获取所提
我的监听器代码如下 package org.javaimplant.newsfeed.Init; import javax.naming.Context; import javax.naming.In
我有两个项目,第一个是Ejb3项目,名称是SessionBean,另一个是java项目,名称是SessionBeanClient。对于 IDE,我使用 eclipse indigo。我已经完成了代码,
我已经尝试了下面的大量变体来使数据源工作但无济于事。我已经研究/尝试了几天,所以我认输并寻求帮助。不过首先,我很难在这篇文章中格式化我的代码。没有缩进,某些 xml 标记正在消失。可能是愚蠢的 IE
我正在使用 tomcat 和 mysql(ide 是 eclipse)。我正在使用连接池。 在 context.xml 中,我有: 一开始我一直在easyphp中使用mysql(root用户没有p
我有两个实现接口(interface)的无状态 EJB。为了加载实现,我使用了 InitialContext,但它总是失败并出现 NamingException。 界面 package app.ejb
我试图通过一个简单的 jsp 表单来持久化一个实体,但它不起作用。出现的异常是:javax.naming.NamingException: Lookup failed for 'java:global
我是 java EE 的新手。最近我正在开发一个使用 bean stateless 的项目,但出现以下错误 bean : @Stateless(mappedName = "FlightServiceB
我知道这个问题已经被问过很多次了,但即使在遵循所有答案之后我仍然有一个异常(exception)。我的配置是: 上下文.xml web.xml Prod C
我正在使用 wildfly10。这是我的 Java 代码。 private Hashtable mEnv = new Hashtable(); InitialContext e = new Initi
尝试通过 tomcat Context.xml 公开一个 Oracle 连接时,我得到了一个 NamingException。我已经学习了几个教程,但仍然遇到异常。帮助! Java: String e
关于这个问题似乎有几个主题,但还没有找到答案。我对 JSF 很陌生,想创建一个 postgresql 连接池,使用: JSF 2.2.9 Tomcat 8.0.27 但是 tomcat 总是给我一个
我是一名优秀的程序员,十分优秀!