Maven搭建的SSM项目中遇到的问题

Maven搭建的SSM项目中遇到的问题

1. EL表达式失效

2. 装配异常Unable to configure ssm


解决办法

  1. 其实这两个问题的出现都是因为servlet版本和java版本不合适造成的,EL表达式在servlet2.5之后才支持而Maven项目默认的 web.xml 版本为2.3,jre 版本为1.5。
  2. servlet、jsp、EL、Tomcat、Java版本对应关系

    Servlet Spec JSP Spec EL Spec Apache Tomcat version Supported Java Versions
    3.1 2.3 3.0 8.5.x 7 and later
    3.1 2.3 3.0 8.0.x 7 and later
    3.0 2.2 2.2 7.0.x 6 and later
    2.5 2.1 2.1 6.0.x 5 and later
    2.4 2.0 不支持 5.5.x 1.4 and later

    web.xml v2.5

      
      
    
  3. java版本问题导致的异常

    • 异常具体信息如下:

      org.eclipse.m2e.wtp.MarkedException: Unable to configure ssm
          at org.eclipse.m2e.wtp.AbstractProjectConfiguratorDelegate.configureProject(AbstractProjectConfiguratorDelegate.java:98)
          at org.eclipse.m2e.wtp.WTPProjectConfigurator.configure(WTPProjectConfigurator.java:68)
          at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:120)
          at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$3.call(ProjectConfigurationManager.java:501)
          at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$3.call(ProjectConfigurationManager.java:1)
          at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
          at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
          at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:494)
          at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:432)
          at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:345)
          at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)
          at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
          at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
          at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
          at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1351)
          at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:342)
          at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
          at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
          at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
      Caused by: org.eclipse.core.runtime.CoreException: One or more constraints have not been satisfied.
          at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:363)
          at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)
          at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)
          at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$1.run(FacetedProject.java:324)
          at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
          at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2267)
          at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modify(FacetedProject.java:339)
          at org.eclipse.m2e.wtp.WebProjectConfiguratorDelegate.configure(WebProjectConfiguratorDelegate.java:136)
          at org.eclipse.m2e.wtp.AbstractProjectConfiguratorDelegate.configureProject(AbstractProjectConfiguratorDelegate.java:94)
          ... 18 more
      
    • 解决办法

      • 升级maven项目默认的web.xml 版本2.3,jre 版本1.5。
      • 具体方法参见http://blog.csdn.net/peng_hong_fu/article/details/53584104#comments

你可能感兴趣的:(JavaWeb)