I have wildfly swarm application which is have App class, container and deployment and also facades, all working fine, but when I changed UserFacades to another package and separated from App main class which is run application, deployment fails!
import org.wildfly.swarm.Swarm;
public class App {
public static void main(String[] args) throws Exception {
MyContainer.newContainer()
.start()
.deploy(MyDeployment.createDeployment());
}
public class MyContainer {
private static final String MYSQL_OPTIONS = "autoReconnect=true&useSSL=false&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
public static Container newContainer() throws Exception {
Container container = new Container();
container.fraction(new DatasourcesFraction()
.jdbcDriver("mysql", (d) -> {
d.driverClassName("com.mysql.jdbc.Driver");
d.xaDatasourceClass("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
d.driverModuleName("com.mysql");
})
.dataSource("MyDS", (ds) -> {
ds.driverName("mysql");
ds.connectionUrl("jdbc:mysql://localhost:3306/tfm?" + MYSQL_OPTIONS);
ds.userName("root");
ds.password("root");
})
);
container.fraction(new MySQLJPAFraction()
.inhibitDefaultDatasource()
.defaultDatasource("jboss/datasources/MyDS")
);
return container;
}
public class MyDeployment {
public static JAXRSArchive createDeployment() throws Exception {
JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
deployment.addPackage(App.class.getPackage());
deployment.addAsWebInfResource(
new ClassLoaderAsset("META-INF/persistence.xml", App.class.getClassLoader()), "classes/META-INF/persistence.xml");
deployment.addAsWebInfResource(
new ClassLoaderAsset("META-INF/load.sql", App.class.getClassLoader()), "classes/META-INF/load.sql");
return deployment;
}
}
2016-10-19 01:12:17,308 ERROR [stderr] (main) Caused by: java.lang.NoClassDefFoundError: Lcom/project/backend/facades/UserFacade;
2016-10-19 01:12:17,309 ERROR [stderr] (main) Caused by: java.lang.ClassNotFoundException: com.project.backend.facades.UserFacade from [Module \"deployment.082daa7c-bb37-4a26-9740-29e7de1da93b.war:main\" from Service Module Loader]"}}
2016-10-19 01:12:17,309 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:159)
2016-10-19 01:12:17,310 ERROR [stderr] (main) at org.wildfly.swarm.container.Container.deploy(Container.java:432)
2016-10-19 01:12:17,310 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:122)
2016-10-19 01:12:17,310 ERROR [stderr] (main) at com.project.backend.App.main(App.java:15)
Whats a wrong? How can I set main App class to scan all packages?
Oh I missed add new packages to deployment class :(
deployment.addPackage("com.myproject.facades");
Related
I try to implement Artemis with wildfly (jboss).
I would like to add a custom connection load balancing behavior (client-side) to jboss (check: https://activemq.apache.org/components/artemis/documentation/1.1.0/clusters.html in "Client-Side Load balancing")
I am using a cli file to execute all my jboss commands:
here it is (I cut it there is only there interesting part):
## Artemis Broker Config
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=remote-artemis1:add(host=my-broker, port=61616)
/subsystem=messaging-activemq/server=default/remote-connector=remote-artemis1:add(socket-binding=remote-artemis1)
## Global Artemis Conf
/subsystem=messaging-activemq/server=default/pooled-connection-factory=remote-artemis:add(entries=["java:/RemoteJmsXA", "java:jboss/RemoteJmsXA"],connectors=["remote-artemis1"], user="###ARTEMIS_USER###", password="###ARTEMIS_USER_PASSWORD###", ha="true", min-pool-size="3", max-pool-size="30", statistics-enabled="true", connection-load-balancing-policy-class-name="online.myproject.utils.amqartemis.RoundRobinFromFirstConnectionLoadBalancingPolicy") <--- problem here
/subsystem=naming/binding=java\:global\/remoteContext:add(binding-type=external-context, module="org.apache.activemq.artemis", class="javax.naming.InitialContext", environment=[java.naming.factory.initial="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory", java.naming.provider.url="tcp://my-broker:61616", queue.Server_Emit_MyQueue="Server_Emit_MyQueue"])
As you can see, I try to add to the JBOSS Artemis configuration
connection-load-balancing-policy-class-name="online.myproject.utils.amqartemis.RoundRobinFromFirstConnectionLoadBalancingPolicy"
My custom load balancing class is
package online.myproject.utils.amqartemis;
import org.apache.activemq.artemis.api.core.client.loadbalance.ConnectionLoadBalancingPolicy;
import java.io.Serializable;
public class RoundRobinFromFirstConnectionLoadBalancingPolicy implements ConnectionLoadBalancingPolicy, Serializable {
private int pos = -1;
#Override
public int select(final int max) {
pos++;
if (pos >= max) {
pos = 0;
}
return pos;
}
}
But it doesn't work. It says ClassNotFoundException. Here is the logs:
[0m[33m12:18:16,024 WARN [org.apache.activemq.artemis.ra] (default-threads - 1) AMQ152005: Failure in broker activation org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter#69686637 destination=java:global/remoteContext/RestServer_Receive_MediaCreation destinationType=javax.jms.Queue selector=messageType='MEDIA_REFERENCE_CREATED_1.0.0' ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15): ActiveMQInternalErrorException[errorType=INTERNAL_ERROR message=AMQ219004: Failed to initialise session factory]
at org.apache.activemq.artemis#2.10.1//org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.initialize(ServerLocatorImpl.java:313)
at org.apache.activemq.artemis#2.10.1//org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:768)
at org.apache.activemq.artemis.ra#2.10.1//org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.setup(ActiveMQActivation.java:314)
at org.apache.activemq.artemis.ra#2.10.1//org.apache.activemq.artemis.ra.inflow.ActiveMQActivation$SetupActivation.run(ActiveMQActivation.java:731)
at org.wildfly.extension.messaging-activemq//org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter$WorkWrapper.run(ActiveMQResourceAdapter.java:171)
at org.jboss.ironjacamar.impl#1.4.17.Final//org.jboss.jca.core.workmanager.WorkWrapper.runWork(WorkWrapper.java:445)
at org.jboss.as.connector#18.0.1.Final//org.jboss.as.connector.services.workmanager.WildflyWorkWrapper.runWork(WildflyWorkWrapper.java:69)
at org.jboss.ironjacamar.impl#1.4.17.Final//org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:223)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:29)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:789)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:44)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:809)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: online.myproject.utils.amqartemis.RoundRobinFromFirstConnectionLoadBalancingPolicy from [Module "org.wildfly.extension.messaging-activemq" from local module loader #22f31dec (finder: local module finder #34c01041 (roots: /opt/jboss/wildfly/modules,/opt/jboss/wildfly/modules/system/layers/base))]
at org.apache.activemq.artemis.journal//org.apache.activemq.artemis.utils.ClassloadingUtil.newInstanceFromClassLoader(ClassloadingUtil.java:59)
at org.apache.activemq.artemis#2.10.1//org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl$3.run(ServerLocatorImpl.java:281)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.apache.activemq.artemis#2.10.1//org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.instantiateLoadBalancingPolicy(ServerLocatorImpl.java:278)
at org.apache.activemq.artemis#2.10.1//org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.initialize(ServerLocatorImpl.java:302)
... 13 more
Caused by: java.lang.ClassNotFoundException: online.myproject.utils.amqartemis.RoundRobinFromFirstConnectionLoadBalancingPolicy from [Module "org.wildfly.extension.messaging-activemq" from local module loader #22f31dec (finder: local module finder #34c01041 (roots: /opt/jboss/wildfly/modules,/opt/jboss/wildfly/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.apache.activemq.artemis.journal//org.apache.activemq.artemis.utils.ClassloadingUtil.newInstanceFromClassLoader(ClassloadingUtil.java:55)
... 17 more
It seems we have to make an additional move to make it
Here are all links to help you!
https://docs.google.com/document/d/1MxvnuSmLhcJSbUSPTNvULvbrNhj8661j_x5RFjZvoVQ/edit?usp=sharing
https://kb.novaordis.com/index.php/Writing_a_Custom_WildFly_Module
http://www.mastertheboss.com/jbossas/jboss-as-7/how-to-install-a-module-on-jboss-as-7/#:~:text=Statically%20Deployed%20Modules.,just%20like%20any%20other%20application
http://docs.wildfly.org/15/Developer_Guide.html
https://docs.wildfly.org/26/Developer_Guide.html
parag. 1.8
I have JDK 1.8 installed and below is the class I run in Eclipse:
import io.restassured.RestAssured;
import static org.hamcrest.Matchers.equalTo;
import static io.restassured.RestAssured.given;
public class test {
public static void main(String[] args) {
RestAssured.baseURI = "https://jsonplaceholder.typicode.com";
given()
.queryParam("posts", "1")
.body("")
.when()
.get()
.then()
.assertThat().statusCode(200)
.body("userId", equalTo(2));
}
}
I get the following error:
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:43)
at org.codehaus.groovy.reflection.GroovyClassValueFactory.<clinit>(GroovyClassValueFactory.java:35)
at org.codehaus.groovy.reflection.ClassInfo.<clinit>(ClassInfo.java:107)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:95)
at org.codehaus.groovy.reflection.ReflectionCache.<clinit>(ReflectionCache.java:39)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:209)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:107)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createMap(ScriptBytecodeAdapter.java:635)
at io.restassured.internal.ResponseParserRegistrar.<init>(ResponseParserRegistrar.groovy)
at io.restassured.RestAssured.<clinit>(RestAssured.java:346)
at test.main(test.java:12)
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
at org.codehaus.groovy.runtime.dgmimpl.NumberNumberMetaMethod.<clinit>(NumberNumberMetaMethod.java:33)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.createMetaMethodFromClass(MetaClassRegistryImpl.java:257)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:110)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createMap(ScriptBytecodeAdapter.java:635)
at io.restassured.internal.ResponseParserRegistrar.<init>(ResponseParserRegistrar.groovy)
at io.restassured.RestAssured.<clinit>(RestAssured.java:346)
at test.main(test.java:12)
Run mvn dependency:tree to view the whole dependency tree. You check if you see a problem here.
And try upgrading the maven-plugin version.
Trying to inject an EJB into another one using #EJB annotation :
1) The first EJB "TestEJB" has two interfaces (AdditionRemote and AdditionLocal)
and a class implementation (Addition)
2) The second EJB "TestEJB2" has two interfaces (DivisionRemote and DivisionLocal) and a class implementation (Division)
here is the code of the "TestEJB" where i want to inject a reference of TestEJB2 :
#EJB
private Division d;
public Addition() {
// TODO Auto-generated constructor stub
}
#Override
public int add(int a, int b) {
return a+b;
}
#Override
public void call() {
// TODO Auto-generated method stub
d.div(4, 2);
}
However when i use the #EJB annotation in the code i cannot deploy TestEJB anymore.
i get this error msg :
[org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"TestEJB.jar\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"TestEJB.jar\"
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class logic.Addition with ClassLoader ModuleClassLoader for Module \"deployment.TestEJB.jar\" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: Labsurd/Division;
Caused by: java.lang.ClassNotFoundException: absurd.Division from [Module \"deployment.TestEJB.jar\" from Service Module Loader]"}}
18:45:39,399 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0016: Replaced deployment "TestEJB.jar" with deployment "TestEJB.jar"
18:45:39,400 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."TestEJB.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"
you must inject one of the interfaces or add #localbean (for no-interface view) to Division
#EJB
private DivisionLocal d;
or
#EJB
private DivisionRemote d;
because the proxy is created for interfaces(when you implement interface the no-interface view will not be created for session bean unless you annotate it with #LocalBean)
I have deployed an EJB in Jboss As 7.0.
Following is what the deployment logs says about the JNDI binding of EJB.
19:21:43,269 INFO
[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor]
(MSC service thread 1-1) JNDI bindings for session bean named
ManageEmployeeBean in deployment unit deployment "EJBTest1.jar" are as
follows:
java:global/EJBTest1/ManageEmployeeBean!com.test.ejb.businessimpl.ManageEmployeeBeanRemote
java:app/EJBTest1/ManageEmployeeBean!com.test.ejb.businessimpl.ManageEmployeeBeanRemote
java:module/ManageEmployeeBean!com.test.ejb.businessimpl.ManageEmployeeBeanRemote
java:jboss/exported/EJBTest1/ManageEmployeeBean!com.test.ejb.businessimpl.ManageEmployeeBeanRemote
java:global/EJBTest1/ManageEmployeeBean
java:app/EJBTest1/ManageEmployeeBean java:module/ManageEmployeeBean
This is how my client class looks like.
package com.test.ejb.test;
import java.util.Hashtable;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.test.ejb.bean.Employee;
import com.test.ejb.businessimpl.ManageEmployeeBean;
import com.test.ejb.businessimpl.ManageEmployeeBeanRemote;
public class Client {
private static InitialContext initialContext;
public static void main(String[] args){
try {
getInitialContext();
System.out.println("CTX:"+initialContext);
} catch (NamingException e) {
e.printStackTrace();
}
try {
System.out.println("Looking up EJB !!");
ManageEmployeeBeanRemote remote =
(ManageEmployeeBeanRemote)initialContext.lookup("/EJBTest1/ManageEmployeeBean!com.test.ejb.businessimpl.ManageEmployeeBeanRemote");
System.out.println("setting employee..............");
Employee employee = new Employee();
employee.setFirstName("Renjith");
employee.setLastName("Ravi");
System.out.println("Adding employee");
remote.addEmployee(employee);
} catch (NamingException e) {
e.printStackTrace();
}
}
public static InitialContext getInitialContext() throws NamingException {
if (initialContext == null) {
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
prop.put(Context.PROVIDER_URL, "remote://localhost:4447");
prop.put(Context.SECURITY_PRINCIPAL, "renjith");
prop.put(Context.SECURITY_CREDENTIALS, "user");
initialContext = new InitialContext(prop);
}
return initialContext;
}
}
Client is not able to find the service when I run it.
CTX:javax.naming.InitialContext#40964823
Looking up EJB !!
javax.naming.CommunicationException: Could not obtain connection to any of these urls: remote://localhost:4447 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server remote:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server remote:1099 [Root exception is java.net.UnknownHostException: remote: Name or service not known]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1416)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:596)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.test.ejb.test.Client.main(Client.java:29)
Caused by: javax.naming.CommunicationException: Failed to connect to server remote:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server remote:1099 [Root exception is java.net.UnknownHostException: remote: Name or service not known]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1387)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server remote:1099 [Root exception is java.net.UnknownHostException: remote: Name or service not known]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
... 5 more
Caused by: java.net.UnknownHostException: remote: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
at java.net.InetAddress.getAllByName(InetAddress.java:1162)
at java.net.InetAddress.getAllByName(InetAddress.java:1098)
at java.net.InetAddress.getByName(InetAddress.java:1048)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:76)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
... 5 more
Can anyone tell me what am i missing here?
I saw lots of threads on similar topic in stackoverflow, but none of them helped me!!
You are attempting to use the EJB Remote client from JBoss AS 5 (or earlier).
You need to use the JBoss AS 7 EJB Remote client and configure it as per the documentation at AS7 JNDI Reference under the Remote JNDI heading.
I am using Java 8, Hibernate 5.1 and eclipse its working fine when using java code but when I setting proxy in java code or passing as VM argument in eclipse to connect AWS Cloud then hibernate connection get failed.
Java code which I setting proxy.
System.setProperty("java.net.useSystemProxies", "true");
System.setProperty("http.proxyHost", "comproxy.net");
System.setProperty("http.proxyPort", "80");
System.setProperty("http.nonProxyHosts", "localhost|127.0.0.1");
System.setProperty("http.proxyUser", "tm_user");
System.setProperty("http.proxyPassword", "password#135");
or VM argument
-Djava.net.useSystemProxies=true
-Dhttp.proxyHost=comproxy.is
-Dhttp.proxyPort=80
-Dhttp.nonProxyHosts=localhost
-Dhttp.proxyUser=tm_user
-Dhttp.proxyPassword=pwd#135
Exception
INFO: HHH000115: Hibernate connection pool size: 10 (min=1)
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:244)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:208)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692)
at com.singtel.mi.database.MIQueueDaoImpl.getSessionFactory(MIQueueDaoImpl.java:67)
at com.singtel.mi.database.MIQueueDaoImpl.openCurrentSession(MIQueueDaoImpl.java:44)
at com.singtel.mi.service.MessageInboxService.findAllCampaign(MessageInboxService.java:66)
at com.singtel.mi.service.APICallService.postJSONDatatoAWS(APICallService.java:25)
at com.singtel.mi.service.TestMessageInbox.main(TestMessageInbox.java:8)
Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator$1$1.convert(BasicConnectionCreator.java:105)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:123)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
at org.hibernate.engine.jdbc.connections.internal.PooledConnections.addConnections(PooledConnections.java:106)
at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:40)
at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:19)
at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:138)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:110)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:74)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:234)
... 17 more
Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:273)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:318)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:343)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:147)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:38)
... 32 more
Its failing because of proxy setting or -Djava.net.useSystemProxies=true or because of cloud?
public class HibernateUtil {
private final static SessionFactory sessionFactory;
//private static final SessionFactory sessionFactory = buildSessionFactory();
static{
try {
sessionFactory = new Configuration().configure("/com/singtel/mi/utils/hibernate.cfg.xml").buildSessionFactory();
} catch (Exception e) {
System.err.println("Seesion Factory Creation Failed---> "+e);
throw new ExceptionInInitializerError();
}
}
public static SessionFactory getSessionFactory(){
return sessionFactory;
}
}
I am not able to get root cause for this.