Struts2 + Tiles + NETBEANS

Я новичок в Struts2 и успешно реализовал простые примеры.

У меня проблема с плиткой

Я ссылался на этот сайт http://www.dzone.com/tutorials/java/struts-2/struts-2-example/struts-2-tiles-example-1.html

и мои файлы точно такие же, как указано на этом сайте, упомянутом выше

Я использую: Netbeans ide 7.3, стойки 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 ответ

Решение

Я понял это. ошибка была с плагином netbeans Struts, который не имеет предоставления тайлов. Я ранее удалил плагин плитки после вставки кода, который не работал.

Теперь, что я сделал: 1. создал проект.

2. добавлен каркас Struts2 NetBeans(иначе Struts.xml не добавляется в папку конфигурации и в любом другом месте не будет работать:()

3. удаленная библиотека

4. ЧИСТЫЙ И СТРОИТЕЛЬНЫЙ

5. добавить JAR-файлы вручную

работает сейчас:) большое спасибо за советы:)

Другие вопросы по тегам