Ubuntu Focal 上的 JWSGI
我正在尝试运行 uwsgi-doc
中的示例 我正在运行 Ubuntu Focal(完全全新安装 [VM])
这是我安装的所有内容
aptitude install uwsgi-plugin-jvm-openjdk-11 uwsgi-plugin-jwsgi-openjdk-11
,但是当我尝试运行我得到的示例时
[...]
JVM 11.0.14+9-Ubuntu-0ubuntu2.20.04 初始化于 0x555b6858c348 (worker: 1 pid: 5177) 线程“main”中的异常 java.lang.NoClassDefFoundError: uwsgi 引起原因:java.lang.ClassNotFoundException:uwsgi 在 java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) 在 java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) 在 java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
我尝试
import java.util.*;
public class MyApp {
public static Object[] application(HashMap env) {
int status = 200;
HashMap<String,Object> headers = new HashMap<String,Object>();
headers.put("Content-type", "text/html");
// a response header can have multiple values
String[] servers = {"uWSGI", "Unbit"};
headers.put("Server", servers);
String body = "<h1>Hello World</h1>" + env.get("REQUEST_URI");
Object[] response = { status, headers, body };
return response;
}
}
使用该命令
./uwsgi --socket /tmp/uwsgi.socket --plugins jvm,jwsgi --jwsgi MyApp:application --threads 40
运行此代码(它确实编译),但即使运行此命令(没有指定类和方法)
uwsgi --socket /tmp/uwsgi.socket --plugins jvm,jwsgi --threads 40
我得到完全相同的错误......
有人知道这是为什么吗?
或者我做错了什么?
提前谢谢!
I am trying to run the example from uwsgi-doc
I am running Ubuntu Focal (completely fresh install [VM])
here is everything that i install
aptitude install uwsgi-plugin-jvm-openjdk-11 uwsgi-plugin-jwsgi-openjdk-11
but when i try to run the examples i get
[...]
JVM 11.0.14+9-Ubuntu-0ubuntu2.20.04 initialized at 0x555b6858c348 (worker: 1 pid: 5177)
Exception in thread "main" java.lang.NoClassDefFoundError: uwsgi
Caused by: java.lang.ClassNotFoundException: uwsgi
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
i am trying to run this code (it does compile)
import java.util.*;
public class MyApp {
public static Object[] application(HashMap env) {
int status = 200;
HashMap<String,Object> headers = new HashMap<String,Object>();
headers.put("Content-type", "text/html");
// a response header can have multiple values
String[] servers = {"uWSGI", "Unbit"};
headers.put("Server", servers);
String body = "<h1>Hello World</h1>" + env.get("REQUEST_URI");
Object[] response = { status, headers, body };
return response;
}
}
with the command
./uwsgi --socket /tmp/uwsgi.socket --plugins jvm,jwsgi --jwsgi MyApp:application --threads 40
but even running this command (without the class and method specified)
uwsgi --socket /tmp/uwsgi.socket --plugins jvm,jwsgi --threads 40
i get the exact same error....
anyone know why that is?
or what i am doing wrong?
thx in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,发现有一个 --jvm-classpath 开关和一个 uwsgi.jar
/usr/share/java/uwsgi.jar
我不好,抱歉!
sorry, figured it out there is a --jvm-classpath switch and a uwsgi.jar at
/usr/share/java/uwsgi.jar
my bad, sorry!