So we are trying to backup our database using the following script:
public void backup() throws SQLException {
try {
log.info("Trying to connect with DB");
String sqlFilePath = "./Backup_" + LocalDateTime.now() + ".sql";
Query q = em.createNativeQuery(String.format("SCRIPT TO '%s'", sqlFilePath));
log.info(q.getResultList().toString());
}
catch (Exception e){
e.printStackTrace();
throw new SQLException();
}
}
This works flawlessly on linux, however our software needs to be able to run on Windows as well, however in windows I keep getting the following fileNotFoundException:
14:57:29,826 ERROR [stderr] (default task-21) Caused by: org.h2.jdbc.JdbcSQLException: IO Exception: "java.io.FileNotFoundException: .\Backup_2020-02-25T14:57:29.148621200.sql (The filename, directory name, or volume label syntax is incorrect)"; "./Backup_2020-02-25T14:57:29.148621200.sql"; SQL statement:
14:57:29,826 ERROR [stderr] (default task-21) BACKUP TO './Backup_2020-02-25T14:57:29.148621200.sql' [90031-193]
14:57:29,826 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
14:57:29,826 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.message.DbException.get(DbException.java:168)
14:57:29,827 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.message.DbException.convertIOException(DbException.java:330)
14:57:29,827 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.command.dml.BackupCommand.backupTo(BackupCommand.java:102)
14:57:29,827 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.command.dml.BackupCommand.update(BackupCommand.java:51)
14:57:29,827 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.command.CommandContainer.update(CommandContainer.java:98)
14:57:29,827 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.command.Command.executeUpdate(Command.java:258)
14:57:29,827 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:160)
14:57:29,828 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:146)
14:57:29,828 ERROR [stderr] (default task-21) at org.jboss.ironjacamar.jdbcadapters#1.4.17.Final//org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
14:57:29,828 ERROR [stderr] (default task-21) at org.hibernate#5.3.13.Final//org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175)
14:57:29,828 ERROR [stderr] (default task-21) ... 107 more
14:57:29,828 ERROR [stderr] (default task-21) Caused by: java.io.FileNotFoundException: .\Backup_2020-02-25T14:57:29.148621200.sql (The filename, directory name, or volume label syntax is incorrect)
14:57:29,828 ERROR [stderr] (default task-21) at java.base/java.io.FileOutputStream.open0(Native Method)
14:57:29,828 ERROR [stderr] (default task-21) at java.base/java.io.FileOutputStream.open(FileOutputStream.java:292)
14:57:29,828 ERROR [stderr] (default task-21) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
14:57:29,829 ERROR [stderr] (default task-21) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:124)
14:57:29,829 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.store.fs.FilePathDisk.newOutputStream(FilePathDisk.java:290)
14:57:29,829 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.store.fs.FileUtils.newOutputStream(FileUtils.java:233)
14:57:29,829 ERROR [stderr] (default task-21) at com.h2database.h2#1.4.193//org.h2.command.dml.BackupCommand.backupTo(BackupCommand.java:67)
14:57:29,829 ERROR [stderr] (default task-21) ... 114 more
Any help would be much appreciated! :)
: cannot be used on Windows as a part of file name. You need to replace it with some allowed character, for example with LocalDateTime.now().toString().replace(':', '_') or with custom DateTimeFormatter.
Related
We are currently developing a quarkus based MicroService application using the following extensions:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-metrics</artifactId>
</dependency>
Depending on the deployment environment, the application needs a database connection, or either not. We have been playing around with several properties inside the application.properties to get this two deployment modes up and running, but unfortunately we are failing when using it without database. While starting the application, we always getting this exception:
2021-03-05 10:52:33,364 WARN [io.agr.pool] (agroal-11) Datasource '<default>': I/O-Fehler: The Network Adapter could not establish the connection
2021-03-05 10:52:33,365 DEBUG [io.agr.pool] (agroal-11) Cause: : java.sql.SQLRecoverableException: I/O-Fehler: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:801)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:782)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:39)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:704)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:390)
at oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:510)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:149)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:106)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:206)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:452)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:434)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:65)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:569)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:521)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:660)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:287)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1481)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:540)
... 15 more
Caused by: java.io.IOException: Operation timed out, socket connect lapse 75231 ms. /172.24.2.177 1526 0 1 true
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:229)
at oracle.net.nt.ConnOption.connect(ConnOption.java:172)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:508)
... 20 more
Caused by: java.net.ConnectException: Operation timed out
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:482)
at sun.nio.ch.Net.connect(Net.java:474)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:647)
at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
at oracle.net.nt.TimeoutSocketChannel.connect(TimeoutSocketChannel.java:108)
at oracle.net.nt.TimeoutSocketChannel.<init>(TimeoutSocketChannel.java:86)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:188)
... 22 more
Setting quarkus.datasource.jdbc.initial-size = 0 didn't helped.
Setting quarkus.datasource.jdbc = false leads to this build failure:
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.12.1.Final:build (default) on project avitech-aim-snw-svc: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#configurationDescriptorBuilding threw an exception: io.quarkus.runtime.configuration.ConfigurationException: The default datasource is not configured but the persistence unit '<default>' uses it.
[ERROR] at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.lambda$producePersistenceUnitDescriptorFromConfig$6(HibernateOrmProcessor.java:754)
[ERROR] at java.util.Optional.orElseThrow(Optional.java:290)
[ERROR] at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.producePersistenceUnitDescriptorFromConfig(HibernateOrmProcessor.java:753)
[ERROR] at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.handleHibernateORMWithNoPersistenceXml(HibernateOrmProcessor.java:686)
[ERROR] at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.configurationDescriptorBuilding(HibernateOrmProcessor.java:310)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR] at java.lang.Thread.run(Thread.java:748)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [Help 1]
Does anyone have any idea if such a use case is even achievable ?
I'm trying to using wildfly-swarm with project-stages.yml
src/main/resources/META-INF/persistence.xml
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="somePU" transaction-type="JTA">
<jta-data-source>someDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.validation.mode" value="CALLBACK" />
</properties>
</persistence-unit>
</persistence>
src/main/resources/project-stages.yml
project:
stage: default
---
project:
stage: development
logger:
level: DEBUG
swarm:
jdbc:
driver: org.apache.derby.jdbc.EmbeddedDriver
ds:
name: someDS
connection:
url: jdbc:derby:memory:someDB;create=true
port:
offset: 200
---
project:
stage: integration
---
project:
stage: staging
---
project:
stage: production
mvn -Dswarm.project.stage=development -jar target/some-server-swarm.jar
2017-01-07 18:09:48,782 ERROR [stderr] (main) java.lang.reflect.InvocationTargetException
2017-01-07 18:09:48,782 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-01-07 18:09:48,782 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:37)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:44)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:35)
2017-01-07 18:09:48,784 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0007: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.someDS"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"some-server.war#somePU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.someDS]","jboss.persistenceunit.\"some-server.war#somePU\" is missing [jboss.naming.context.java.jboss.datasources.someDS]"]}
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:280)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:95)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:475)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:612)
2017-01-07 18:09:48,784 ERROR [stderr] (main) ... 7 more
2017-01-07 18:09:48,784 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:37)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:44)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:35)
2017-01-07 18:09:48,785 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0007: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.someDS"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"some-server.war#somePU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.someDS]","jboss.persistenceunit.\"some-server.war#somePU\" is missing [jboss.naming.context.java.jboss.datasources.someDS]"]}
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:280)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:95)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:475)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:612)
2017-01-07 18:09:48,786 ERROR [stderr] (main) ... 7 more
I'm sharing my solution for others.
src/main/resources/project-stages.yml
As, simas_ch noted, How to create a datasource is enough to fix this part.
swarm:
datasources:
data-sources:
someDS:
driver-name: h2
connection-url: jdbc:h2:mem:someDB
src/main/resources/META-INF/persistence.xml
This part is always the most painful one. I had to do like this.
<jta-data-source>java:jboss/datasources/someDS</jta-data-source>
I am a newbie to the wildfly-swarm. I was able to prep a basic JAX-RS application in swarm, and worked like a charm. But when I'd tried to introduce CDI to my app, everything went wrong. The Bean Injection is not working!. I'm getting NULLPointerException in places where I'd tried to invoke the bean methods. I'd tried all possible solutions, that I could find over web. But nothing worked. Following is my pom.xml config;
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.uss</groupId>
<artifactId>hatts-swarm</artifactId>
<version>0.0.1-M0</version>
<packaging>war</packaging>
<properties>
<version.wildfly.swarm>2016.12.1</version.wildfly.swarm>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>bom-all</artifactId>
<version>${version.wildfly.swarm}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>jax_cdi</finalName>
<plugins>
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${version.wildfly.swarm}</version>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Java EE 7 dependency -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jaxrs</artifactId>
<version>2016.12.1</version>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jaxrs-cdi</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>weld</artifactId>
</dependency>
</dependencies>
</project>
and following is my Main class;
public class BootStrap {
/**
* #param args
*/
public static void main(String[] args) {
try {
Swarm swarm = new Swarm(true);
JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "jax_cdi_microprofile");
deployment.addClass(RESTEntryManager.class).addClass(HTML5Generator.class)
.addClass(HattsACKTestService.class)
.addAsWebInfResource(new StringAsset(new StringBuilder("<?xml version=\"1.0\"?>")
.append(" <beans bean-discovery-mode=\"all\" version=\"1.1\" ")
.append(" xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"")
.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"")
.append(" xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd\"/>")
.toString()), "beans.xml")
.addAllDependencies();
swarm.start().deploy(deployment);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
and following is my JAX-RS resource declaration;
#Path("/handshake-test")
#Stateless
public class HattsACKTestService {
#Resource(lookup = "java:jboss/ee/concurrency/executor/default")
private ManagedExecutorService managedExecutorService;
#Inject
private Authenticator authenticator;
public HattsACKTestService() {
// INTENTIONALLY LEFT AS BLANK
}
#GET
public void handshake(#Suspended AsyncResponse asyncResponse) {
/*
* new Thread(() -> {
*
* HTML5Generator html5Generator = new HTML5Generatorg.Builder()
* .setPageTitle("HATTS Handshake Service Response").appendPageBody(
* "H1", "Handshake Initiated...") .build();
*
* asyncResponse.resume(html5Generator.getContentBuilder().toString());
*
* }).start();
*/
/*managedExecutorService.submit(() -> {
asyncResponse.resume("Hi World!!!.. This is Wildfly in CDI !!!");
});*/
asyncResponse.resume(authenticator.authenticate());
}
}
and following is the Authenticator bean;
#Stateless
public class Authenticator {
/**
*
*/
public Authenticator() {
// TODO Auto-generated constructor stub
}
public String authenticate() {
return "Authenticated !!";
}
}
Not even the ManagedExectorService is injected!. Could any one help me to sort this out ?
Updating with the latest Error got, after trying the solution mentioned by Ken
2017-01-08 20:31:01,290 ERROR [stderr] (main) java.lang.reflect.InvocationTargetException
2017-01-08 20:31:01,291 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-01-08 20:31:01,291 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-01-08 20:31:01,292 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-01-08 20:31:01,292 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-01-08 20:31:01,292 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:37)
2017-01-08 20:31:01,293 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:44)
2017-01-08 20:31:01,293 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:35)
2017-01-08 20:31:01,294 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0007: Deployment failed: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"hatts.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"hatts.war\".WeldStartService: Failed to start service
2017-01-08 20:31:01,294 ERROR [stderr] (main) Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Authenticator with qualifiers #Default
2017-01-08 20:31:01,294 ERROR [stderr] (main) at injection point [UnbackedAnnotatedField] #Inject private com.uss.hatts.rest.acktest.HattsACKTestService.authenticator
2017-01-08 20:31:01,294 ERROR [stderr] (main) at com.uss.hatts.rest.acktest.HattsACKTestService.authenticator(HattsACKTestService.java:0)
2017-01-08 20:31:01,294 ERROR [stderr] (main) "},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"hatts.war\".WeldStartService"],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}
2017-01-08 20:31:01,295 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:280)
2017-01-08 20:31:01,295 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:95)
2017-01-08 20:31:01,295 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:475)
2017-01-08 20:31:01,295 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:612)
2017-01-08 20:31:01,295 ERROR [stderr] (main) ... 7 more
2017-01-08 20:31:01,296 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
2017-01-08 20:31:01,296 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-01-08 20:31:01,301 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-01-08 20:31:01,303 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-01-08 20:31:01,304 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-01-08 20:31:01,304 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:37)
2017-01-08 20:31:01,304 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:44)
2017-01-08 20:31:01,304 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:35)
2017-01-08 20:31:01,305 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0007: Deployment failed: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"hatts.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"hatts.war\".WeldStartService: Failed to start service
2017-01-08 20:31:01,305 ERROR [stderr] (main) Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Authenticator with qualifiers #Default
2017-01-08 20:31:01,305 ERROR [stderr] (main) at injection point [UnbackedAnnotatedField] #Inject private com.uss.hatts.rest.acktest.HattsACKTestService.authenticator
2017-01-08 20:31:01,305 ERROR [stderr] (main) at com.uss.hatts.rest.acktest.HattsACKTestService.authenticator(HattsACKTestService.java:0)
2017-01-08 20:31:01,305 ERROR [stderr] (main) "},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"hatts.war\".WeldStartService"],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}
2017-01-08 20:31:01,305 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:280)
2017-01-08 20:31:01,306 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:95)
2017-01-08 20:31:01,306 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:475)
2017-01-08 20:31:01,306 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:612)
2017-01-08 20:31:01,308 ERROR [stderr] (main) ... 7 more
Your Maven dependencies need to be:
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>cdi</artifactId>
</dependency>
weld was renamed to cdi a few releases ago, and jaxrs-cdi is no longer explicitly needed. It's brought in for you.
With what you have in a custom main(), I'd recommend not using one at all and just letting WF Swarm create your deployment for you.
What could be causing this?
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:335)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
root cause
javax.servlet.ServletException: org.postgresql.util.PSQLException: Protocol error. Session setup failed.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:905)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:834)
org.apache.jsp.login_005fsave_jsp._jspService(login_005fsave_jsp.java:149)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:335)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
root cause
org.postgresql.util.PSQLException: Protocol error. Session setup failed.
org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:381)
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:94)
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
org.postgresql.Driver.makeConnection(Driver.java:369)
org.postgresql.Driver.connect(Driver.java:245)
java.sql.DriverManager.getConnection(DriverManager.java:664)
java.sql.DriverManager.getConnection(DriverManager.java:208)
org.apache.jsp.login_005fsave_jsp._jspService(login_005fsave_jsp.java:107)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:335)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
I think the problem is on your configuration file
You may should check this post : org.postgresql.util.PSQLException: Protocol error. Session setup failed
I am using Java, hibernate, sqlserver 2008 R2, Jboss ,
getting this exception,
WARNING [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-26-thread-7) ConnectionID:4 TDS header contained invalid packet length:12590; packet size:8000
2013-05-21 15:59:15,777 SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-26-thread-7) ConnectionID:4 got unexpected value in TDS response at offset:7992
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) Exception in thread "pool-25-thread-2"
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) org.hibernate.TransactionException: JDBC rollback failed
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:204)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at com.wideplay.warp.persist.hibernate.HibernateLocalTxnInterceptor.rollbackIfNecessary(HibernateLocalTxnInterceptor.java:149)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at com.wideplay.warp.persist.hibernate.HibernateLocalTxnInterceptor.invoke(HibernateLocalTxnInterceptor.java:72)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at com.softpak.marserm.engine.library.impl.JobReportStatusUtil.updateReportStatus(Unknown Source)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at com.softpak.marserm.engine.library.impl.ExecutableJob.run(Unknown Source)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at java.lang.Thread.run(Thread.java:662)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:170)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:304)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at com.microsoft.sqlserver.jdbc.SQLServerConnection.rollback(SQLServerConnection.java:1655)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcRollback(BaseWrapperManagedConnection.java:697)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at org.jboss.resource.adapter.jdbc.WrappedConnection.rollback(WrappedConnection.java:500)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196)
2013-05-21 15:59:15,808 ERROR [STDERR] (pool-25-thread-2) ... 7 more
Why is it happening?