Tapestry5:尝试加载javascript文件

时间:2014-04-20 15:03:25

标签: java tapestry

我陷入了非常奇怪的错误。 我有一个挂毯页面,我试图导入一个javascript文件。以前,我正在导入extjs-version3.js文件(工作完美),然后我想导入extjs-version4.js文件。因此,我从文件系统中删除了version3文件,将version4文件添加到文件系统,并更改了我的tapestry页面的java代码以导入version4文件。但我总是得到错误,"版本3文件不存在"!

在调试时,我更改了页面的java代码,以便它现在不导入任何文件。

所以,现在我有一个不导入任何javascript文件的页面,我仍然收到错误,"版本3文件不存在"。

以下是具体细节。

导入javascript文件的MyPage.java。

@Import(
        library = {
            //"context:js/lib/extjs3/adapter/ext/ext-base-debug.js", 
            //"context:js/lib/extjs3/ext-all-debug-w-comments-v4.js",
            /*"context:js/lib/ext_compat_layer/ext3-compat.js",
            "context:js/lib/ext_compat_layer/ext3-core-compat.js",*/
            //"context:js/page/ActivitiesTab.js",
            //"context:js/lib/extjs3/ux/gridSearch/Ext.ux.grid.Search.js",
            //"context:js/lib/extjs3/ux/gridSearch/Ext.ux.IconMenu.js",
            //"context:js/lib/extjs3/ux/gridSearch/Ext.ux.Toast.js"
        }, 
        stylesheet = {
            /*"context:js/lib/extjs3/resources/css/ext-all.css", 
            "context:js/lib/extjs3/resources/css/xtheme-gray.css",
            "context:js/lib/extjs3/resources/css/theme-gray/core.css",*/
            //"context:js/lib/extjs3/resources/css/icons.css",
            //"context:js/lib/extjs3/resources/css/gridsearch.css"
        }
    )

我收到的错误的堆栈跟踪。

An unexpected application exception has occurred.

    org.apache.tapestry5.ioc.internal.OperationException
    Unable to locate asset 'context:js/lib/extjs3/ext-all-debug-w-comments.js' (the file does not exist).

    trace
            Constructing instance of page class net.semandex.salsa.tapestry.pages.ActivitiesTab

    java.lang.RuntimeException
    Unable to locate asset 'context:js/lib/extjs3/ext-all-debug-w-comments.js' (the file does not exist).

    Hide uninteresting stack frames Stack trace
            org.apache.tapestry5.internal.services.AssetSourceImpl.getLocalizedAssetFromResource(AssetSourceImpl.java:135)
            org.apache.tapestry5.internal.services.AssetSourceImpl.getAssetInLocale(AssetSourceImpl.java:105)
            org.apache.tapestry5.internal.services.AssetSourceImpl.getAsset(AssetSourceImpl.java:85)
            org.apache.tapestry5.internal.transform.ImportWorker$5.map(ImportWorker.java:206)
            org.apache.tapestry5.internal.transform.ImportWorker$5.map(ImportWorker.java:203)
            org.apache.tapestry5.func.LazyMappedValue.get(LazyMappedValue.java:31)
            org.apache.tapestry5.func.LazyFlow.first(LazyFlow.java:52)
            org.apache.tapestry5.func.AbstractFlow$1.next(AbstractFlow.java:68)
            org.apache.tapestry5.func.AbstractFlow.toMutableList(AbstractFlow.java:47)
            org.apache.tapestry5.func.AbstractFlow.toMutableList(AbstractFlow.java:40)
            org.apache.tapestry5.func.AbstractFlow.toList(AbstractFlow.java:205)
            org.apache.tapestry5.internal.transform.ImportWorker.convertPathsToAssets(ImportWorker.java:202)
            org.apache.tapestry5.internal.transform.ImportWorker.access$100(ImportWorker.java:40)
            org.apache.tapestry5.internal.transform.ImportWorker$4.advise(ImportWorker.java:190)
            org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86)
            net.semandex.salsa.tapestry.pages.ActivitiesTab.containingPageDidLoad(ActivitiesTab.java)
            org.apache.tapestry5.internal.structure.ComponentPageElementImpl$4.run(ComponentPageElementImpl.java:120)
            org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:977)
            org.apache.tapestry5.internal.structure.ComponentPageElementImpl.containingPageDidLoad(ComponentPageElementImpl.java:829)
            org.apache.tapestry5.internal.structure.PageImpl.loaded(PageImpl.java:171)
            org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:190)
            org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:174)
            org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
            org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
            org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
            org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:173)
            org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:81)
            org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:74)
            org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:55)
            org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2326)
            org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
            org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
            org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:45)
            org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:321)
            net.semandex.salsa.tapestry.services.AppModule$1.service(AppModule.java:164)
            org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
            org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:984)
            org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:974)
            org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
            org.apache.tapestry5.internal.services.URLRewriterRequestFilter.service(URLRewriterRequestFilter.java:50)
            org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
            org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:80)
            org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
            org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
            org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:272)
            org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
            org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
            org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
            org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:928)
            org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:147) 

MyPage.tml文件非常简单,没有任何可疑之处,但我可以根据需要发布代码。

为什么tapestry正在尝试加载未包含在任何页面中的js文件?

更新

事实上,无论我在@Import注释中写什么,总是根据前面的代码导入文件。所有页面都会发生这种情况。

2 个答案:

答案 0 :(得分:1)

这可能是由模板中某些无法加载资产的组件引起的,也可能是由MyPage扩展的父模板引起的。

根据堆栈跟踪,页面net.semandex.salsa.tapestry.pages.ActivitiesTab是问题的原因。 MyPage可能会将其加载到某处。

答案 1 :(得分:0)

现在解决了。问题在于我的生产环境而不是Tapestry。当我更改它们时,Eclipse不会更新Java类文件。因此,javascript文件是根据页面的java文件中的先前代码导入的。

Eclipse报告了以下问题。 "该项目未构建,因为"无法删除' / someName / bin /"。解决问题,然后尝试刷新此项目并构建它,因为它可能不一致" 我提到了question并解决了我的问题。

简单的刷新,清理/发布并没有解决我的问题。我不得不关闭Eclipse并重启PC。这修复了我的环境,现在Eclipse正在更新java类。