NutzCN Logo
问答 dubbo main启动
发布于 206天前 作者 tiankongkm 242 次浏览 复制 上一个帖子 下一个帖子
标签:

0.0 请问大佬 dubbo在生产环境用main启动,应该如何写,是新启动一个线程还是?

16 回复

main启动?那估计没有mvc了吧? 开不开线程都一样

public class DubboStart {

	public static void main(String[] args) throws IOException {		
		ComboIocLoader loader;
		try {
			loader = new ComboIocLoader("*anno", "com.tiankong","*json", "config/ioc/", "*async", "48","*dubbo", "dubbo-provider.xml");
			Ioc ioc = new NutIoc(loader);
			Server.getInstance().setIoc(ioc);
			Server.getInstance().init();
		} catch (Exception e) {
			System.out.println("服务启动失败。。。");
			e.printStackTrace();
		}
		
	}

}

生产环境这样写能行吗。。

@tiankongkm 不报错就是可以啦

@wendal 奥奥,总担心出问题。怕怕的-。-

[ERROR] 21:49:06.957 org.nutz.boot.NbApp.execute(NbApp.java:218) - something happen!!
org.nutz.ioc.IocException: IocBean[dubboManager] For object [dubboManager] - type:[class org.nutz.integration.dubbo.DubboManager]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:250)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161)
at org.nutz.boot.starter.dubbo.DubboStarter.start(DubboStarter.java:17)
at org.nutz.boot.AppContext.startServers(AppContext.java:306)
at org.nutz.boot.NbApp.execute(NbApp.java:204)
at org.nutz.boot.NbApp.run(NbApp.java:177)
at cn.wizzer.app.sys.commons.core.DubboRpcSysMainLauncher.main(DubboRpcSysMainLauncher.java:39)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'dubboManager' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:157)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:195)
... 7 more
[INFO ] 21:49:06.962 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:287) - org.nutz.ioc.impl.NutIoc@1902260856 is closing.

linux发布sys模块为jar包 jar命令运行jar包 提示 如上?请问是什么原因?

如何打包的? 给出完整命令


maven-assembly-plugin


jar-with-dependencies




cn.wizzer.app.sys.commons.core.DubboRpcSysMainLauncher



请问应该如何打包?我用的是ide+maven

mvn clean package nutzboot:shade

linux 运行 java -jar wk-nb-service-sys-5.0.1-SNAPSHOT-jar-with-depen dencies.jar
wk-nb-service-sys 打包:
run as --maven build...---goals--package

报错:
[ERROR] 21:55:35.889 org.nutz.boot.NbApp.execute(NbApp.java:218) - something hap pen!!
org.nutz.ioc.IocException: IocBean[dubboManager] For object [dubboManager] - typ e:[class org.nutz.integration.dubbo.DubboManager]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:250)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161)
at org.nutz.boot.starter.dubbo.DubboStarter.start(DubboStarter.java:17)
at org.nutz.boot.AppContext.startServers(AppContext.java:306)
at org.nutz.boot.NbApp.execute(NbApp.java:204)
at org.nutz.boot.NbApp.run(NbApp.java:177)
at cn.wizzer.app.sys.commons.core.DubboRpcSysMainLauncher.main(DubboRpcS ysMainLauncher.java:39)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'dubboManager' without defin e!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:157 )
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:195)
... 7 more
[INFO ] 21:55:35.894 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:287) - org.nutz

请问是什么问题?

mvn console下面执行咯

无论是贴代码还是日志, 记得按 "插入代码或日志片段"按钮啊

assembly是不行的, 得用nutzboot:shade打包

package生成jar, 然后nutzboot:shade会把依赖jar合并进去

具体写法取决于pom.xml里面有无声明nutzboot-maven-plugin

添加回复
请先登陆
回到顶部