FineReport打入jar包使用nginx代理的问题

楼主
我是社区第82067位番薯,欢迎点我头像关注我哦~
我的springboot 项目打包为 jar 运行在自己的开发用电脑 win10上,nginx反向代理的配置如下
  1.   location /xzy {
  2.                         proxy_pass http://127.0.0.1:8081/pademis;
  3.                         proxy_redirect http://127.0.0.1:8081/pademis /xzy;
  4.                         proxy_cookie_path /pademis /xzy;
  5.                 }
复制代码
访问地址是:http://localhost/xzy
该 jar 提供 web 项目的主要逻辑,登录进入系统,进入具体页面增删改查都测试通过。

同时制作了一个 springboot 的jar项目其中包含了 FineReport用于提供报表打印,nginx代理配置如下
  1.   location /xzyr {
  2.                         proxy_pass http://127.0.0.1:8083;
  3.                 }
复制代码

这样的配置通过地址:http://localhost/xzyr  或者 http://localhost/xzyr/ReportServer 都访问不通
只有:http://localhost:8083/ReportServer 可以正常登录进入决策系统(这个 jar 项目的端口号是8083.说明上面nginx配置的不对?)
项目引入 FineReport 的 js 文件是这样的:
  1. <script type="text/javascript" src="../xzyr/ReportServer?op=emb&resource=finereport.js"></script>
复制代码

点击访问该地址:http://localhost/xzyr/ReportServer?op=emb&resource=finereport.js
显示404,如果手动将上面的地址修改为:http://localhost:8083/ReportServer?op=emb&resource=finereport.js
就可以正常访问到这个 js 文件。总结下来是我的 nginx 配置的提供报表打印服务的 jar 的配置不对?
我要如何修改?
分享扩散:

沙发
发表于 2021-8-15 18:41:19
你reportservlet 咋初始化的?
我初始化提示报错
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'frReportServlet' defined in class path resource [com/hrp/config/MvcConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.ServletRegistrationBean]: Factory method 'frReportServlet' threw exception; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:212)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:203)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:97)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:86)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:259)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:233)
        at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:843)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:434)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123)
        ... 19 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.ServletRegistrationBean]: Factory method 'frReportServlet' threw exception; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 59 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
        at com.hrp.config.MvcConfig.frReportServlet(MvcConfig.java:15)
        at com.hrp.config.MvcConfig$$EnhancerBySpringCGLIB$$e9d9308d.CGLIB$frReportServlet$0(<generated>)
        at com.hrp.config.MvcConfig$$EnhancerBySpringCGLIB$$e9d9308d$$FastClassBySpringCGLIB$$f5b58fe6.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at com.hrp.config.MvcConfig$$EnhancerBySpringCGLIB$$e9d9308d.frReportServlet(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 60 common frames omitted
Caused by: java.lang.RuntimeException: No TrialLicense or AuthorizedLicense.
        at com.fr.web.BaseServlet.eWdSHHNcOqcGpdb(Unknown Source)
        at com.fr.web.BaseServlet.<clinit>(Unknown Source)
        ... 71 common frames omitted
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

返回顶部 返回列表