Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 当我点击相同的url时,是否会发生意外行为?_Java_Spring_Spring Mvc - Fatal编程技术网

Java 当我点击相同的url时,是否会发生意外行为?

Java 当我点击相同的url时,是否会发生意外行为?,java,spring,spring-mvc,Java,Spring,Spring Mvc,我正在制作一个简单的spring程序,实际上,当我在eclipse(eclipse默认浏览器)上运行该程序时,我得到了很好的结果。但是当我在浏览器上运行相同的url时,它表示资源不可用 这是我的照片 这是我的密码 web.xml 我已经在textAh中发布了代码,我明白了:-)我的不好。当你在外部浏览器上加载页面时,你在Eclipse日志中看到了什么吗?请检查日志。我更新问题当你点击http://localhost:8080/FirstWebProject/welcome直接?那你有404吗?

我正在制作一个简单的spring程序,实际上,当我在eclipse(eclipse默认浏览器)上运行该程序时,我得到了很好的结果。但是当我在浏览器上运行相同的url时,它表示资源不可用

这是我的照片

这是我的密码 web.xml


我已经在textAh中发布了代码,我明白了:-)我的不好。当你在外部浏览器上加载页面时,你在Eclipse日志中看到了什么吗?请检查日志。我更新问题当你点击
http://localhost:8080/FirstWebProject/welcome
直接?那你有404吗?
<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>FirstWebProject</display-name>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

    <servlet>
        <servlet-name>crunchify</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
   <servlet-mapping>
    <servlet-name>crunchify</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
    </web-app>

![crunchify-servlet.xml][2]

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/context 

http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:component-scan
        base-package="com.crunchify.controller" />

    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>
</beans>
package com.crunchify.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class CrunchifyHelloWorld {

    @RequestMapping("/welcome")
    public ModelAndView helloWorld() {

        String message = "<br><div align='center'>" + "<h1>Hello World, Spring 3.2.1 Example by Crunchify.com<h1> <br>";
        message += "<a href='http://crunchify.com/category/java-web-development-tutorial/'>More Examples</a>";
        return new ModelAndView("welcome", "message", message);
    }
}


![enter code here][4]


![<html>
<head>
<title>Spring 3.2.1 MVC Series: Index - Crunchify.com</title>
</head>
<body>
    <br>
    <div align='center'>
    <h2>

            Your 1st Spring MCV Example <br> <br>
            <a href="welcome.jsp">Click here to See Welcome Message...</a>

        </h2>
            <br> by <a href="http://crunchify.com">Crunchify.com</a>
            </div>
</body>
</html>][5]
JBOSS_HOME URL: file:/F:/naveendata/setupfile/jboss-6.0.0.M1/
Bootstrap: $JBOSS_HOME\server/default/conf/bootstrap.xml
Common Base: $JBOSS_HOME\common/
Common Library: $JBOSS_HOME\common/lib/
Server Name: default
Server Base: $JBOSS_HOME\server/
Server Library: $JBOSS_HOME\server/default/lib/
Server Config: $JBOSS_HOME\server/default/conf/
Server Home: $JBOSS_HOME\server/default/
Server Data: $JBOSS_HOME\server/default/data/
Server Log: $JBOSS_HOME\server/default/log/
Server Temp: $JBOSS_HOME\server/default/tmp/

13:25:00,266 INFO  [AbstractServer] Starting: JBossAS [6.0.0.M1 (build: SVNTag=JBoss_6_0_0_M1 date=200912040958)]
13:25:00,507 INFO  [AbstractMCServerBase] Starting Microcontainer, Main bootstrapURL=file:/F:/naveendata/setupfile/jboss-6.0.0.M1/server/default/conf/bootstrap.xml
13:25:00,771 INFO  [VFSCacheFactory] Initializing VFSCache [org.jboss.virtual.plugins.cache.CombinedVFSCache]
13:25:00,773 INFO  [VFSCacheFactory] Using VFSCache [CombinedVFSCache[real-cache: null]]
13:25:00,897 INFO  [CopyMechanism] VFS temp dir: F:\naveendata\setupfile\jboss-6.0.0.M1\server\default\tmp
13:25:00,898 INFO  [ZipEntryContext] VFS force nested jars copy-mode is enabled.
13:25:01,329 INFO  [ServerInfo] Java version: 1.7.0_25,Oracle Corporation
13:25:01,329 INFO  [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
13:25:01,329 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Client VM 23.25-b01,Oracle Corporation
13:25:01,329 INFO  [ServerInfo] OS-System: Windows 7 6.1,x86
13:25:01,329 INFO  [ServerInfo] VM arguments: -Dprogram.name=run.bat -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dfile.encoding=Cp1252 
13:25:01,346 INFO  [JMXKernel] Legacy JMX core initialized
13:25:02,690 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
13:25:02,729 INFO  [WebService] Using RMI server codebase: http://127.0.0.1:8083/
13:25:04,779 INFO  [AbstractServerConfig] JBoss Web Services - Native Server
13:25:04,779 INFO  [AbstractServerConfig] 3.2.1.GA
13:25:08,154 INFO  [LogNotificationListener] Adding notification listener for logging mbean "jboss.system:service=Logging,type=Log4jService" to server org.jboss.mx.server.MBeanServerImpl@430f4[ defaultDomain='null' ]
13:25:13,978 INFO  [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector
13:25:14,038 INFO  [MailService] Mail Service bound to java:/Mail
13:25:14,996 WARN  [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.
13:25:15,083 INFO  [TransactionManagerService] JBossTS Transaction Service (JTA version - tag:JBOSSTS_4_6_1_GA) - JBoss Inc.
13:25:15,083 INFO  [TransactionManagerService] Setting up property manager MBean and JMX layer
13:25:15,245 INFO  [TransactionManagerService] Initializing recovery manager
13:25:15,310 INFO  [TransactionManagerService] Recovery manager configured
13:25:15,310 INFO  [TransactionManagerService] Binding TransactionManager JNDI Reference
13:25:15,324 INFO  [TransactionManagerService] Starting transaction recovery manager
13:25:15,880 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Program Files\Java\jre6\bin;;H:\setupfile\eclipse;;.
13:25:15,911 INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
13:25:15,914 INFO  [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
13:25:15,924 INFO  [StandardService] Starting service jboss.web
13:25:15,925 INFO  [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.6.GA
13:25:15,951 INFO  [Catalina] Server startup in 36 ms
13:25:15,962 INFO  [TomcatDeployment] deploy, ctxPath=/invoker
13:25:16,233 INFO  [TomcatDeployment] deploy, ctxPath=/jbossws
13:25:16,249 INFO  [TomcatDeployment] deploy, ctxPath=/web-console
13:25:16,411 INFO  [RARDeployment] Required license terms exist, view vfszip:/F:/naveendata/setupfile/jboss-6.0.0.M1/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
13:25:16,417 INFO  [RARDeployment] Required license terms exist, view vfszip:/F:/naveendata/setupfile/jboss-6.0.0.M1/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
13:25:16,422 INFO  [RARDeployment] Required license terms exist, view vfszip:/F:/naveendata/setupfile/jboss-6.0.0.M1/server/default/deploy/jms-ra.rar/META-INF/ra.xml
13:25:16,428 INFO  [RARDeployment] Required license terms exist, view vfszip:/F:/naveendata/setupfile/jboss-6.0.0.M1/server/default/deploy/mail-ra.rar/META-INF/ra.xml
13:25:16,439 INFO  [RARDeployment] Required license terms exist, view vfszip:/F:/naveendata/setupfile/jboss-6.0.0.M1/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
13:25:16,478 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: Thread-2
13:25:16,493 INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
13:25:16,495 INFO  [RAMJobStore] RAMJobStore initialized.
13:25:16,495 INFO  [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
13:25:16,495 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.5.2
13:25:16,495 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
13:25:16,574 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=firstGroupAdminConsoleDS' to JNDI name 'java:firstGroupAdminConsoleDS'
13:25:16,593 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=firstGroupRailAppDS' to JNDI name 'java:firstGroupRailAppDS'
13:25:17,177 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
13:25:17,369 INFO  [ServerPeer] JBoss Messaging 1.4.3.GA server [0] started
13:25:17,434 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
13:25:17,434 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@498624 started
13:25:17,434 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
13:25:17,434 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@134d4c started
13:25:17,435 INFO  [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover
13:25:17,435 INFO  [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
13:25:17,435 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
13:25:17,435 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@1025dc5 started
13:25:17,443 INFO  [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
13:25:17,444 INFO  [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
13:25:17,488 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
13:25:17,559 INFO  [TomcatDeployment] deploy, ctxPath=/admin-console
13:25:17,616 ERROR [MyfacesConfig] Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.
13:25:17,777 WARN  [LocaleUtils] Locale name in faces-config.xml null or empty, setting locale to default locale : en_US
13:25:19,218 INFO  [TomcatDeployment] deploy, ctxPath=/FirstWebProject
13:25:19,294 INFO  [[/FirstWebProject]] Initializing Spring FrameworkServlet 'crunchify'
13:25:19,650 INFO  [TomcatDeployment] deploy, ctxPath=/
13:25:19,675 INFO  [TomcatDeployment] deploy, ctxPath=/jmx-console
13:25:19,704 INFO  [TomcatDeployment] deploy, ctxPath=/zmeu
13:25:19,738 INFO  [ProfileServiceBootstrap] Loading profile: ProfileKey@b167ca[domain=default, server=default, name=default]
13:25:19,744 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
13:25:19,756 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
13:25:19,760 INFO  [AbstractServer] JBossAS [6.0.0.M1 (build: SVNTag=JBoss_6_0_0_M1 date=200912040958)] Started in 19s:493ms
13:25:35,794 WARN  [PageNotFound] No mapping found for HTTP request with URI [/FirstWebProject/] in DispatcherServlet with name 'crunchify'
13:25:46,241 WARN  [PageNotFound] No mapping found for HTTP request with URI [/FirstWebProject/index] in DispatcherServlet with name 'crunchify'
13:26:50,674 WARN  [PageNotFound] No mapping found for HTTP request with URI [/FirstWebProject/] in DispatcherServlet with name 'crunchify'