我在 JBoss Application Server 4 中部署了一些应用程序。
我需要知道如何获取该应用程序服务器中已部署的 Web 服务的列表?jmx-console中有任何信息吗?
谢谢
我正在开发一个Android应用程序,它有一些基于java的纯组件,我想用Mockito进行测试.
我有一些关于使用我的代码库配置Mockito的问题.
请建议一些可以演示测试设置和运行的教程.
How can I check if a given file is under other file?
I.e. I have new Paths.get("/foo/bar/") and new Paths.get("./abc/def.jar").
And I want to check whether the second is under /foo/bar.
我可以找出一些基于字符串的比较,例如path.toFile().getAbsolutePath().startsWith(path2.toFile().getAbsolutePath()),但这看起来很脆弱而且不对。
我收到一个HTTP响应,如果一切顺利,它包含一个编码为JSON的数组.
我想获取此数组,过滤掉一些项目,并将传递的项目作为事件处理.
到目前为止我做的是:
return this._http.get(url)
.map((res:Response) => res.json())
.map((data:any) => {
if (!Array.isArray(data) || data.length == 0) {
throw new Error("No items returned, URL: " + url);
}
let projects = <ProjectModel[]>service.fromJSONarray(data, this._http);
return Observable.from(projects)
.filter((project: ProjectModel) => project.parentProject == null)
.subscribe(project -> ...)
})
Run Code Online (Sandbox Code Playgroud)
但是我不喜欢筑巢.我假设有一种方法可以做到这一点:
return this._http.get(url)
.map((res:Response) => res.json())
.map((data:any) => {
...
let projects = <ProjectModel[]>service.fromJSONarray(data, this._http);
???
})
.filter((project: ProjectModel) => project.parentProject == null)
.subscribe(project -> ...)
Run Code Online (Sandbox Code Playgroud)
怎么实现呢?
首先,如果重要的话我会使用Ubuntu linux.
我有一个基于FreeTTS和JSAPI(Java Speech API)的简单项目构思
我已经下载并解压缩FreeTTS并运行他们的构建脚本.然后尝试编译我的代码将lib目录中所需的几个jar链接到类路径中,如下所示:
javac -cp /home/travis/Desktop/freetts-1.2/lib/jsapi.jar:/home/travis/Desktop/freetts-1.2/lib/freetts.jar HelloUnleashedReader.java
Run Code Online (Sandbox Code Playgroud)
然后编译成java字节码就好了.但是,当我跑:
java HelloUnleashedReader
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/speech/EngineModeDesc
Run Code Online (Sandbox Code Playgroud)
关于这个问题的任何帮助将不胜感激,因为网络周围有许多网站讨论让它工作的问题,但讨论解决方案的问题并不多.
我安装了最新的JBoss AS 7(7.0.2)并安装了eclipse工具以将其与WTP连接.我创建了一个"动态Web项目"(没有maven).我试着让"HelloWorld"运行.只有两个班级.
@WebServlet("/HelloWorld")
public class HelloWorldServlet extends HttpServlet {
@Inject
HelloService helloService;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
PrintWriter writer = resp.getWriter();
writer.println("<html><head /><body>");
writer.println("<h1>" + helloService.createHelloMessage("World") + "</h1>");
writer.println("</body></html>");
writer.close();
}
}
public class HelloService {
public String createHelloMessage(String name) {
return "Hello " + name + "!";
}
}
Run Code Online (Sandbox Code Playgroud)
我从eclipse启动服务器,它启动没有错误.但是当从浏览器调用我的servlet(localhost:8080)时,我的代码会抛出一个NPE.
10:28:29,646 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/hello].[hello.HelloWorldServlet]] (http--127.0.0.1-8080-1) Servlet.service() for servlet hello.HelloWorldServlet threw exception: java.lang.NullPointerException
at hello.HelloWorldServlet.doGet(HelloWorldServlet.java:23) [classes:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
[...]
Run Code Online (Sandbox Code Playgroud)
似乎@Inject注释不起作用.如何追查问题?可能是什么原因?
我已经开始努力在torquebox(www.torquebox.org)上实现类似于mod_xsendfile的功能支持.Torquebox基本上是JBoss AS 7上的一堆代码,这使我的努力等同于使sendfile在JBoss AS 7上运行.
这里的主要问题可能是我对JBoss的困惑,但是在浪费了太多时间耗费我所有的谷歌搜索资源之后,我必须相信那里有人确实知道这个东西在AS 7中是如何工作的.
据我了解,JBoss通过使用JBoss Web本机连接器(http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-10)支持sendfile,即APR http连接器.
花了好几个小时没有在AS 7上安装这些,这看起来像其他人的魅力(https://community.jboss.org/message/614790),grep'ing我的本地JBoss目录告诉我,这些本机连接器是显然与AS 7捆绑在一起.在我的情况下,所需的dll被放入
%JBOSS_HOME%\模块\组织\ jboss的\作为\网络\主\ LIB\WIN-x86_64的
如此史诗般的失败,试图安装已经存在的东西.检查我的standalone.xml配置文件还会显示正在使用此本机连接器
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
Run Code Online (Sandbox Code Playgroud)
将所有日志记录级别切换为调试并检查日志会显示日志消息
standalone/log/server.log.2012-02-10:324:23:12:17,964 INFO [org.apache.coyote.http11.Http11AprProtocol](MSC服务主题1-5)在http-127.0上启动Coyote HTTP/1.1 .0.1-127.0.0.1-8080
其中Http11AprProtocol指示使用APR http连接器.但是,网上的很多帖子都提到还应该显示以下行:
org.apache.catalina.core.AprLifecycleListener init INFO:APR功能:IPv6 [true],sendfile [true],接受过滤器[false],random [true].
无论日志记录级别如何,AprLifecycleListener行都不会显示.
当我回顾一下,似乎APR http连接器现在正在使用中.
根据文档,我可以使用以下servlet
public class Sendfile extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
if(Boolean.TRUE == request.getAttribute("org.apache.tomcat.sendfile.support")){
// Send all the files!!
}
else{ …Run Code Online (Sandbox Code Playgroud) 这个JPQL
em.createQuery("INSERT INTO Count (id, count) SELECT 1, ?").setParameter(1, id).executeUpdate();
Run Code Online (Sandbox Code Playgroud)
投
org.hibernate.hql.internal.ast.QuerySyntaxException: expecting OPEN, found ')' near line 1, column 29 [INSERT INTO Count (id, count) SELECT 1, ?]
Run Code Online (Sandbox Code Playgroud)
查询应该如何?
我使用JPA API但实际上是HQL是否重要?JPQL不支持INSERT.
在JBoss AS 7.1.2中使用Hibernate 4.1.6.
参考:http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch11.html#d5e2637
我是全新的shell脚本(实际上只有三天:))所以不要拍我.. !!
在我的脚本中,我有一个看起来像这样的代码:
string="this-is-my-string"
Run Code Online (Sandbox Code Playgroud)
我喜欢修改变量的内容,以便变成这样:
string="This Is My String"
Run Code Online (Sandbox Code Playgroud)
我不寻找将原始字符串修改为修改版本的正则表达式.我已经在这里找到了解决方案.
我正在寻找的是如何使用sed命令修改变量内的文本.说实话,我真的不知道是否有可能sed.如果不能进行修改,sed是否还有其他方法可以达到相同的效果?
TypeScript将某些代码转换为:
Animal.prototype.move = function (distanceInMeters) {
if (distanceInMeters === void 0) { distanceInMeters = 0; }
...
Run Code Online (Sandbox Code Playgroud)
什么void 0?这与用于链接的技巧相同void(0)吗?为什么不undefined改用?
java ×5
javascript ×2
jboss7.x ×2
android ×1
angular ×1
apr ×1
arrays ×1
bash ×1
eclipse ×1
filesystems ×1
freetts ×1
hibernate ×1
insert ×1
jboss ×1
jboss-4.2.x ×1
jpa ×1
jpql ×1
jsapi ×1
junit ×1
mockito ×1
path ×1
reactive ×1
regex ×1
rxjs ×1
sed ×1
sendfile ×1
shell ×1
typescript ×1
void ×1