首页 \ 问答 \ application.js文件在发送到客户端时显示为application.html.erb(application.js file showing up as application.html.erb when sent to client)

application.js文件在发送到客户端时显示为application.html.erb(application.js file showing up as application.html.erb when sent to client)

运行上限部署后,我在客户端导航到我的站点时遇到错误:

Uncaught SyntaxError: Unexpected token '<' application-[hash here].js line 1

当我在客户端上查看文件“application.js”时,它只是向我显示了我的application.html.erb的呈现版本。 该文件的第一行自然是<!DOCTYPE html>所以它在第1行会得到错误是有意义的。但为什么html会被发送代替我的javascript? 我今天早些时候多次运行同样的部署并且运行正常。

我知道这里有各种各样的变量可能导致这个问题,但我想我正在寻找的只是对可能导致问题的原因的想法。

有什么想法吗?


After running a cap deploy, I'm getting an error when navigating to my site on the client:

Uncaught SyntaxError: Unexpected token '<' application-[hash here].js line 1

When I look at the file "application.js" on the client, it simply shows me a rendered version of my application.html.erb. The first line of that file is naturally <!DOCTYPE html> so it makes sense that it would get that error at line 1. But why would html be getting sent over in place of my javascript? I ran this same deploy several times earlier today and it worked fine.

I understand there are all sorts of variables here that could be causing this issue, but I guess what I'm looking for are just thoughts on what could possibly be causing the issue.

Any thoughts?


原文:https://stackoverflow.com/questions/21441739
更新时间:2024-04-03 07:04

最满意答案

我最终理解出了什么问题:

一些EJB和CDI托管bean位于相同的ejb-cdi.jar JAR中。 对JAR进行了一些重组,将所有EJB放在一个JAR中,将其作为ejbModule放在/中。 此ejbModule不再包含任何CDI托管bean。

CDI托管的bean JAR最终在WAR或/ lib中,取决于具有skinnyWar设置的maven-war-plugin的决定,但两种方式都有效。

所以答案是这样的:

正确地重新组织EJB和CDI托管bean,将它们放在单独的JAR中,并将EJB jar标记为ejbModule。


I the end I understood what went wrong:

Some EJB's and CDI managed beans were in the same ejb-cdi.jar JAR. Some restructuring of the JARs was done, putting all EJB's in one JAR, putting that as ejbModule in /. This ejbModule did not contain any CDI managed beans any more.

The CDI managed beans JARs ended up inside the WAR or in /lib, depending on what the maven-war-plugin with skinnyWar setting decided, but both ways worked.

So, the answer is this:

Reorganize the EJB and CDI managed beans properly, put them in separate JARs and mark the EJB jar as ejbModule.

相关问答

更多
  • 默认情况下,CDI在子部署之间不起作用,因为它们不使用相同的类加载器。 您可以尝试将CDI bean放在EAR / lib文件夹中,这可能有效 如果他们使用CDI,请确保所有子部署都包含beans.xml 没有理由将它作为EAR部署,你可以将两个jar放在WAR / lib中,一切都会正常工作 您可以通过将类路径值添加到meta-inf / manifest.mf来定义子部署间依赖关系(这在容器之间有些标准,这里是wildfly示例: https ://docs.jboss.org/author/displ ...
  • 似乎问题是控制器 - impl模块的反射依赖性提供的结果。 拥有所提供的依赖项,您没有将它绑定到JAR的类路径,即使它被提取并放入您的EAR / lib文件夹中。 您需要从EAR pom.xml文件中删除依赖项,并从controler-impl模块的反射依赖项中删除提供的关键字。 这样做,您需要Maven将依赖项绑定到JAR的类路径,并通过传递性将其放在EAR / lib文件夹中。 It seems that the issue results of the provided on your reflect ...
  • 它似乎是由PicketLink安装程序创建的PicketLink模块的问题。 有一个小错误导致它无法在JBoss EAP 6.1中正确配置。 将JAR打包在EAR文件中没有问题。 It appears as though it was an issue with the PicketLink module as created by the PicketLink Installer. There is a small bug that was causing it to not be configured ...
  • 现在,我将结束这个问题。 看起来问题是JEE6规范。 在自由中运行它(JEE7)它工作正常。 在Wildfly(JEE7)中运行正常 在JBoss(JEE6)中运行失败 在WAS 8.5(JEE6)中运行失败。 显然,@ Inject来自另一个Ejb-jar的bean会给容器带来问题。 当你使用@EJB时它工作正常。 For now, I'll close this question. It looks like the problem is the JEE6 spec. Running this in l ...
  • 我最终理解出了什么问题: 一些EJB和CDI托管bean位于相同的ejb-cdi.jar JAR中。 对JAR进行了一些重组,将所有EJB放在一个JAR中,将其作为ejbModule放在/中。 此ejbModule不再包含任何CDI托管bean。 CDI托管的bean JAR最终在WAR或/ lib中,取决于具有skinnyWar设置的maven-war-plugin的决定,但两种方式都有效。 所以答案是这样的: 正确地重新组织EJB和CDI托管bean,将它们放在单独的JAR中,并将EJB jar标记为e ...
  • 看起来你有一个耳朵部署。 确保从CDILiquibase到生产者的可见性。 从日志中,您的制作人似乎处于战争状态。 如果CDILiquibase位于不同的模块中,则可能是问题所在。 It looks like you have an ear deployment. Make sure that there is a visibility from CDILiquibase to your producer. From the log, Your producer seems to be located in ...
  • 看起来问题是在我的ear/META-INF/application.xml ,其中设置了true 。 由于我的application.xml是由maven-ear-plugin创建的,因此列表按字母顺序排列,因此按字母顺序处理,这对我的应用程序不起作用。 Looks like the problem was caused in my ear/META-INF/application.xml, where
  • 您应该能够将依赖项放在耳朵的/lib文件夹中,并且您的战争应该会看到它们。 从JBoss AS7文档: 耳部署是多模块部署。 这意味着,除非已定义明确的依赖关系,否则并非耳内的所有类都必须能够访问耳中的所有其他类。 默认情况下,EAR / lib目录是单个模块,每个WAR或EJB jar部署也是一个单独的模块。 子部署(wars和ejb-jars)总是依赖于父模块,这使他们可以访问EAR / lib中的类,但是它们并不总是彼此自动依赖 您还可以在JBoss AS 7中阅读有关类加载的更多信息: https ...
  • 你的代码实际上不可能有一个定义在其中的Set ,或者至少这是我将要工作的假设。 这个错误是不明确的。 但是,如果您可以提供所收到的异常的完整详细信息,而不是qualifiers @Default at injection point停留在qualifiers @Default at injection point那么将有助于获得更清晰的解决方案。 我的预感: 您提到了一个EJB项目,但是您要在应用程序中定义对JSF代码( javax.faces )的依赖关系。 Glassfish不会在直接 ...
  • 您需要将stateless-ejb-1移动到EAR中的ejb-jar模块中。 不同WAR文件中的类永远不会彼此可见,即使内置到EAR文件中也是如此。 You need to move stateless-ejb-1 into an ejb-jar module in the EAR. Classes in different WAR files are never visible to each other, even when built into an EAR file.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)