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到底有否打进去
前几天也碰到了依赖打不进去的问题。这样能快速排查出来