- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 Java 项目(RESTful 服务),是在 Windows 计算机上的 Eclipse 中开发的,并在 Wildfly 10 服务器上运行。一切都很完美。现在我正在尝试在 OSX 计算机上的 Eclipse 上部署相同的项目。
我已经安装了 Eclipse Neon 2 并导入了 Java 项目。我还安装了 Wildfly 10 服务器。 Java项目已发布到服务器。我可以启动服务器,并访问 Welcome to WildFly
页面:
localhost:8080/
同样在控制台中,您可以看到 Spring RESTful 服务全部加载:
例如
Mapped "{[/category/list],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.jobs.spring.domain.Category>> com.jobs.spring.controller.CategoryRESTService.findAllCategorys()
服务器日志与 Windows 环境相同。
20:39:10,051 INFO [org.jboss.modules] (main) JBoss Modules version 1.5.2.Final
20:39:20,242 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
20:39:20,309 INFO [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) starting
20:39:21,277 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found jbosswildfly-1.0.war in deployment directory. To trigger deployment create a file called jbosswildfly-1.0.war.dodeploy
20:39:21,316 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
20:39:21,332 INFO [org.xnio] (MSC service thread 1-1) XNIO version 3.4.0.Final
20:39:21,339 INFO [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.4.0.Final
20:39:21,370 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
20:39:21,374 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
20:39:21,384 INFO [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
20:39:21,388 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
20:39:21,384 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
20:39:21,390 INFO [org.jboss.as.security] (MSC service thread 1-5) WFLYSEC0001: Current PicketBox version=4.9.6.Final
20:39:21,406 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
20:39:21,419 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
20:39:21,533 INFO [org.jboss.as.naming] (MSC service thread 1-5) WFLYNAM0003: Starting Naming Service
20:39:21,543 INFO [org.jboss.as.connector] (MSC service thread 1-5) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.4.Final)
20:39:21,549 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0003: Undertow 1.4.0.Final starting
20:39:21,545 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
20:39:21,554 INFO [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 4.0.21.Final
20:39:21,552 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
20:39:21,568 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2
20:39:21,695 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path '/Users/richardmarais/Development/servers/wildfly-10.1.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
20:39:21,704 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0012: Started server default-server.
20:39:21,708 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0018: Host default-host starting
20:39:21,843 INFO [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 32 (per class), which is derived from the number of CPUs on this host.
20:39:21,844 INFO [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 128 (per class), which is derived from thread worker pool sizing.
20:39:21,846 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
20:39:22,063 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-7) WFLYDM0111: Keystore /Users/richardmarais/Development/servers/wildfly-10.1.0.Final/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
20:39:22,083 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) WFLYDS0013: Started FileSystemDeploymentService for directory /Users/richardmarais/Development/servers/wildfly-10.1.0.Final/standalone/deployments
20:39:22,096 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "jbosswildfly-1.0.war" (runtime-name: "jbosswildfly-1.0.war")
20:39:22,315 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-2) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.4.Final
20:39:22,351 INFO [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 65) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:39:22,351 INFO [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 63) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:39:22,351 INFO [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 59) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:39:22,352 INFO [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 65) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:39:22,353 INFO [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 63) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:39:22,353 INFO [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 59) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:39:22,359 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
20:39:22,705 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBossWS 5.1.5.Final (Apache CXF 3.1.6)
20:39:31,951 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
20:39:32,148 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) WFLYWELD0003: Processing weld deployment jbosswildfly-1.0.war
20:39:32,206 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-5) HV000001: Hibernate Validator 5.2.4.Final
20:39:32,440 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
20:39:32,441 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
20:39:32,444 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0005: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.2)
20:39:32,473 INFO [org.jboss.weld.Version] (MSC service thread 1-4) WELD-000900: 2.3.5 (Final)
20:39:32,509 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0018: Started Driver service with driver-name = jbosswildfly-1.0.war_com.mysql.jdbc.Driver_5_1
20:39:32,510 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0018: Started Driver service with driver-name = jbosswildfly-1.0.war_com.mysql.fabric.jdbc.FabricMySQLDriver_5_1
20:39:32,512 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0018: Started Driver service with driver-name = jbosswildfly-1.0.war_org.postgresql.Driver_9_2
20:39:33,458 INFO [io.undertow.servlet] (ServerService Thread Pool -- 68) 1 Spring WebApplicationInitializers detected on classpath
20:39:33,532 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 68) Initializing Mojarra 2.2.13.SP1 20160303-1204 for context '/jbosswildfly-1.0'
20:39:34,739 INFO [io.undertow.servlet] (ServerService Thread Pool -- 68) Initializing Spring FrameworkServlet 'rest'
20:39:34,741 INFO [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 68) FrameworkServlet 'rest': initialization started
20:39:34,745 INFO [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (ServerService Thread Pool -- 68) Refreshing WebApplicationContext for namespace 'rest-servlet': startup date [Thu Jan 12 20:39:34 SAST 2017]; root of context hierarchy
20:39:34,778 INFO [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (ServerService Thread Pool -- 68) Registering annotated classes: [class com.jobs.spring.configuration.AppConfig]
20:39:35,061 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (ServerService Thread Pool -- 68) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
20:39:35,171 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] (ServerService Thread Pool -- 68) Loaded JDBC driver: com.mysql.jdbc.Driver
20:39:35,262 INFO [org.hibernate.Version] (ServerService Thread Pool -- 68) HHH000412: Hibernate Core {5.2.1.Final}
20:39:35,264 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 68) HHH000206: hibernate.properties not found
20:39:35,265 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 68) HHH000021: Bytecode provider name : javassist
20:39:35,300 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 68) HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
20:39:35,588 WARN [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (ServerService Thread Pool -- 68) HHH000342: Could not obtain connection to query metadata : Access denied for user 'admin'@'localhost' (using password: YES)
20:39:35,596 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 68) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
20:39:35,606 INFO [org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl] (ServerService Thread Pool -- 68) HHH000422: Disabling contextual LOB creation as connection was null
20:39:36,268 WARN [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (ServerService Thread Pool -- 68) Autowired annotation is not supported on static fields: private static final java.util.logging.Logger com.jobs.spring.service.EmailServiceImpl.logger
20:39:36,456 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (ServerService Thread Pool -- 68) Mapped "{[/category/list],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.jobs.spring.domain.Category>> com.jobs.spring.controller.CategoryRESTService.findAllCategorys()
20:39:36,459 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (ServerService Thread Pool -- 68) Mapped "{[/category/list/{id}],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<com.jobs.spring.domain.Category> com.jobs.spring.controller.CategoryRESTService.findCategoryById(java.lang.String)
20:39:36,461 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (ServerService Thread Pool -- 68) Mapped "{[/email/password/{email}/{userName}],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<java.lang.String> com.jobs.spring.controller.EmailRESTService.requestPassword(java.lang.String,java.lang.String)
20:39:36,493 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (ServerService Thread Pool -- 68) Mapped "{[/subcategory/list/{categoryId}],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.jobs.spring.domain.SubCategory>> com.jobs.spring.controller.SubCategoryRESTService.findAllCategorys(java.lang.String)
20:39:36,494 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (ServerService Thread Pool -- 68) Mapped "{[/subcategory/list],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.jobs.spring.domain.SubCategory>> com.jobs.spring.controller.SubCategoryRESTService.findAllCategorys()
20:39:36,494 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (ServerService Thread Pool -- 68) Mapped "{[/subcategory/{id}],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<com.jobs.spring.domain.SubCategory> com.jobs.spring.controller.SubCategoryRESTService.findCategoryById(java.lang.String)
20:39:36,778 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter] (ServerService Thread Pool -- 68) Looking for @ControllerAdvice: WebApplicationContext for namespace 'rest-servlet': startup date [Thu Jan 12 20:39:34 SAST 2017]; root of context hierarchy
20:39:36,881 INFO [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 68) FrameworkServlet 'rest': initialization completed in 2140 ms
20:39:36,882 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 68) WFLYUT0021: Registered web context: /jbosswildfly-1.0
20:39:36,916 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "jbosswildfly-1.0.war" (runtime-name : "jbosswildfly-1.0.war")
20:39:37,006 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
20:39:37,006 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
20:39:37,007 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 27297ms - Started 953 of 1201 services (404 services are lazy, passive or on-demand)
但是,如果我尝试访问其中一项 RESTful 服务,例如:
http://localhost:8080/jbosswildfly/category/list
我得到:
404 - Not Found
还有
http://localhost:8080/jbosswildfly/
还返回:
404 - Not Found
所以我猜上下文根有问题:jbosswildfly
该代码与 Windows 环境完全相同,因此我希望 OSX 环境能够正常工作。
我不确定我的 Wildfly 服务器或 Spring 配置是否有问题,或者其他问题。
WebInitializer.java
public class WebAppInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(AppConfig.class);
ctx.setServletContext(servletContext);
Dynamic dynamic = servletContext.addServlet("rest", new DispatcherServlet(ctx));
dynamic.addMapping("/*");
dynamic.setLoadOnStartup(1);
}
}
上面的onStartup
方法确实在启动时被调用。
类别RESTService.java
@CrossOrigin(origins = {"*"})
@RestController
@RequestMapping(CategoryRESTService.BASE_URI)
public class CategoryRESTService {
public static final String BASE_URI = "/category";
@Autowired
private CategoryService categoryService;
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Category>> findAllCategorys() {
List<Category> categories = categoryService.findAll();
return new ResponseEntity<List<Category>>(categories, HttpStatus.OK);
}
@RequestMapping(value = "/list/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Category> findCategoryById(@PathVariable String id) {
Category category = categoryService.findById(id);
return new ResponseEntity<Category>(category, HttpStatus.OK);
}
}
该应用程序还可以在带有 Wildfly 10 盒的 OpenShift 服务器上成功运行。
感谢任何帮助。
最佳答案
看来您应该通过以下方式访问:
http://localhost:8080/jbosswildfly-1.0/category/list
关于java - 在 JBoss Wildfly 服务器上运行 Spring 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41620896/
我是 JBoss 的新手,发现了很多不同的术语 - JBoss EAP、JBoss Server、Wildfly、Jboss Web,以及很多不是最新的或针对旧版本的文档。 我从哪里开始了解 JBos
JBoss ESB 服务器之间有什么区别(可在此处获得:http://jbossesb.jboss.org/downloads/) 和 JBoss fuse ( http://www.jboss.or
我在我的 PC 上安装了 JBoss 4 到目录 C:\JBoss4 并将环境变量 JBOSS_HOME 设置为此目录: JBOSS_HOME=C:\JBoss4 我需要在同一台 PC 上安装 JB
我有一个 JBoss 服务器正在运行并且想要部署一个服务。 该服务连接到在以下 xml 文件中配置的数据库 jdbc:postgresql://localhost:543
jboss 中的超时是如何工作的?网络应用程序如何知道何时重定向到登录页面? 只是为了澄清! -我知道如何在 jboss 上配置超时。我的问题是,Jboss 如何知道 session 已超时以及何时超
使用JBoss Forge启动新项目时,默认情况下该项目是使用Maven构建系统创建的。我如何利用Forge 2. *的Gradle插件使用Gradle而不是Maven创建项目? % forge Us
当前配置: 正在运行的16个Pod,基于JBoss TCP的集群以及google ping发现。容器作为状态集部署在Kubernetes集群上。 没有负载的初始群集按预期运行,没有任何单个问题,但是当
我以为这将是一个 JBoss 常见问题解答,但我找不到它。 我想同时运行 JBoss 4 和 JBoss 5。我通过将端口的前导数字更改为 9 手动更改了 JBoss 5 服务器/默认实例上的所有端口
我们在 JBoss AS 6 上实现了一些服务作为我们希望迁移到 JBoss AS 7 的单例服务。 这些服务在 jboss-service.xml 文件中声明,该文件位于 EJB 包中,类似于以下代
例如,如何确定我的简单 JBoss 4.2.3 服务器正在监听端口 8080? 这是我最接近的一次,但这不起作用: MBeanServerConnection server = (MBeanServe
我正在尝试找到从语法上确定我的程序是在 Jboss 5 还是 Jboss 7 (eap-6.1) 上运行的最佳方法。到目前为止,我找到的方法是特定于 jboss 5 或 jboss 7 的,这不起作用
我在域模式下使用 JBoss 6.4.8 版本。我想通过 CLI 添加这 4 个系统属性: 1- /host=myserver/server-config=node/system-property=j
在 JBoss 4 中,您可以在文件中设置对象的部署顺序( .jar 、 .war 、 .sar 等...): conf/xmdesc/org.jboss.deployment.MainDeploye
概括地说,JBoss 5 的关闭有什么作用?如果我只是杀死 java 进程而不是优雅地关闭 JBoss,可能会出现什么问题? 对于我的应用程序来说,正常的 JBoss 5 关闭大约需要 6 分钟,这个
我最近在 CentOS 6.7 服务器上安装了 JBoss AS 7。 jboss as 工作正常。为了测试,我部署了一个 .war 文件并对其进行了测试,效果很好!但现在我尝试从我的台式电脑访问相同
我有 jboss 应用程序。并想自动测试部署。并希望将此任务作为项目添加到 Hudson 我的愿景基于以下阶段: 将我的应用程序放到 JBoss(复制耳朵、配置、库等) 运行 JBoss 我有一台 L
我对 JBoss 很陌生。目前我有一个需求,我需要在 JBoss 上部署应用程序(已经在 Tomcat 上运行)。我下载了 JBoss,但是版本 7 中的目录结构不同。 我正在运行 bin\stand
我是 JBoss AS 7 的新手。我尝试在 JBoss AS 7 上部署我的 war 文件,这似乎工作正常。我的问题是在哪里可以看到部署的内容。 我希望它像 Tomcat 一样,它应该有一个探索的
我使用多播方法在两个不同的 JBoss 服务器之间配置了集群。 当我启动两个 JBoss 服务器时,两个服务器都将连接。 一天后,我收到以下消息 server.log 中的群集开始显示错误 05:28
为了打开/关闭我们产品的跟踪-“类别”或“记录器”标签,我们应该在jboss-log4j.xml中使用什么? 默认情况下,JBoss在jboss-log4j.xml中使用“类别”。 但据我所知,不赞成
我是一名优秀的程序员,十分优秀!