jdk1.7发送不了post请求 jdk1.8却可以

发送post方法:
public static String doPost(String url, String params) throws Exception {

    CloseableHttpClient httpclient = HttpClients.createDefault();
    HttpPost httpPost = new HttpPost(url);// 创建httpPost   
    httpPost.setHeader("Accept", "application/json"); 
    httpPost.setHeader("Content-Type", "application/json");
    String charSet = "UTF-8";
    StringEntity entity = new StringEntity(params, charSet);
    httpPost.setEntity(entity);        
    CloseableHttpResponse response = null;

    try {

        response = httpclient.execute(httpPost);
        StatusLine status = response.getStatusLine();
        int state = status.getStatusCode();
        if (state == HttpStatus.SC_OK) {
            HttpEntity responseEntity = response.getEntity();
            String jsonString = EntityUtils.toString(responseEntity);
            return jsonString;
        }
        else{
            // logger.error("请求返回:"+state+"("+url+")");
        }
    }
    finally {
        if (response != null) {
            try {
                response.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        try {
            httpclient.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return null;
}

1.7:
Exception in thread "main" java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:196)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
at sun.security.ssl.InputRecord.read(InputRecord.java:480)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.tempuri.HttpUtilA.doPost(HttpUtilA.java:77)
at org.tempuri.HttpUtilA.main(HttpUtilA.java:58)

1.8:
{
"bindingUser" : null,
"id" : "e5e404dd-e2d8-4988-be49"
}

1个回答

HttpPost 用的是哪个 jar 包,看看它的版本,找与 jdk1.7 对应的版本试试。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
jboss7.1和eclipse4.3+jdk1.7部署項目運行出錯
1. 14:56:37,166 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-11) MSC00001: Failed to start service jboss.deployment.unit."ABSAppian.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ABSAppian.jar".POST_MODULE: Failed to process phase POST_MODULE of deployment "ABSAppian.jar" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] 2. Caused by: java.lang.RuntimeException: Error getting reflective information for class com.nmg.service.contract.ContractReportService with ClassLoader ModuleClassLoader for Module "deployment.ABSAppian.jar:main" from Service Module Loader at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58) at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85) at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70) at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] ... 5 more 3. Caused by: java.lang.NoClassDefFoundError: jxl/biff/DisplayFormat at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_51] at java.lang.Class.privateGetDeclaredFields(Class.java:2397) [rt.jar:1.7.0_51] at java.lang.Class.getDeclaredFields(Class.java:1806) [rt.jar:1.7.0_51] at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] ... 10 more 4. Caused by: java.lang.ClassNotFoundException: jxl.biff.DisplayFormat from [Module "deployment.ABSAppian.jar:main" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA] at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA] at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA] at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA] at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA] ... 15 more 注:jxl包我已經放在lib下了,但還是報錯。
Guard 的设计的问题
Problem Description The Bluewater Security Company provides guards for clients with valuable possessions. Bluewater has found that clients are interested in having guards posted where they can see everything that is valuable merely by turning their heads, and also like guards to be posted particularly close to particularly valuable items. A sample site layout is shown above. Ignore the three black dots for now. Various locations are labeled and assigned values. For instance location A at coordinates (0,8) is the position of an item with value 4. Locations showing a value 0, like G, do not have a valuable item. The straight lines indicate corridors. For simplicity, corridors are modeled as line segments with 0 width. A guard at an intersection point of several corridors can see and therefore guard the items on each of the corridors. If Bluewater were contracted to supply 3 guards, they might choose to post them at the positions indicated with the small black dots. The guard not at an already labeled position is at (15.5, 6). To model the desire for guards to be closer to items of higher value, Bluewater calculates the risk to a valuable item to be the value of the item times the minimum distance to a guard that can see the item. Even if a guard is close to an item that is around a corner, that guard does not affect the risk to the item, since the guard cannot see around a corner. In the diagram shown, the risks to the items are A: 4x5=20, C: 4x2.5=10, D: 2x0=0, .... The largest risks are for H: 50x7.5=375 and I: 50x7.5=375, so the maximum risk to any one item is 375. With this site layout, no arrangement of 3 guards would provide a lower maximum risk, so this arrangement of 3 guards minimizes the maximum risk. Bluewater would like to be able to tell any client who requests a particular number of guards for a particular site layout, what the minimized maximum risk will be. Input The input will consist of one to sixteen data sets, followed by a line containing only 0. On each line the data will consist of blank separated tokens. The first line of a dataset contains integers p c g, where p is the number of points specified, c is the number of corridors, and g is the number of guards to be placed. Constraints are 1< p < 12; 0 < c < 12; 0 < g < 5. Next in the dataset are a total of p groups of four tokens, each consisting of a capital letter and three nonnegative integers L x y v indicating the point (x, y) with label L contains an item with value v. If p is no greater than 6, these groups will all be on one line. If p is greater than 6, then the seventh and further groups will be on the next line. Labels will be consecutive letters starting from A. All the numbers are less than 1000. Each of the points is unique. A value of 0 for v means there is no item of value there. The number of locations with items of value will be at least as large as the number of guards. The last line of a dataset contains c strings of letters, one for each corridor. For each corridor the letters are labels for points along the corridor, in order along the line segment from one end to the other, including both endpoints, all intersection points with other corridors, and all locations on the corridor with a valuable item. Each of the points given in the dataset will lie on at least one of the corridors. Output There is one line of output for each data set. If there are not enough guards supplied to be able to see all the valuables, the line is "too few guards". Otherwise the line is an unsigned number r rounded to two places beyond the decimal point, where r is the minimum value over all placements of g guards of the maximum "risk" to the valuables. Sample Input 11 5 3 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 2 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 1 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 4 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 3 3 1 A 0 0 50 B 0 3 60 C 4 0 20 AB CB CA 0 Sample Output 375.00 1250.00 too few guards 21.21 150.00
SSM框架用ajax提交数据 get正常post 404
程序在本地运行都没有问题,放在云服务器上后就这样了,服务器环境与本地一致,tomcat 7,jdk 1.7![图片说明](https://img-ask.csdn.net/upload/201902/26/1551162637_711014.jpg)
Guard 的计算和实现
Problem Description The Bluewater Security Company provides guards for clients with valuable possessions. Bluewater has found that clients are interested in having guards posted where they can see everything that is valuable merely by turning their heads, and also like guards to be posted particularly close to particularly valuable items. A sample site layout is shown above. Ignore the three black dots for now. Various locations are labeled and assigned values. For instance location A at coordinates (0,8) is the position of an item with value 4. Locations showing a value 0, like G, do not have a valuable item. The straight lines indicate corridors. For simplicity, corridors are modeled as line segments with 0 width. A guard at an intersection point of several corridors can see and therefore guard the items on each of the corridors. If Bluewater were contracted to supply 3 guards, they might choose to post them at the positions indicated with the small black dots. The guard not at an already labeled position is at (15.5, 6). To model the desire for guards to be closer to items of higher value, Bluewater calculates the risk to a valuable item to be the value of the item times the minimum distance to a guard that can see the item. Even if a guard is close to an item that is around a corner, that guard does not affect the risk to the item, since the guard cannot see around a corner. In the diagram shown, the risks to the items are A: 4x5=20, C: 4x2.5=10, D: 2x0=0, .... The largest risks are for H: 50x7.5=375 and I: 50x7.5=375, so the maximum risk to any one item is 375. With this site layout, no arrangement of 3 guards would provide a lower maximum risk, so this arrangement of 3 guards minimizes the maximum risk. Bluewater would like to be able to tell any client who requests a particular number of guards for a particular site layout, what the minimized maximum risk will be. Input The input will consist of one to sixteen data sets, followed by a line containing only 0. On each line the data will consist of blank separated tokens. The first line of a dataset contains integers p c g, where p is the number of points specified, c is the number of corridors, and g is the number of guards to be placed. Constraints are 1< p < 12; 0 < c < 12; 0 < g < 5. Next in the dataset are a total of p groups of four tokens, each consisting of a capital letter and three nonnegative integers L x y v indicating the point (x, y) with label L contains an item with value v. If p is no greater than 6, these groups will all be on one line. If p is greater than 6, then the seventh and further groups will be on the next line. Labels will be consecutive letters starting from A. All the numbers are less than 1000. Each of the points is unique. A value of 0 for v means there is no item of value there. The number of locations with items of value will be at least as large as the number of guards. The last line of a dataset contains c strings of letters, one for each corridor. For each corridor the letters are labels for points along the corridor, in order along the line segment from one end to the other, including both endpoints, all intersection points with other corridors, and all locations on the corridor with a valuable item. Each of the points given in the dataset will lie on at least one of the corridors. Output There is one line of output for each data set. If there are not enough guards supplied to be able to see all the valuables, the line is "too few guards". Otherwise the line is an unsigned number r rounded to two places beyond the decimal point, where r is the minimum value over all placements of g guards of the maximum "risk" to the valuables. Sample Input 11 5 3 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 2 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 1 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 4 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 3 3 1 A 0 0 50 B 0 3 60 C 4 0 20 AB CB CA 0 Sample Output 375.00 1250.00 too few guards 21.21 150.00
websphere服务器,使用common-fileupload上传2GB以上的文件时出错
测试环境1:tomcat6.0,jdk1.6,common-fileupload1.2.2 在测试环境上1上传2GB以上的文件时ServletFileUpload.parseRequest(request)得到的集合不为空,程序正常运行 测试环境2:websphere7.0,jdk1.6,common-fileupload1.2.2 在测试环境2上上传2GB以上的文件时ServletFileUpload.parseRequest(request)得到的集合不为空,程序正常运行,但是2GB以下的文件时正常的 注:测试环境2的was没有对post限制大小
spring mvc 4.0.0 release版执行一个post方法报错
下面是报的错 java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.getContainingClass()Ljava/lang/Class; org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.supportsReturnType(RequestResponseBodyMethodProcessor.java:84) 下面是配的pom <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com</groupId> <artifactId>mmall</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>mmall Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding> <org.springframework.version>4.0.8.RELEASE</org.springframework.version> <org.mybatis.version>3.4.1</org.mybatis.version> <org.mybatis.spring.version>1.3.0</org.mybatis.spring.version> </properties> <dependencies> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-servlet-api</artifactId> <version>7.0.64</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.7.3</version> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>${org.mybatis.spring.version}</version> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>${org.mybatis.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.6.11</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.8.11</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.8.11</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.8.11</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.1.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> <!--<scope>runtime</scope>--> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>20.0</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.5</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.1</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <!--<scope>test</scope>--> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.3</version> </dependency> <!-- id加密解密 --> <dependency> <groupId>org.hashids</groupId> <artifactId>hashids</artifactId> <version>1.0.1</version> </dependency> <!-- ftpclient --> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.1</version> </dependency> <!-- file upload --> <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.2.2</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.0.1</version> </dependency> <!-- mybatis pager --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.0</version> </dependency> <dependency> <groupId>com.github.miemiedev</groupId> <artifactId>mybatis-paginator</artifactId> <version>1.2.17</version> </dependency> <dependency> <groupId>com.github.jsqlparser</groupId> <artifactId>jsqlparser</artifactId> <version>0.9.4</version> </dependency> <!-- alipay --> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.10</version> </dependency> <dependency> <groupId>commons-configuration</groupId> <artifactId>commons-configuration</artifactId> <version>1.10</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>com.google.zxing</groupId> <artifactId>core</artifactId> <version>2.1</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.3.1</version> </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-core</artifactId> <version>1.3</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency> </dependencies> <build> <finalName>mmall</finalName> <plugins> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> </plugin> <!-- geelynote maven的核心插件之-complier插件默认只支持编译Java 1.4,因此需要加上支持高版本jre的配置,在pom.xml里面加上 增加编译插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> <compilerArguments> <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs> </compilerArguments> </configuration> </plugin> </plugins> </build> </project> 下面是写的方法 @RequestMapping(value="login.do",method= RequestMethod.POST) @ResponseBody public ServerResponse<User> login(String username, String password,HttpSession session){ ServerResponse<User> response=iUserService.login(username,password); if(response.isSuccess()){ session.setAttribute(Const.CURRENT_USER,response.getData()); } return response; } 环境是win7 mysql(v5.1.62) jdk1.7.0_80 tomcat是apache-tomcat-7.0.75 请哪位高人看一下哪里错了
window上的web迁移到linux下登录不了
centos 7.2,jdk1.7,tomcat7,将windows的服务迁移到该linux下,登录时后台报用户名密码为null,log输出可以判定进入后台的action了,但是前台的登录名、密码没传过来【前台页面用ajax的post请求,页面有用户名、密码不为空的js验证--且登录时没报该js验证的提示错误】 注意:服务器防火墙暂时关闭了、chown、chmod为了777,目录符也调整过来了 -------------大神们帮忙看看这可能是什么问题
Guard 程序怎么编的
Problem Description The Bluewater Security Company provides guards for clients with valuable possessions. Bluewater has found that clients are interested in having guards posted where they can see everything that is valuable merely by turning their heads, and also like guards to be posted particularly close to particularly valuable items. A sample site layout is shown above. Ignore the three black dots for now. Various locations are labeled and assigned values. For instance location A at coordinates (0,8) is the position of an item with value 4. Locations showing a value 0, like G, do not have a valuable item. The straight lines indicate corridors. For simplicity, corridors are modeled as line segments with 0 width. A guard at an intersection point of several corridors can see and therefore guard the items on each of the corridors. If Bluewater were contracted to supply 3 guards, they might choose to post them at the positions indicated with the small black dots. The guard not at an already labeled position is at (15.5, 6). To model the desire for guards to be closer to items of higher value, Bluewater calculates the risk to a valuable item to be the value of the item times the minimum distance to a guard that can see the item. Even if a guard is close to an item that is around a corner, that guard does not affect the risk to the item, since the guard cannot see around a corner. In the diagram shown, the risks to the items are A: 4x5=20, C: 4x2.5=10, D: 2x0=0, .... The largest risks are for H: 50x7.5=375 and I: 50x7.5=375, so the maximum risk to any one item is 375. With this site layout, no arrangement of 3 guards would provide a lower maximum risk, so this arrangement of 3 guards minimizes the maximum risk. Bluewater would like to be able to tell any client who requests a particular number of guards for a particular site layout, what the minimized maximum risk will be. Input The input will consist of one to sixteen data sets, followed by a line containing only 0. On each line the data will consist of blank separated tokens. The first line of a dataset contains integers p c g, where p is the number of points specified, c is the number of corridors, and g is the number of guards to be placed. Constraints are 1< p < 12; 0 < c < 12; 0 < g < 5. Next in the dataset are a total of p groups of four tokens, each consisting of a capital letter and three nonnegative integers L x y v indicating the point (x, y) with label L contains an item with value v. If p is no greater than 6, these groups will all be on one line. If p is greater than 6, then the seventh and further groups will be on the next line. Labels will be consecutive letters starting from A. All the numbers are less than 1000. Each of the points is unique. A value of 0 for v means there is no item of value there. The number of locations with items of value will be at least as large as the number of guards. The last line of a dataset contains c strings of letters, one for each corridor. For each corridor the letters are labels for points along the corridor, in order along the line segment from one end to the other, including both endpoints, all intersection points with other corridors, and all locations on the corridor with a valuable item. Each of the points given in the dataset will lie on at least one of the corridors. Output There is one line of output for each data set. If there are not enough guards supplied to be able to see all the valuables, the line is "too few guards". Otherwise the line is an unsigned number r rounded to two places beyond the decimal point, where r is the minimum value over all placements of g guards of the maximum "risk" to the valuables. Sample Input 11 5 3 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 2 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 1 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 4 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 3 3 1 A 0 0 50 B 0 3 60 C 4 0 20 AB CB CA 0 Sample Output 375.00 1250.00 too few guards 21.21 150.00
netty 高并发快速响应
现业务是接收http post请求并必须在15毫秒内返回, 我的实现思路: 1:首先netty接收完数据,验证contenttype等header信息再将post的数据protobuf反序列化成对象(必须), 2:然后将对象传入到某个方法, 3:该方法必须定时10毫秒完成,如果没有完成就直接返回null和请求的header 具体实现是: netty 主线程接收完数据转成request对象传到1号线程池里面,1号线程池验证对象和反序列化,传给2号线程池并wait10毫秒然后直接得到2号线程池的返回对象,有就有,没有就是null,然后再channel返回。2号线程池主要处理业务生成对象供1号线程池调用。 Linux version 2.6.32-431.11.25.el6.ucloud.x86_64 gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) Mem: 16G CPU(s): 8 sysctl.conf: net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 net.netfilter.nf_conntrack_max = 1000000 kernel.unknown_nmi_panic = 0 kernel.sysrq = 1 fs.file-max = 1000000 vm.swappiness = 10 fs.inotify.max_user_watches = 10000000 net.core.wmem_max = 67108864 net.core.rmem_max = 67108864 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 fs.notify.max_queued_events = 3276792 net.ipv4.neigh.default.gc_thresh1 = 2048 net.ipv4.neigh.default.gc_thresh2 = 4096 net.ipv4.neigh.default.gc_thresh3 = 8192 net.ipv6.conf.all.disable_ipv6 = 1 ############## net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_syncookies = 1 net.core.somaxconn = 262144 net.core.netdev_max_backlog = 262144 net.ipv4.tcp_max_orphans = 262144 net.ipv4.tcp_max_syn_backlog = 262144 net.ipv4.tcp_synack_retries = 1 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_fin_timeout = 1 net.ipv4.tcp_keepalive_time = 30 #### net.ipv4.tcp_rmem = 4096 87380 67108864 net.ipv4.tcp_wmem = 4096 65536 67108864 net.core.netdev_max_backlog = 250000 net.ipv4.tcp_mtu_probing=1 net.ipv4.tcp_congestion_control=hybla jdk 1.8 现用tomcat同样配置执行是4000qps,超时率为4%; netty是1000qps,超时率为5%; netty: cpu使用10%左右 java -Xms10g -Xmx10g -XX:NewSize=7098m -XX:SurvivorRatio=16 -XX:+DisableExplicitGC -XX:+CMSScavengeBeforeRemark -XX:+UseConcMarkSweepGC -XX:+UParNewGC S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT 403776.0 403776.0 25637.9 0.0 6460800.0 5273672.7 3217408.0 0.0 27928.0 25782.3 3352.0 2883.6 2 0.042 2 1.411 1.453 netstat -apn | grep TIME_WAIT | wl -h 5733 现需要qps达到1w以上。希望收到你的回答或demo。谢谢 ps: akka ,但觉得个人写future和他差不多吧。
java.lang.ClassNotFoundException: org.mortbay.jetty.Connector 这是什么错误啊?
mac Myeclipse ci 2018 weblogic12c java项目jdk1.6 weblogicjdk1.8 项目在部署到weblogic上失败 ``` ``` Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 <2018-12-19 下午08时41分01秒 CST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.> <2018-12-19 下午08时41分01秒 CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.> <2018-12-19 下午08时41分01秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 25.191-b12 from Oracle Corporation.> <2018-12-19 下午08时41分01秒 CST> <Info> <RCM> <BEA-2165021> <"ResourceManagement" is not enabled in this JVM. Enable "ResourceManagement" to use the WebLogic Server "Resource Consumption Management" feature. To enable "ResourceManagement", you must specify the following JVM options in the WebLogic Server instance in which the JVM runs: -XX:+UnlockCommercialFeatures -XX:+ResourceManagement.> <2018-12-19 下午08时41分01秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.2.1.1.0 Thu Jun 2 16:21:58 PDT 2016 1784838> <2018-12-19 下午08时41分02秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> <2018-12-19 下午08时41分02秒 CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.> <2018-12-19 下午08时41分03秒 CST> <Info> <WorkManager> <BEA-002942> <CMM memory level becomes 0. Setting standby thread pool size to 256.> <2018-12-19, 8:41:03,470 下午 CST> <Notice> <Log Management> <BEA-170019> <The server log file weblogic.logging.FileStreamHandler instance=2092500132 Current log file=/Users/oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/logs/AdminServer.log Rotation dir=/Users/oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/logs is opened. All server side log events will be written to this file.> <2018-12-19, 8:41:03,532 下午 CST> <Notice> <Security> <BEA-090946> <Security pre-initializing using security realm: myrealm> <2018-12-19, 8:41:04,84 下午 CST> <Notice> <Security> <BEA-090947> <Security post-initializing using security realm: myrealm> <2018-12-19, 8:41:04,979 下午 CST> <Notice> <Security> <BEA-090082> <Security initialized using administrative security realm: myrealm> <2018-12-19, 8:41:05,300 下午 CST> <Warning> <Store> <BEA-280109> <The JVM was unable to load the native wlfileio library for the store "_WLS_AdminServer". File and paging stores will continue to function correctly. Specifically, file stores that are configured with a transactionally safe synchronous write policy will continue to operate safely and transactionally but may open with a different write-policy. Other store types may not be able to open.> <2018-12-19, 8:41:05,340 下午 CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://169.254.153.13:7001/jndi/weblogic.management.mbeanservers.runtime.> <2018-12-19, 8:41:05,340 下午 CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://169.254.153.13:7001/jndi/weblogic.management.mbeanservers.domainruntime.> <2018-12-19, 8:41:05,352 下午 CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://169.254.153.13:7001/jndi/weblogic.management.mbeanservers.edit.> <2018-12-19, 8:41:06,588 下午 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.> <2018-12-19, 8:41:06,589 下午 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> <2018-12-19, 8:41:06,625 下午 CST> <Notice> <Log Management> <BEA-170036> <The Logging monitoring service timer has started to check for logged message counts every 30 seconds.> <2018-12-19, 8:41:06,813 下午 CST> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.> <2018-12-19, 8:41:06,904 下午 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.> <2018-12-19, 8:41:06,956 下午 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.> <2018-12-19, 8:41:07,5 下午 CST> <Warning> <Server> <BEA-002611> <The hostname "localhost", maps to multiple IP addresses: 127.0.0.1, 0:0:0:0:0:0:0:1.> <2018-12-19, 8:41:07,7 下午 CST> <Warning> <Server> <BEA-002611> <The hostname "zkr-jyp-pc.local", maps to multiple IP addresses: 169.254.153.13, 11.205.52.52, fe80:0:0:0:10fd:f6fc:8230:8788%10, fe80:0:0:0:97:aebc:b52a:e094%20.> <2018-12-19, 8:41:07,7 下午 CST> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> <2018-12-19, 8:41:07,8 下午 CST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 11.205.52.52:7001 for protocols iiop, t3, ldap, snmp, http.> <2018-12-19, 8:41:07,8 下午 CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 169.254.153.13:7001 for protocols iiop, t3, ldap, snmp, http.> <2018-12-19, 8:41:07,8 下午 CST> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 0:0:0:0:0:0:0:1%lo0:7001 for protocols iiop, t3, ldap, snmp, http.> <2018-12-19, 8:41:07,8 下午 CST> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "AdminServer" for domain "base_domain" running in development mode.> <2018-12-19, 8:41:07,8 下午 CST> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> <2018-12-19, 8:41:07,8 下午 CST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 11.205.52.52:7001 for protocols iiop, t3, ldap, snmp, http.> <2018-12-19, 8:41:07,9 下午 CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 169.254.153.13:7001 for protocols iiop, t3, ldap, snmp, http.> <2018-12-19, 8:41:07,9 下午 CST> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 0:0:0:0:0:0:0:1%lo0:7001 for protocols iiop, t3, ldap, snmp, http.> <2018-12-19, 8:41:07,11 下午 CST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.> <2018-12-19, 8:41:07,18 下午 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.> <2018-12-19, 8:41:50,423 下午 CST> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=AdminServer : Initializing callbacks> <2018-12-19, 8:41:50,426 下午 CST> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=AdminServer : Callback is done> <2018-12-19, 8:41:50,426 下午 CST> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=AdminServer : Connection already exists for the server. Does not attempt to connect to the server> <2018-12-19, 8:42:35,137 下午 CST> <Warning> <JAXRSIntegration> <BEA-2192511> <The list of resource packages: org.apache.cxf.jaxrs.provider;org.apache.cxf.jaxrs.impl;com.picc.platform.demo.webservice.server.jaxrs> <2018-12-19, 8:42:57,500 下午 CST> <Warning> <JAXRSIntegration> <BEA-2192511> <The list of resource packages: org.apache.cxf.jaxrs.provider;com.picc.platform.demo.webservice.server.jaxrs;org.apache.cxf.jaxrs.impl> <2018-12-19, 8:43:08,828 下午 CST> <Warning> <JAXRSIntegration> <BEA-2192511> <The list of resource packages: org.apache.cxf.jaxrs.provider;com.picc.platform.demo.webservice.server.jaxrs;org.apache.cxf.jaxrs.impl> <2018-12-19, 8:43:17,888 下午 CST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "5747660773208" for task "0" on [partition-name: DOMAIN]. Error is: "weblogic.management.DeploymentException: java.lang.ClassNotFoundException: org.mortbay.jetty.Connector" weblogic.management.DeploymentException: java.lang.ClassNotFoundException: org.mortbay.jetty.Connector at weblogic.application.internal.BaseDeployment.throwAppException(BaseDeployment.java:132) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:246) at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:52) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65) Truncated. see log file for complete stacktrace Caused By: java.lang.ClassNotFoundException: org.mortbay.jetty.Connector at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1025) at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:986) at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:83) at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:607) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:539) Truncated. see log file for complete stacktrace > <2018-12-19, 8:43:17,910 下午 CST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application "cams".> <2018-12-19, 8:43:17,910 下午 CST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004 weblogic.management.DeploymentException: java.lang.ClassNotFoundException: org.mortbay.jetty.Connector at weblogic.application.internal.BaseDeployment.throwAppException(BaseDeployment.java:132) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:246) at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:52) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65) Truncated. see log file for complete stacktrace Caused By: java.lang.ClassNotFoundException: org.mortbay.jetty.Connector at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1025) at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:986) at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:83) at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:607) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:539) Truncated. see log file for complete stacktrace > <2018-12-19, 8:43:17,940 下午 CST> <Error> <Console> <BEA-240003> <Administration Console encountered the following error: weblogic.management.DeploymentException: java.lang.ClassNotFoundException: org.mortbay.jetty.Connector at weblogic.application.internal.BaseDeployment.throwAppException(BaseDeployment.java:132) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:246) at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:52) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:229) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:103) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:241) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:794) at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1340) at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:267) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:177) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:186) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:14) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:47) at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666) at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348) at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333) at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54) at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406) at weblogic.work.ExecuteThread.run(ExecuteThread.java:346) Caused by: java.lang.ClassNotFoundException: org.mortbay.jetty.Connector at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1025) at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:986) at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:83) at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:607) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:539) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:492) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:469) at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:53) at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2583) at java.lang.Class.getDeclaredFields(Class.java:1916) at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.getFields(BaseJ2eeAnnotationProcessor.java:1047) at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.getFields(BaseJ2eeAnnotationProcessor.java:1041) at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.processJ2eeAnnotations(BaseJ2eeAnnotationProcessor.java:145) at weblogic.j2ee.dd.xml.J2eeAnnotationProcessor.processJ2eeAnnotations(J2eeAnnotationProcessor.java:47) at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.processJ2eeAnnotations(BaseJ2eeAnnotationProcessor.java:120) at weblogic.j2ee.dd.xml.PojoAnnotationProcessorImpl.processJ2eeAnnotations(PojoAnnotationProcessorImpl.java:93) at weblogic.application.internal.flow.PojoAnnotationProcessingFlow.processAnnotations(PojoAnnotationProcessingFlow.java:304) at weblogic.application.internal.flow.PojoAnnotationProcessingFlow.processPOJOsInModuleScopes(PojoAnnotationProcessingFlow.java:229) at weblogic.application.internal.flow.PojoAnnotationProcessingFlow.prepare(PojoAnnotationProcessingFlow.java:73) at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:731) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:243) > <2018-12-19, 8:43:18,388 下午 CST> <Warning> <JAXRSIntegration> <BEA-2192511> <The list of resource packages: org.apache.cxf.jaxrs.provider;com.picc.platform.demo.webservice.server.jaxrs;org.apache.cxf.jaxrs.impl>
URLConnection传递参数后的问题
现在有需求需要用java的URLConnection发送请求并传递参数,就在网上找了代码来研究。代码如下: [color=green]import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import org.apache.log4j.Logger; /** * <pre> * HTTP请求[qing qiu]代理类 * </pre> * * @author benl * @version 1.0, 2007-7-3 */ public class HttpRequestProxy { /** * 连接[lian jie]超时[chao shi] */ private static int connectTimeOut = 5000; /** * 读取[du qu]数据[shu ju]超时[chao shi] */ private static int readTimeOut = 10000; /** * 请求[qing qiu]编码[bian ma] */ private static String requestEncoding = "GBK"; private static Logger logger = Logger.getLogger(HttpRequestProxy.class); /** * <pre> * 发送带参数[can shu]的GET的HTTP请求[qing qiu] * </pre> * * @param reqUrl * HTTP请求[qing qiu]URL * @param parameters * 参数[can shu]映射[ying she]表 * @return HTTP响应[xiang ying]的字符[zi fu]串[zi fu chuan] */ public static String doGet(String reqUrl, Map parameters, String recvEncoding) { HttpURLConnection url_con = null; String responseContent = null; try { StringBuffer params = new StringBuffer(); for (Iterator iter = parameters.entrySet().iterator(); iter .hasNext();) { Entry element = (Entry) iter.next(); params.append(element.getKey().toString()); params.append("="); params.append(URLEncoder.encode(element.getValue().toString(), HttpRequestProxy.requestEncoding)); params.append("&"); } if (params.length() > 0) { params = params.deleteCharAt(params.length() - 1); } URL url = new URL(reqUrl); url_con = (HttpURLConnection) url.openConnection(); url_con.setRequestMethod("GET"); System.setProperty("sun.net.client.defaultConnectTimeout", String .valueOf(HttpRequestProxy.connectTimeOut));// (单位[dan // wei]:毫秒)jdk1.4换成这个,连接[lian // jie]超时[chao // shi] System.setProperty("sun.net.client.defaultReadTimeout", String .valueOf(HttpRequestProxy.readTimeOut)); // (单位[dan // wei]:毫秒)jdk1.4换成这个,读操作超时[chao // shi] // url_con.setConnectTimeout(5000);//(单位[dan wei]:毫秒)jdk // 1.5换成这个,连接[lian jie]超时[chao shi] // url_con.setReadTimeout(5000);//(单位[dan wei]:毫秒)jdk // 1.5换成这个,读操作超时[chao shi] url_con.setDoOutput(true); byte[] b = params.toString().getBytes(); url_con.getOutputStream().write(b, 0, b.length); url_con.getOutputStream().flush(); url_con.getOutputStream().close(); InputStream in = url_con.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(in, recvEncoding)); String tempLine = rd.readLine(); StringBuffer temp = new StringBuffer(); String crlf = System.getProperty("line.separator"); while (tempLine != null) { temp.append(tempLine); temp.append(crlf); tempLine = rd.readLine(); } responseContent = temp.toString(); rd.close(); in.close(); } catch (IOException e) { logger.error("网络[wang luo]故障[gu zhang]", e); } finally { if (url_con != null) { url_con.disconnect(); } } return responseContent; } /** * <pre> * 发送不带参数[can shu]的GET的HTTP请求[qing qiu] * </pre> * * @param reqUrl * HTTP请求[qing qiu]URL * @return HTTP响应[xiang ying]的字符[zi fu]串[zi fu chuan] */ public static String doGet(String reqUrl, String recvEncoding) { HttpURLConnection url_con = null; String responseContent = null; try { StringBuffer params = new StringBuffer(); String queryUrl = reqUrl; int paramIndex = reqUrl.indexOf("?"); if (paramIndex > 0) { queryUrl = reqUrl.substring(0, paramIndex); String parameters = reqUrl.substring(paramIndex + 1, reqUrl .length()); String[] paramArray = parameters.split("&"); for (int i = 0; i < paramArray.length; i++) { String string = paramArray[i]; int index = string.indexOf("="); if (index > 0) { String parameter = string.substring(0, index); String value = string.substring(index + 1, string .length()); params.append(parameter); params.append("="); params.append(URLEncoder.encode(value, HttpRequestProxy.requestEncoding)); params.append("&"); } } params = params.deleteCharAt(params.length() - 1); } URL url = new URL(queryUrl); url_con = (HttpURLConnection) url.openConnection(); url_con.setRequestMethod("GET"); System.setProperty("sun.net.client.defaultConnectTimeout", String .valueOf(HttpRequestProxy.connectTimeOut));// (单位[dan // wei]:毫秒)jdk1.4换成这个,连接[lian // jie]超时[chao // shi] System.setProperty("sun.net.client.defaultReadTimeout", String .valueOf(HttpRequestProxy.readTimeOut)); // (单位[dan // wei]:毫秒)jdk1.4换成这个,读操作超时[chao // shi] // url_con.setConnectTimeout(5000);//(单位[dan wei]:毫秒)jdk // 1.5换成这个,连接[lian jie]超时[chao shi] // url_con.setReadTimeout(5000);//(单位[dan wei]:毫秒)jdk // 1.5换成这个,读操作超时[chao shi] url_con.setDoOutput(true); byte[] b = params.toString().getBytes(); url_con.getOutputStream().write(b, 0, b.length); url_con.getOutputStream().flush(); url_con.getOutputStream().close(); InputStream in = url_con.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(in, recvEncoding)); String tempLine = rd.readLine(); StringBuffer temp = new StringBuffer(); String crlf = System.getProperty("line.separator"); while (tempLine != null) { temp.append(tempLine); temp.append(crlf); tempLine = rd.readLine(); } responseContent = temp.toString(); rd.close(); in.close(); } catch (IOException e) { logger.error("网络[wang luo]故障[gu zhang]", e); } finally { if (url_con != null) { url_con.disconnect(); } } return responseContent; } /** * <pre> * 发送带参数[can shu]的POST的HTTP请求[qing qiu] * </pre> * * @param reqUrl * HTTP请求[qing qiu]URL * @param parameters * 参数[can shu]映射[ying she]表 * @return HTTP响应[xiang ying]的字符[zi fu]串[zi fu chuan] */ public static String doPost(String reqUrl, Map parameters, String recvEncoding) { HttpURLConnection url_con = null; String responseContent = null; try { StringBuffer params = new StringBuffer(); for (Iterator iter = parameters.entrySet().iterator(); iter .hasNext();) { Entry element = (Entry) iter.next(); params.append(element.getKey().toString()); params.append("="); params.append(URLEncoder.encode(element.getValue().toString(), HttpRequestProxy.requestEncoding)); params.append("&"); } if (params.length() > 0) { params = params.deleteCharAt(params.length() - 1); } URL url = new URL(reqUrl); url_con = (HttpURLConnection) url.openConnection(); url_con.setRequestMethod("POST"); System.setProperty("sun.net.client.defaultConnectTimeout", String .valueOf(HttpRequestProxy.connectTimeOut));// (单位[dan // wei]:毫秒)jdk1.4换成这个,连接[lian // jie]超时[chao // shi] System.setProperty("sun.net.client.defaultReadTimeout", String .valueOf(HttpRequestProxy.readTimeOut)); // (单位[dan // wei]:毫秒)jdk1.4换成这个,读操作超时[chao // shi] // url_con.setConnectTimeout(5000);//(单位[dan wei]:毫秒)jdk // 1.5换成这个,连接[lian jie]超时[chao shi] // url_con.setReadTimeout(5000);//(单位[dan wei]:毫秒)jdk // 1.5换成这个,读操作超时[chao shi] url_con.setDoOutput(true); byte[] b = params.toString().getBytes(); url_con.getOutputStream().write(b, 0, b.length); url_con.getOutputStream().flush(); url_con.getOutputStream().close(); InputStream in = url_con.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(in, recvEncoding)); String tempLine = rd.readLine(); StringBuffer tempStr = new StringBuffer(); String crlf = System.getProperty("line.separator"); while (tempLine != null) { tempStr.append(tempLine); tempStr.append(crlf); tempLine = rd.readLine(); } responseContent = tempStr.toString(); rd.close(); in.close(); } catch (IOException e) { logger.error("网络[wang luo]故障[gu zhang]", e); } finally { if (url_con != null) { url_con.disconnect(); } } return responseContent; } /** * @return 连接[lian jie]超时[chao shi](毫秒) * @see com.hengpeng.common.web.HttpRequestProxy#connectTimeOut */ public static int getConnectTimeOut() { return HttpRequestProxy.connectTimeOut; } /** * @return 读取[du qu]数据[shu ju]超时[chao shi](毫秒) * @see com.hengpeng.common.web.HttpRequestProxy#readTimeOut */ public static int getReadTimeOut() { return HttpRequestProxy.readTimeOut; } /** * @return 请求[qing qiu]编码[bian ma] * @see com.hengpeng.common.web.HttpRequestProxy#requestEncoding */ public static String getRequestEncoding() { return requestEncoding; } /** * @param connectTimeOut * 连接[lian jie]超时[chao shi](毫秒) * @see com.hengpeng.common.web.HttpRequestProxy#connectTimeOut */ public static void setConnectTimeOut(int connectTimeOut) { HttpRequestProxy.connectTimeOut = connectTimeOut; } /** * @param readTimeOut * 读取[du qu]数据[shu ju]超时[chao shi](毫秒) * @see com.hengpeng.common.web.HttpRequestProxy#readTimeOut */ public static void setReadTimeOut(int readTimeOut) { HttpRequestProxy.readTimeOut = readTimeOut; } /** * @param requestEncoding * 请求[qing qiu]编码[bian ma] * @see com.hengpeng.common.web.HttpRequestProxy#requestEncoding */ public static void setRequestEncoding(String requestEncoding) { HttpRequestProxy.requestEncoding = requestEncoding; } public static void main(String[] args) { Map map = new HashMap(); map.put("actionType", "1"); map.put("issueId", "33"); String temp = HttpRequestProxy.doGet( "http://localhost/TransData", map, "GBK"); System.out.println("返回的消息[xiao xi]是:" + temp); } }[/color] 最后mian方法中这段 String temp = HttpRequestProxy.doGet("http://localhost/TransData", map, "GBK"); 里面的URL是我另外新建的一个web工程,名为TransData。在TransData工程中的index.jsp页面我这样写: [color=green]<% String p1 = request.getParameter("actionType"); String p2 = request.getParameter("issueId"); System.out.println("p1:"+p1); System.out.println("p2:"+p2); %>[/color] 但是发现我拿不到参数。 就把提交的URL改为提交到servlet: String temp = HttpRequestProxy.doGet("http://localhost/TransData/a.do", map, "GBK"); 在servlet的doPost方法中这样写: [color=green] String p1 = req.getParameter("actionType"); String p2 = req.getParameter("issueId"); System.out.println(p1); System.out.println(p2);[/color] 这样打印p1,p2发现可以拿到值。这是为什么呢,为什么在jsp中拿不到参数,在servlet中却可以拿到?
关于struts2的问题,x新手求指导
初学struts2,跟着网上视频做一个简单的表单校验,但是发布时就出现404错误,截图如下: web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>struts2-3</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> 这是index.jsp: html> <head> </head> <body> <form action="<%=path %>/loginAction.action" method="post"> username: <input type="text" name="username"><br> password: <input type="password" name="password"><br> <input type="submit" name="tijiao"> </form> </body> </html> 这是struts.xml: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="userlogin" extends="struts-default"> <action name="loginAction" class="com.zengyue.action.LoginAction"> <result name="success">/index.jsp</result> </action> </package> </struts> 这是LoginAction.java package com.zengyue.action; import com.opensymphony.xwork2.ActionSupport; public class LoginAction extends ActionSupport{ private String username; private String password; private String excute() throws Exception{ System.out.println("username"); System.out.println("password"); return "success"; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } 这是tomcat 信息: 四月 18, 2017 12:30:05 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:struts2-3' did not find a matching property. 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/8.0.43 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server built: Mar 28 2017 14:42:59 UTC 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server number: 8.0.43.0 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 8 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Version: 6.2 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Architecture: amd64 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java Home: F:\My_E\binary\com.sun.java.jdk7.win32.x86_64_1.7.0.u45\jre 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Version: 1.7.0_45-b18 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Vendor: Oracle Corporation 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: F:\tomcat\apache-tomcat-8.0.43 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: F:\tomcat\apache-tomcat-8.0.43 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=F:\tomcat\apache-tomcat-8.0.43 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=F:\tomcat\apache-tomcat-8.0.43 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=F:\tomcat\apache-tomcat-8.0.43\me-webapps 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=F:\tomcat\apache-tomcat-8.0.43\endorsed 四月 18, 2017 12:30:05 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=GBK 四月 18, 2017 12:30:05 上午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\My_E\binary\com.sun.java.jdk7.win32.x86_64_1.7.0.u45\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\java\jdk1.8.0_45\bin;C:\Program Files\java\jdk1.8.0_45\jre\bin;E:\adt-bundle-windows-x86_64-20140702\sdk\tools;E:\adt-bundle-windows-x86_64-20140702\sdk\platform-tools;C:\Windows\System32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;F:\Dev-Cpp\MinGW64\bin;C:\Users\月\AppData\Local\Microsoft\WindowsApps;F:\Dev-Cpp\bin\;. 四月 18, 2017 12:30:06 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-nio-8080"] 四月 18, 2017 12:30:06 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 四月 18, 2017 12:30:06 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-nio-8009"] 四月 18, 2017 12:30:06 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 四月 18, 2017 12:30:06 上午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 2324 ms 四月 18, 2017 12:30:06 上午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 四月 18, 2017 12:30:06 上午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/8.0.43 四月 18, 2017 12:30:07 上午 org.apache.tomcat.util.digester.Digester fatalError 严重: Parse Fatal Error at line 1 column 7: 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。 org.xml.sax.SAXParseException; systemId: file:/F:/tomcat/apache-tomcat-8.0.43/me-webapps/struts2-3/WEB-INF/web.xml; lineNumber: 1; columnNumber: 7; 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。 四月 18, 2017 12:30:07 上午 org.apache.tomcat.util.descriptor.web.WebXmlParser parseWebXml 严重: Parse error in application web.xml file at file:/F:/tomcat/apache-tomcat-8.0.43/me-webapps/struts2-3/WEB-INF/web.xml org.xml.sax.SAXParseException; systemId: file:/F:/tomcat/apache-tomcat-8.0.43/me-webapps/struts2-3/WEB-INF/web.xml; lineNumber: 1; columnNumber: 7; 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。 四月 18, 2017 12:30:07 上午 org.apache.tomcat.util.descriptor.web.WebXmlParser parseWebXml 严重: Occurred at line 1 column 7 四月 18, 2017 12:30:07 上午 org.apache.catalina.startup.ContextConfig configureStart 严重: Marking this application unavailable due to previous error(s) 四月 18, 2017 12:30:07 上午 org.apache.catalina.core.StandardContext startInternal 严重: One or more components marked the context as not correctly configured 四月 18, 2017 12:30:07 上午 org.apache.catalina.core.StandardContext startInternal 严重: Context [/struts2-3] startup failed due to previous errors 四月 18, 2017 12:30:07 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\docs 四月 18, 2017 12:30:07 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\docs has finished in 196 ms 四月 18, 2017 12:30:07 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\examples 四月 18, 2017 12:30:08 上午 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: contextInitialized() 四月 18, 2017 12:30:08 上午 org.apache.catalina.core.ApplicationContext log 信息: SessionListener: contextInitialized() 四月 18, 2017 12:30:08 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\examples has finished in 800 ms 四月 18, 2017 12:30:08 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\host-manager 四月 18, 2017 12:30:08 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\host-manager has finished in 44 ms 四月 18, 2017 12:30:08 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\manager 四月 18, 2017 12:30:08 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\manager has finished in 63 ms 四月 18, 2017 12:30:08 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\ROOT 四月 18, 2017 12:30:08 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory F:\tomcat\apache-tomcat-8.0.43\webapps\ROOT has finished in 62 ms 四月 18, 2017 12:30:08 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-nio-8080"] 四月 18, 2017 12:30:08 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-nio-8009"] 四月 18, 2017 12:30:08 上午 org.apache.catalina.startup.Catalina start 信息: Server startup in 2445 ms
编程来实现Guard的计算的算法
Problem Description The Bluewater Security Company provides guards for clients with valuable possessions. Bluewater has found that clients are interested in having guards posted where they can see everything that is valuable merely by turning their heads, and also like guards to be posted particularly close to particularly valuable items. A sample site layout is shown above. Ignore the three black dots for now. Various locations are labeled and assigned values. For instance location A at coordinates (0,8) is the position of an item with value 4. Locations showing a value 0, like G, do not have a valuable item. The straight lines indicate corridors. For simplicity, corridors are modeled as line segments with 0 width. A guard at an intersection point of several corridors can see and therefore guard the items on each of the corridors. If Bluewater were contracted to supply 3 guards, they might choose to post them at the positions indicated with the small black dots. The guard not at an already labeled position is at (15.5, 6). To model the desire for guards to be closer to items of higher value, Bluewater calculates the risk to a valuable item to be the value of the item times the minimum distance to a guard that can see the item. Even if a guard is close to an item that is around a corner, that guard does not affect the risk to the item, since the guard cannot see around a corner. In the diagram shown, the risks to the items are A: 4x5=20, C: 4x2.5=10, D: 2x0=0, .... The largest risks are for H: 50x7.5=375 and I: 50x7.5=375, so the maximum risk to any one item is 375. With this site layout, no arrangement of 3 guards would provide a lower maximum risk, so this arrangement of 3 guards minimizes the maximum risk. Bluewater would like to be able to tell any client who requests a particular number of guards for a particular site layout, what the minimized maximum risk will be. Input The input will consist of one to sixteen data sets, followed by a line containing only 0. On each line the data will consist of blank separated tokens. The first line of a dataset contains integers p c g, where p is the number of points specified, c is the number of corridors, and g is the number of guards to be placed. Constraints are 1< p < 12; 0 < c < 12; 0 < g < 5. Next in the dataset are a total of p groups of four tokens, each consisting of a capital letter and three nonnegative integers L x y v indicating the point (x, y) with label L contains an item with value v. If p is no greater than 6, these groups will all be on one line. If p is greater than 6, then the seventh and further groups will be on the next line. Labels will be consecutive letters starting from A. All the numbers are less than 1000. Each of the points is unique. A value of 0 for v means there is no item of value there. The number of locations with items of value will be at least as large as the number of guards. The last line of a dataset contains c strings of letters, one for each corridor. For each corridor the letters are labels for points along the corridor, in order along the line segment from one end to the other, including both endpoints, all intersection points with other corridors, and all locations on the corridor with a valuable item. Each of the points given in the dataset will lie on at least one of the corridors. Output There is one line of output for each data set. If there are not enough guards supplied to be able to see all the valuables, the line is "too few guards". Otherwise the line is an unsigned number r rounded to two places beyond the decimal point, where r is the minimum value over all placements of g guards of the maximum "risk" to the valuables. Sample Input 11 5 3 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 2 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 1 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 4 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 3 3 1 A 0 0 50 B 0 3 60 C 4 0 20 AB CB CA 0 Sample Output 375.00 1250.00 too few guards 21.21 150.00
第一次写struts2,被一个login例子搞死了。。。高手们帮忙看一下。。
myEclipse 7.5 JDK: 1.6 tomcat : 6.0 拿着参考文档学: lib(commons-logging.jar,freemarker.jar,ognl.jar,struts2-core.jar,xwork.jar) 后面又加了:commons-io-2.0.1.jar ,commons-lang-2.5.jar classes(struts.xml) struts.xml: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="struts2" extends="struts-default"> <action name="login" class="org.gxf.demo.LoginAction"> <result name="success">/success.jsp</result> </action> </package> </struts> web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Struts2.0</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> login.jsp: <%@ page language="java" contentType="text/html; charset=GBK"%> <html> <head> <title>登录页面</title> </head> <body> <!-- 提交请求参数的表单 --> <form action="login.action" method="post"> <table align="center"> <caption>用户登录</caption> <tr> <td> 用户名: <input type="text" name="username" /> </td> </tr> <tr> <td> 密&nbsp;&nbsp;码: <input type="text" name="password" /> </td> </tr> <tr align="center"> <td colspan="2"> <input type="submit" value="登录" /> <input type="reset" value="重填" /> </td> </tr> </table> </form> </body> </html> public class LoginAction { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String execute() throws Exception{ if("hello".equals(getUsername())){ return "success"; }else{ return "fail"; } } } error: 2011-12-16 15:45:23 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory struts2study 2011-12-16 15:45:25 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Parsing configuration file [struts-default.xml] 2011-12-16 15:45:26 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Parsing configuration file [struts-plugin.xml] 2011-12-16 15:45:26 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error 严重: Dispatcher initialization failed Unable to load configuration. - bean - jar:file:/D:/apache-tomcat-6.0.24/webapps/struts2study/WEB-INF/lib/struts2-gxp-plugin-2.3.1.jar!/struts-plugin.xml:8:162 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:195) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: Unable to load bean: type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - jar:file:/D:/apache-tomcat-6.0.24/webapps/struts2study/WEB-INF/lib/struts2-gxp-plugin-2.3.1.jar!/struts-plugin.xml:8:162 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:235) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) ... 30 more Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329) at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:157) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:206) ... 33 more 2011-12-16 15:45:26 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter struts2 Unable to load configuration. - bean - jar:file:/D:/apache-tomcat-6.0.24/webapps/struts2study/WEB-INF/lib/struts2-gxp-plugin-2.3.1.jar!/struts-plugin.xml:8:162 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:449) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:195) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: Unable to load configuration. - bean - jar:file:/D:/apache-tomcat-6.0.24/webapps/struts2study/WEB-INF/lib/struts2-gxp-plugin-2.3.1.jar!/struts-plugin.xml:8:162 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436) ... 28 more Caused by: Unable to load bean: type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - jar:file:/D:/apache-tomcat-6.0.24/webapps/struts2study/WEB-INF/lib/struts2-gxp-plugin-2.3.1.jar!/struts-plugin.xml:8:162 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:235) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) ... 30 more Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329) at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:157) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:206) ... 33 more 2011-12-16 15:45:26 org.apache.catalina.core.StandardContext start 严重: Error filterStart 2011-12-16 15:45:26 org.apache.catalina.core.StandardContext start 严重: Context [/struts2study] startup failed due to previous errors
计算最小化的最大的风险,怎么使用C语言的程序的代码的编写的过程加以实现的呢
Problem Description The Bluewater Security Company provides guards for clients with valuable possessions. Bluewater has found that clients are interested in having guards posted where they can see everything that is valuable merely by turning their heads, and also like guards to be posted particularly close to particularly valuable items. A sample site layout is shown above. Ignore the three black dots for now. Various locations are labeled and assigned values. For instance location A at coordinates (0,8) is the position of an item with value 4. Locations showing a value 0, like G, do not have a valuable item. The straight lines indicate corridors. For simplicity, corridors are modeled as line segments with 0 width. A guard at an intersection point of several corridors can see and therefore guard the items on each of the corridors. If Bluewater were contracted to supply 3 guards, they might choose to post them at the positions indicated with the small black dots. The guard not at an already labeled position is at (15.5, 6). To model the desire for guards to be closer to items of higher value, Bluewater calculates the risk to a valuable item to be the value of the item times the minimum distance to a guard that can see the item. Even if a guard is close to an item that is around a corner, that guard does not affect the risk to the item, since the guard cannot see around a corner. In the diagram shown, the risks to the items are A: 4x5=20, C: 4x2.5=10, D: 2x0=0, .... The largest risks are for H: 50x7.5=375 and I: 50x7.5=375, so the maximum risk to any one item is 375. With this site layout, no arrangement of 3 guards would provide a lower maximum risk, so this arrangement of 3 guards minimizes the maximum risk. Bluewater would like to be able to tell any client who requests a particular number of guards for a particular site layout, what the minimized maximum risk will be. Input The input will consist of one to sixteen data sets, followed by a line containing only 0. On each line the data will consist of blank separated tokens. The first line of a dataset contains integers p c g, where p is the number of points specified, c is the number of corridors, and g is the number of guards to be placed. Constraints are 1< p < 12; 0 < c < 12; 0 < g < 5. Next in the dataset are a total of p groups of four tokens, each consisting of a capital letter and three nonnegative integers L x y v indicating the point (x, y) with label L contains an item with value v. If p is no greater than 6, these groups will all be on one line. If p is greater than 6, then the seventh and further groups will be on the next line. Labels will be consecutive letters starting from A. All the numbers are less than 1000. Each of the points is unique. A value of 0 for v means there is no item of value there. The number of locations with items of value will be at least as large as the number of guards. The last line of a dataset contains c strings of letters, one for each corridor. For each corridor the letters are labels for points along the corridor, in order along the line segment from one end to the other, including both endpoints, all intersection points with other corridors, and all locations on the corridor with a valuable item. Each of the points given in the dataset will lie on at least one of the corridors. Output There is one line of output for each data set. If there are not enough guards supplied to be able to see all the valuables, the line is "too few guards". Otherwise the line is an unsigned number r rounded to two places beyond the decimal point, where r is the minimum value over all placements of g guards of the maximum "risk" to the valuables. Sample Input 11 5 3 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 2 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 1 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 4 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 3 3 1 A 0 0 50 B 0 3 60 C 4 0 20 AB CB CA 0 Sample Output 375.00 1250.00 too few guards 21.21 150.00
struts1问题,在线等,如果能解决,200C币感谢
开发环境:win7旗舰版,tomcat8,jdk1.8,struts1 主要问题:jsp页面请求actioon后,报 HTTP Status 500 - No action instance for path /userAction could be created 项目基本上都是手写的,几个文件位置及内容如下: 项目名:969mall,路径(d:\tomcat8.0\webapps\969mall) 969mall文件夹下有: regist.jsp、WEB-INF文件夹 WEB-INF文件夹里面有:struts-config.xml、web.xml、classes文件夹、lib文件夹(空的) classes文件夹里有:UserAction.java、mypack文件夹 mypack文件夹里有:UserAction.class struts.jar、servlet-api.jar在tomcat8/lib里面 regist.jsp 代码如下: 主要代码:form action="userAction.do" method="post" <%@ page contentType="text/html;charset=gbk" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <body> <center><h3>用户注册页面</h3></center> <form action="userAction.do" method="post"> <table class="tab1"> <thead><tr><td colspan="2"><span>*</span>&nbsp;为必填项,为便于商超发货,建议输入有效的<em style="color: red;">收货地址</em>。</td></tr></thead> <tbody> <tr><th>用户姓名:</th><td><input name="username"><span>*</span></td></tr> <tr><th>手机号:</th><td><input name="phone"><span>*</span></td></tr> <tr><th>收货地址:</th><td><input name="address" size="40"></td></tr> <tr><th>邮编:</th><td><input name="code"></td></tr> <tr><th>身份证号:</th><td><input name="iccard"></td></tr> <tr><td colspan="2" align="center"> <input type="submit" value="提交">&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" value="重置"> <input type="hidden" name="oper" value="regist"> </td></tr> </tbody> </table> </form> </body> </html> web.xml 代码如下: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>Welcome to Tomcat</display-name> <description> Welcome to Tomcat </description> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>application</param-name> <param-value>ApplicationResources</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> </web-app> struts-config.xml 代码如下: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"> <struts-config> <form-beans> <form-bean name="userFormAction" type="mypack.UserBeanForm"/> </form-beans> <action-mappings> <action name="userFormAction" type="mypack.UserAction" path="/userAction"> <forward name="regSucceed" path="/regsucceed.jsp"/> </action> </action-mappings> </struts-config> UserAction.java 代码如下: package mypack; import javax.servlet.http.*; import org.apache.struts.action.*; import java.util.ArrayList; public class UserAction extends org.apache.struts.action.Action{ public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){ System.out.print("execute ...."); return mapping.findForward("regSucceed"); } } 由于代码被CSDN解析了,没有显示完整的代码,本人拍了照片请大家帮忙看看 ![图片说明](https://img-ask.csdn.net/upload/201511/25/1448423459_125762.jpg) ![图片说明](https://img-ask.csdn.net/upload/201511/25/1448423572_944122.jpg) ![图片说明](https://img-ask.csdn.net/upload/201511/25/1448423582_566094.jpg) 哪位朋友能帮忙解决这个问题,200C币奖励,说话算话,在线等。 如果现场过来解决,100元人民币,地铁6号线终点站,海淀五路居站,电话:18910775122。 如果能把struts2基本配置给我讲解一下,并运行简单的登录验证,我愿意出500元,作为感谢,我之前学的struts1,原理的东西还有印象,所以学起来不会太费劲。
mac 安装 maven 已经安装了xcode。帮忙看看什么问题。很着急,在线等
1.配置环境变量如下 # maven所在的目录 export PATH=/Users/documents/projectTools/apache-maven-3.3.9/bin:$PATH 2.用的是系统自带的JDK CafeMacBook-Pro:~ Cafe$ java -version java version "1.7.0_75" Java(TM) SE Runtime Environment (build 1.7.0_75-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode) 3.操作过程 3.1 下载了apache-maven-3.3.9 解压到了/Users/documents/projectTools/apache-maven-3.3.9路径 3.2 使用vi ~/.bash_profile 命令编辑文件。添加1中提到的配置 3.3 保存完成关闭的时候提示这个不可编辑,强制保存并退出了。 3.4 source ~/.bash_profile 使用这个命令是文件生效 3.5 执行 mvn -v 提示command not found。 3.6 新开一个窗口之后也提示command not found 3.7 /Users/documents/projectTools/apache-maven-3.3.9/bin 下面有个mvn文件,双击之后提示: ======提示信息开始====== Last login: Fri Jul 1 14:21:09 on ttys000 CafeChuandeMacBook-Pro:~ Cafe$ /Users/Cafe/Documents/projectTools/apache-maven-3.3.9/bin/mvn ; exit; [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.102 s [INFO] Finished at: 2016-07-01T14:26:46+08:00 [INFO] Final Memory: 5M/245M [INFO] ------------------------------------------------------------------------ ----提示信息结束----- [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException logout [进程已完成] ======提示结束======
Guard
Description ![](http://poj.org/images/3655_1.png) Guard Placement The Bluewater Security Company provides guards for clients with valuable possessions. Bluewater has found that clients are interested in having guards posted where they can see everything that is valuable merely by turning their heads, and also like guards to be posted particularly close to particularly valuable items. A sample site layout is shown above. Ignore the three black dots for now. Various locations are labeled and assigned values. For instance location A at coordinates (0,8) is the position of an item with value 4. Locations showing a value 0, like G, do not have a valuable item. The straight lines indicate corridors. For simplicity, corridors are modeled as line segments with 0 width. A guard at an intersection point of several corridors can see and therefore guard the items on each of the corridors. If Bluewater were contracted to supply 3 guards, they might choose to post them at the positions indicated with the small black dots. The guard not at an already labeled position is at (15.5, 6). To model the desire for guards to be closer to items of higher value, Bluewater calculates the risk to a valuable item to be the value of the item times the minimum distance to a guard that can see the item. Even if a guard is close to an item that is around a corner, that guard does not affect the risk to the item, since the guard cannot see around a corner. In the diagram shown, the risks to the items are A: 4x5=20, C: 4x2.5=10, D: 2x0=0, .... The largest risks are for H: 50x7.5=375 and I: 50x7.5=375, so the maximum risk to any one item is 375. With this site layout, no arrangement of 3 guards would provide a lower maximum risk, so this arrangement of 3 guards minimizes the maximum risk. Bluewater would like to be able to tell any client who requests a particular number of guards for a particular site layout, what the minimized maximum risk will be. Input The input will consist of one to sixteen data sets, followed by a line containing only 0. On each line the data will consist of blank separated tokens. The first line of a dataset contains integers p c g, where p is the number of points specified, c is the number of corridors, and g is the number of guards to be placed. Constraints are 1< p < 12; 0 < c < 12; 0 < g < 5. Next in the dataset are a total of p groups of four tokens, each consisting of a capital letter and three nonnegative integers L x y v indicating the point (x, y) with label L contains an item with value v. If p is no greater than 6, these groups will all be on one line. If p is greater than 6, then the seventh and further groups will be on the next line. Labels will be consecutive letters starting from A. All the numbers are less than 1000. Each of the points is unique. A value of 0 for v means there is no item of value there. The number of locations with items of value will be at least as large as the number of guards. The last line of a dataset contains c strings of letters, one for each corridor. For each corridor the letters are labels for points along the corridor, in order along the line segment from one end to the other, including both endpoints, all intersection points with other corridors, and all locations on the corridor with a valuable item. Each of the points given in the dataset will lie on at least one of the corridors. Output There is one line of output for each data set. If there are not enough guards supplied to be able to see all the valuables, the line is "too few guards". Otherwise the line is an unsigned number r rounded to two places beyond the decimal point, where r is the minimum value over all placements of g guards of the maximum "risk" to the valuables. Sample Input 11 5 3 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 2 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 1 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 11 5 4 A 0 8 4 B 5 8 0 C 14 8 4 D 21 8 2 E 25 8 1 F 5 22 1 G 5 20 0 H 11 12 50 I 20 0 50 J 19 10 5 K 25 4 5 ABCDE AG FGB GHCI JDK 3 3 1 A 0 0 50 B 0 3 60 C 4 0 20 AB CB CA 0 Sample Output 375.00 1250.00 too few guards 21.21 150.00
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入  假设现有4个人
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
【图解经典算法题】如何用一行代码解决约瑟夫环问题
约瑟夫环问题算是很经典的题了,估计大家都听说过,然后我就在一次笔试中遇到了,下面我就用 3 种方法来详细讲解一下这道题,最后一种方法学了之后保证让你可以让你装逼。 问题描述:编号为 1-N 的 N 个士兵围坐在一起形成一个圆圈,从编号为 1 的士兵开始依次报数(1,2,3…这样依次报),数到 m 的 士兵会被杀死出列,之后的士兵再从 1 开始报数。直到最后剩下一士兵,求这个士兵的编号。 1、方
致 Python 初学者
文章目录1. 前言2. 明确学习目标,不急于求成,不好高骛远3. 在开始学习 Python 之前,你需要做一些准备2.1 Python 的各种发行版2.2 安装 Python2.3 选择一款趁手的开发工具3. 习惯使用IDLE,这是学习python最好的方式4. 严格遵从编码规范5. 代码的运行、调试5. 模块管理5.1 同时安装了py2/py35.2 使用Anaconda,或者通过IDE来安装模
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下
日均350000亿接入量,腾讯TubeMQ性能超过Kafka
整理 | 夕颜出品 | AI科技大本营(ID:rgznai100) 【导读】近日,腾讯开源动作不断,相继开源了分布式消息中间件TubeMQ,基于最主流的 OpenJDK8开发的
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法不过,当我看了源代码之后这程序不到50
相关热词 c# clr dll c# 如何orm c# 固定大小的字符数组 c#框架设计 c# 删除数据库 c# 中文文字 图片转 c# 成员属性 接口 c#如何将程序封装 16进制负数转换 c# c#练手项目
立即提问