h5调java的jar包_java 打包后引用jar包方法找不到

IDEA 上运行是ok的,打jar包部署到服务器或者本机,就报错,应用的tibco jar包貌似没

打包进来,百度各种方式都试了。

可留联系方式,解决了发红包。

启动 代码

@SpringBootApplication

@ServletComponentScan(basePackages = “com.fdcweb.filter”)

@EnableAutoConfiguration

@EnableScheduling

@EnableAsync

public class FdcwebApplication {

public static void main(String[] args) {

SpringApplication.run(FdcwebApplication.class, args);

String service = "1200";

String network = ";225.19.19.12";

String daemon = "7500";

String subject = "cm.test";

RvlistenerDemo rl = new RvlistenerDemo(service, network, daemon, subject);

}

}

报错信息

Exception in thread “main” java.lang.reflect.InvocationTargetException

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.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)

at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)

at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)

at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)

Caused by: java.lang.NoClassDefFoundError: com/tibco/tibrv/TibrvMsgCallback

at java.lang.ClassLoader.defineClass1(Native Method)

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$100(Unknown Source)

at java.net.URLClassLoader$1.run(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 org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)

at java.lang.ClassLoader.loadClass(Unknown Source)

at com.fdcweb.FdcwebApplication.main(FdcwebApplication.java:24)

… 8 more

Caused by: java.lang.ClassNotFoundException: com.tibco.tibrv.TibrvMsgCallback

at java.net.URLClassLoader$1.run(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 org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)

at java.lang.ClassLoader.loadClass(Unknown Source)

… 21 more

回答

pom.xml的打jar包换成这种:

org.apache.maven.plugins

maven-jar-plugin

3.2.0

true

codes.showme.mavenrepocrawler.Crawler

org.apache.maven.plugins

maven-dependency-plugin

copy

package

copy-dependencies

–>

${project.build.directory}/lib–>

–>

–>

然后Teminal 输入mvn clean install

然后会在targer目录生成一个dependency的目录。在里面查看所有依赖的jar到底有否打进去

前几天也碰到了依赖打不进去的问题。这样能快速排查出来

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值