标签: classpath

如何在Glassfish上的Metro上选择CXF

我在Glassfish下运行我的企业应用程序时遇到以下问题(由其他人报告).在Jetty下它工作正常.

javax/xml/ws/spi/Provider提到创建META-INF/services/javax.xml.ws.spi.Provider资源,但这已经提供给CXF并且创建一个额外的资源文件并不能解决Glassfish下的这个问题.

有谁知道如何确保在GlassFish下使用CXF?
(我正在使用具有CXF依赖性2.2.5的Maven多模块项目)

谢谢!
蒂姆


编辑#1

暂时解决问题,只是使用Metro,但我真的很想知道如何使用CXF,如果有人有任何指示..如果没有任何作用我可能必须切换Web应用程序容器(或看看Metro填补我的要求)


编辑#2

一些解决方案通过添加<class-loader delegate="false"/>到sun-web.xml文件来详细说明war的修复.但是,这对非战争ee应用程序不起作用.

cxf glassfish java-metro-framework jax-ws classpath

6
推荐指数
2
解决办法
6542
查看次数

如何在R中设置rJava的类路径?

我有一个R包,包含几个jar文件.为了更好的维护,我想将罐子分开放在一个单独的包装中,并在主包装中放置R源和两个小罐子.
但是现在我总是从rJava获得一个"NoClassDefFoundError",如果我调用我的函数的话.

在主程序包中,我有一个onLoad函数,它使用.jpackage函数启动JVM.
根据帮助,这个函数接受一个"morePaths"参数,我提供了两个jar文件的绝对路径.但它不会起作用.

我也试过用

jar.one = paste(lib,pkg,"java","One.jar",sep=.Platform$file.sep)
jar.two = paste(lib,pkg,"java","Two.jar",sep=.Platform$file.sep)
.jinit(classpath=c(jar.one,jar.two))
Run Code Online (Sandbox Code Playgroud)

在onLoad函数里面.


马丁,任何提示都会受到赞赏

r classpath

6
推荐指数
1
解决办法
6066
查看次数

在Mac OS中将JAR添加到CLASSPATH

我正在尝试在Mac OS下设置CLASSPATH for Java.

具体来说,我正在尝试添加几个JAR存档.

如果我这样做:

## Setting up ASM bytecode instructor library
export CLASSPATH=$CLASSPATH:/Users/fork/Dev/ASM/lib/all/asm-all-3.3.1.jar
Run Code Online (Sandbox Code Playgroud)

它工作正常.但是,如果我像文档建议那样设置它:

## Setting up ASM bytecode instructor library
export CLASSPATH=$CLASSPATH:/Users/fork/Dev/ASM/lib/all/*
Run Code Online (Sandbox Code Playgroud)

它似乎不起作用.

问题是我要添加,比如说10个罐子,一个一个地添加听起来是不切实际的.

有解决方案吗?

java macos classpath

6
推荐指数
1
解决办法
1万
查看次数

NoClassDefFoundError:混合Scala/Java项目中的scala/ScalaObject

背景:我是一名C#开发人员,但我的下一个项目需要在JVM上.我研究过Scala,我认为它让我能够用C#(Lambdas,推断类型,功能风格等)来实现.我将自己归类为一个非常新手的Java开发人员......特别是在使用IDE等时.

我有一个似乎有效的Scala项目......我创建了一个Java项目并引用了Scala项目编辑器似乎知道Scala项目中的类(typeahead等)

当我尝试运行Java项目时,我收到此错误:

Exception in thread "main" java.lang.NoClassDefFoundError: scala/ScalaObject
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at learning_scala.java.Main.main(Main.java:12)
Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
Run Code Online (Sandbox Code Playgroud)

很明显,Java/Scala编译中出现了一些问题,但我不知道如何解决它(我缺乏Java经验是这里的罪魁祸首)

我正在使用带有官方Scala插件的Eclipse ......所有这些都是2-3天前的最新版本.

谢谢

java eclipse scala classpath scala-ide

6
推荐指数
1
解决办法
4698
查看次数

java.lang.ClassNotFoundException:org.jboss.logging.Logger

我有一个奇怪的问题.

我有一个JMS客户端应用程序和一个在Jboss jboss-5.1.0.GA中配置的MDB.之前我通过"配置构建路径" - >"添加外部罐子"添加了jar,一切正常.

现在,我将所有罐子移动到我项目下的lib文件夹中,并使用"配置构建路径" - >"添加罐子".

现在,我在执行客户端程序时遇到以下异常.:(

`Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at org.jnp.interfaces.NamingContext.<clinit>(NamingContext.java:160)
at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:56)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at com.dcat2.messaging.sendreceive.MessageReceiver_test.sendMessage(MessageReceiver_test.java:68)
at com.dcat2.messaging.sendreceive.MessageReceiver_test.main(MessageReceiver_test.java:57)
`Caused by: java.lang.ClassNotFoundException: org.jboss.logging.Logger
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more`
Run Code Online (Sandbox Code Playgroud)

我在类路径和以下jar中有jndi.properties.

jbossall-client.jar
commons-logging.jar
concurrent.jar
javax.ejb.jar
jms.jar
jnp-client-4.2.2.GA.jar
log4j-1.2.16.jar
sqljdbc4.jar
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮忙吗?

java eclipse classpath

6
推荐指数
1
解决办法
3万
查看次数

Java类路径通配符不能在没有引号的情况下工作

我有一个包含大量jar文件和类路径的文件夹:

-classpath ./classes:./jogamp-all-platforms/jar/*
Run Code Online (Sandbox Code Playgroud)

但它找不到包装.为了确保我有资源,我手动找到包含它的jar并将类路径更改为:

-classpath ./classes:./jogamp-all-platforms/jar/jogl-all.jar
Run Code Online (Sandbox Code Playgroud)

而现在它并没有抱怨找不到包裹.

java classpath

6
推荐指数
1
解决办法
4870
查看次数

Clojure REPL无法在Windows命令提示符下启动

我在我的CLASSPATH环境变量中放置了clojure-1.4.0.jar路径(C:\ clojure-1.4.0\clojure-1.4.0.jar).现在,当我尝试使用以下代码从命令行启动REPL时:

java -cp clojure-1.4.0.jar clojure.main

我收到一个错误:

Error: Could not find or load main class clojure.main
Run Code Online (Sandbox Code Playgroud)

它曾经在我设置emacs之前工作.有任何想法吗.

java emacs clojure classpath read-eval-print-loop

6
推荐指数
1
解决办法
2382
查看次数

为什么在WebSphere Liberty Profile启动时找不到清单类路径条目?

使用WebSphere Liberty Profile(版本2013.11.0.0 - 8.5.5.Next Alpha和扩展内容)启动我的应用程序时,会出现很多警告:

W SRVE9967W: The manifest class path dhbcore.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path jms.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path com.ibm.mq.jmqi.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path dhbcore.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: …
Run Code Online (Sandbox Code Playgroud)

manifest classpath websphere-liberty

6
推荐指数
1
解决办法
8077
查看次数

为什么ClassLoader.getResourceAsStream()会返回null?

故意破坏下面的代码以识别NullPointerException的来源,这应该是非常简单的,但结果却让我疯狂:

Properties properties = new Properties();
Thread currentThread = Thread.currentThread();
ClassLoader contextClassLoader = currentThread.getContextClassLoader();
InputStream propertiesStream = contextClassLoader.getResourceAsStream("resource.properties");
if (propertiesStream != null) {
  properties.load(propertiesStream);
  // TODO close the stream
} else {
  // Properties file not found!
}
Run Code Online (Sandbox Code Playgroud)

我收到"未找到属性文件!" 错误,即contextClassLoader.getResourceAsStream("resource.properties"); 返回null.

这是一个基于CXF的客户端和我验证了"resource.properties"文件是在当前目录中的客户端的jar驻留(和运行).

我还通过包含以下诊断代码验证了绝对路径:

            File file = new File("resource.properties");
            System.out.println(file.getAbsolutePath());
Run Code Online (Sandbox Code Playgroud)

绝对路径指向客户端jar的位置.

我也尝试使用以下方法找出类加载器的上下文:

  System.out.println(Thread.currentThread().getContextClassLoader());
Run Code Online (Sandbox Code Playgroud)

但相反,这里演示了一些目录结构,我得到的是:

com.simontuffs.onejar.JarClassLoader@1decdec

为什么ClassLoader.getResourceAsStream()会返回null?

我错过了什么?

java cxf jar classpath onejar

6
推荐指数
1
解决办法
1万
查看次数

jar中的@PropertySource用于类路径上的外部文件

我正在尝试@PropertySource在Jar中使用Spring框架的注释来从jar外部加载属性文件,但它没有找到该文件.

我需要将属性文件放在Jar的外部,以便进行编辑.我不知道文件的确切位置,我想我可以把它放在类路径的任何地方.

我在Config课堂上使用以下注释.

@PropertySource('classpath:stc.properties')
Run Code Online (Sandbox Code Playgroud)

并stc.properties与创建的Jar文件放在同一目录中.我尝试在java命令中显式指定类路径,但它仍然无法找到该文件:

java -cp . -jar stc.jar
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load bean class: com.example.stc.Config; nested exception is java.io.FileNotFoundException: class path resource [stc.properties] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:162)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:299)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
[...]
Run Code Online (Sandbox Code Playgroud)

等等.

我也尝试使用./类路径,并尝试Class-Path在jar的清单的属性中指定类路径(包含两个变体),但它总是给出相同的结果.

java spring jar classpath properties-file

6
推荐指数
3
解决办法
2万
查看次数