当前位置: 首页 > 知识库问答 >
问题:

支柱2 磁贴 网豆

夏俊杰
2023-03-14

我是Struts2的初学者,并且已经成功实现了简单的示例。

我对瓷砖有意见

我从这个网站推荐 http://www.dzone.com/tutorials/java/struts-2/struts-2-example/struts-2-tiles-example-1.html

我的文件和上面提到的那个网站上的完全一样

我使用的是:Netbeans ide 7.3、struts 2、glassfish 3.1.2.2(注意:教程网站上的可下载文件在EclipseIDE中运行,我需要在Netbeans中添加什么额外内容)

以下是我在GlassFish中发现的错误:

**HTTP状态404**

类型:状态报告

描述:请求的资源()不可用。

 INFO: Removing TilesContext for context: org.apache.catalina.core.ApplicationContextFacade
INFO: Initializing Tiles2 application context. . .
WARNING: Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
INFO: Finished initializing Tiles2 application context.
WARNING: Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
INFO: Initializing Tiles2 container. . .
WARNING: Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
WARNING: Cannot find TilesRequestContextFactory class org.apache.tiles.portlet.context.PortletTilesRequestContextFactory
INFO: Tiles2 container initialized
INFO: Publishing TilesContext for context: org.apache.tiles.servlet.context.ServletTilesApplicationContext
INFO: Parsing configuration file [struts-default.xml]
SEVERE: WebModule[/StrutsTiles1]PWC1270: Exception starting filter struts2
java.lang.InstantiationException

尝试了两种库样式,即:netbeans插件额外平铺和所有jar

完整的错误日志

INFO: Removing TilesContext for context: org.apache.catalina.core.ApplicationContextFacade
INFO: Initializing Tiles2 application context. . .
WARNING: Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
INFO: Finished initializing Tiles2 application context.
WARNING: Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
INFO: Initializing Tiles2 container. . .
WARNING: Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
WARNING: Cannot find TilesRequestContextFactory class org.apache.tiles.portlet.context.PortletTilesRequestContextFactory
INFO: Tiles2 container initialized
INFO: Publishing TilesContext for context: org.apache.tiles.servlet.context.ServletTilesApplicationContext
INFO: Parsing configuration file [struts-default.xml]
SEVERE: WebModule[/StrutsTiles1]PWC1270: Exception starting filter struts2
java.lang.InstantiationException
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:124)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4685)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5377)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:353)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
    at org.glassfish.deployment.admin.ReDeployCommand.execute(ReDeployCommand.java:126)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
Caused by: Unable to load configuration. - bean - jar:file:/C:/Documents%20and%20Settings/chiya/My%20Documents/Downloads/StrutsTiles1/build/web/WEB-INF/lib/struts2-core-2.3.4.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
    ... 48 more
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/C:/Documents%20and%20Settings/chiya/My%20Documents/Downloads/StrutsTiles1/build/web/WEB-INF/lib/struts2-core-2.3.4.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:222)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 54 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/C:/Documents%20and%20Settings/chiya/My%20Documents/Downloads/StrutsTiles1/build/web/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:29:72 - bean - jar:file:/C:/Documents%20and%20Settings/chiya/My%20Documents/Downloads/StrutsTiles1/build/web/WEB-INF/lib/struts2-core-2.3.4.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:206)
    ... 57 more

INFO: WEB0671: Loading application [StrutsTiles1] at [/StrutsTiles1]
INFO: StrutsTiles1 was successfully deployed in 7,922 milliseconds.

帮助:)

共有1个答案

翁俊良
2023-03-14

我解决了。该错误与netbeans struts插件有关,该插件没有磁贴供应。在粘贴无效的代码后,我已经移除了tiles插件。

现在我做的是:1 .创建一个项目。

2.添加了NetBeans的struts2框架(否则Struts.xml未添加到配置文件夹中,并且在任何其他地方都不起作用:()

3.删除库

4.清洁和建造

5 .手动添加JAR文件

现在工作:)非常感谢您的建议:)

 类似资料:
  • 我正在研究Struts 1到2迁移应用程序。我也成功地迁移了JSP、Action、POJO和XML。 但是当我在我的 Struts 2 应用程序中集成 Tiles 3 时,与 Struts 1 Tiles 相比,它突然在网页上显示了一些更大的字体大小。 我没有得到到底发生了什么影响了JSP,好像我没有改变任何东西w. r. t超文本标记语言,CSS?

  • 我想将磁贴 3 集成到我的 Web 应用程序 spring3 struts2 Hibernate中,但我没有任何想法要开始。我看到的所有示例都仅使用带有瓷砖的 struts2,没有Spring的集成。

  • 我正在尝试结合使用Struts2和Spring上传文件。但是,在到达action类之后,我的文件、和文件内容类型都显示为。我试图寻找问题,但没有结果。下面是我上传文件的代码。 : Struts.xml applicationContext-web.xml 管理上传动作 磁贴.xml Result.jsp

  • 我找不到struts-tiles2-1.4.0-SNAPSHOT的源代码。jar版本的平铺。jar文件位于http://people.apache.org/~pbenedict/struts-osgi/org/apache/struts/struts-tiles2/1.4.0-SNAPSHOT/location。

  • 我一直在尝试制作一款基于2D Tile的游戏,但在出现问题之前并没有走得太远。游戏很好,除了它非常慢,并且空间不断出现在瓷砖之间。我尝试将所有磁贴图像放入一个图像中以加载以使其更平滑,但它不起作用。我需要有关如何优化游戏以获得更好的fps的帮助。 大多数显示类 大多数地图类 这是图块之间渲染错误的图片

  • Custom UI Tiles 是由 Home Assistant 官方社区 @eddi89 制作的自定义 UI 卡片。类似 HADashboard,该插件可让用户使用方型磁贴控制常用设备。 项目地址:https://github.com/c727/home-assistant-tiles 项目社区讨论:https://community.home-assistant.io/t/custom-ui