小编hal*_*ber的帖子

使用ROUND_HALF_UP的BigDecimal 1.0E + 8/100000000为0

有人可以解释为什么第一行的结果为0?

System.out.println((new BigDecimal("1.0E+8")).divide(new BigDecimal(100000000), BigDecimal.ROUND_HALF_UP));
System.out.println((new BigDecimal("1.0E+8")).subtract(BigDecimal.ONE).divide(new BigDecimal(100000000), BigDecimal.ROUND_HALF_UP));

0E+7
1
Run Code Online (Sandbox Code Playgroud)

java rounding bigdecimal divide

7
推荐指数
1
解决办法
1117
查看次数

GlassFish 3.1.2给出404没有任何部署错误

我尝试将一个非常简单的helloworld.war部署到ubuntu 10.04上的glassfish 3.1.2服务器上.在我的电脑上它工作正常但在我的服务器上我总是得到404页面.我的服务器上没有错误.有人有想法吗?

我注意到另一种奇怪的行为 重启我的服务器后,我无法登录管理控制台.我总是认证失败重新输入您的用户名和密码.当我重新启动glassfish时,它再次起作用.

这听起来很熟悉,但我看不出他的解决方案如何帮助我. glassfish autodeploy为404提供简单的应用程序

[#|2012-12-14T02:53:30.368+0100|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=71;_ThreadName=Thread-2;|uploadFileName=HelloWorld-1.0-SNAPSHOT.war|#]

[#|2012-12-14T02:53:30.605+0100|INFO|glassfish3.1.2|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=135;_ThreadName=Thread-2;|Mojarra 2.1.6 (SNAPSHOT 20111206) für Kontext '/HelloWorld-1.0-SNAPSHOT' wird initialisiert.|#]

[#|2012-12-14T02:53:30.729+0100|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=135;_ThreadName=Thread-2;|WEB0671: Loading application [HelloWorld-1.0-SNAPSHOT] at [/HelloWorld-1.0-SNAPSHOT]|#]

[#|2012-12-14T02:53:30.883+0100|INFO|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=135;_ThreadName=Thread-2;|HelloWorld-1.0-SNAPSHOT was successfully deployed in 482 milliseconds.|#]
Run Code Online (Sandbox Code Playgroud)

的index.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        Hello from Facelets
    </h:body>
</html>
Run Code Online (Sandbox Code Playgroud)

web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name> …
Run Code Online (Sandbox Code Playgroud)

deployment glassfish war http-status-code-404

5
推荐指数
1
解决办法
2183
查看次数