Deployment problem for an application on Tomcat

Asked

Viewed 203 times

-4

I have an application running local, where I have deployed in the local Tomcat and works perfectly. I installed the same version of Tomcat and postgres database on another machine, which in case will be the server, but is not working, gives the following errors:

com.sun.faces.mgbean.ManagedBeanCreationException: Não é possível criar instância para·a classe: control.ControlUsuarioAfastamento.
    at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(Unknown Source)
    at com.sun.faces.mgbean.BeanBuilder.build(Unknown Source)
    at com.sun.faces.mgbean.BeanManager.createAndPush(Unknown Source)
    at com.sun.faces.mgbean.BeanManager.create(Unknown Source)
    at com.sun.faces.el.ManagedBeanELResolver.resolveBean(Unknown Source)
    at com.sun.faces.el.ManagedBeanELResolver.getValue(Unknown Source)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(Unknown Source)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(Unknown Source)
    at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
    at org.apache.el.parser.AstValue.getValue(AstValue.java:161)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    at com.sun.faces.facelets.el.TagValueExpression.getValue(Unknown Source)
    at javax.faces.component.ComponentStateHelper.eval(Unknown Source)
    at javax.faces.component.ComponentStateHelper.eval(Unknown Source)
    at javax.faces.component.UIOutput.getValue(Unknown Source)
    at javax.faces.component.UIInput.getValue(Unknown Source)
    at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:92)
    at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:56)
    at org.primefaces.component.inputtext.InputTextRenderer.encodeMarkup(InputTextRenderer.java:71)
    at org.primefaces.component.inputtext.InputTextRenderer.encodeEnd(InputTextRenderer.java:52)
    at javax.faces.component.UIComponentBase.encodeEnd(Unknown Source)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(Unknown Source)
    at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(Unknown Source)
    at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(Unknown Source)
    at javax.faces.component.UIComponentBase.encodeChildren(Unknown Source)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:72)
    at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:206)
    at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:123)
    at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:58)
    at javax.faces.component.UIComponentBase.encodeEnd(Unknown Source)
    at javax.faces.component.UIComponent.encodeAll(Unknown Source)
    at javax.faces.render.Renderer.encodeChildren(Unknown Source)
    at javax.faces.component.UIComponentBase.encodeChildren(Unknown Source)
    at javax.faces.component.UIComponent.encodeAll(Unknown Source)
    at javax.faces.component.UIComponent.encodeAll(Unknown Source)
    at javax.faces.component.UIComponent.encodeAll(Unknown Source)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Unknown Source)
    at com.sun.faces.application.view.MultiViewHandler.renderView(Unknown Source)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
    at com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
    at com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
    at javax.faces.webapp.FacesServlet.service(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.persistence.PersistenceException: Unable to build entity manager factory
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:66)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
    at model.EntityManagerUtil.getEntityManager(EntityManagerUtil.java:14)
    at dao.UsuarioAfastamentoDAO.<init>(UsuarioAfastamentoDAO.java:14)
    at control.ControlUsuarioAfastamento.<init>(ControlUsuarioAfastamento.java:25)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    ... 63 more
Caused by: 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.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
    ... 73 more
Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
    at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:115)
    at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator$1$1.convert(BasicConnectionCreator.java:101)
    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)
    ... 84 more
Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:247)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:149)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:35)
    at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)
    at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:47)
    at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:30)
    at org.postgresql.Driver.makeConnection(Driver.java:414)
    at org.postgresql.Driver.connect(Driver.java:282)
    at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:38)
    ... 99 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at org.postgresql.core.PGStream.<init>(PGStream.java:61)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:129)
    ... 108 more

I’ve tried everything and nothing’s right.

  • right...I tried to search error the error of this, and saw that the database, the two have the same name...it from the error that seems to be from the call of the driver jdbc, so I put the project libs inside the folder of Tomcat libs.. He’s making a mistake that seems to say that Tomcat’s port 5432 isn’t available, and I’ve already checked it and it’s all right. the problem is the database, because I just climbed a . War that has no connection to bank. the error is in the bank and the connection, know how to solve it please?

  • for sure poblema is the database...someone would know how to make the application in Tomcat fill the database?

  • org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.: how is the datasource configured in your application? There must be some wrong configuration there, probably user/password

  • face I think the problem is that the application can not see the database...as I would to put the database on the server, and point the application at it? user and password already checked, ta all right

1 answer

0

Caused by: org.postgresql.util.Psqlexception: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is Accepting TCP/IP

Generally speaking there are few situations

1) The target ip is wrong.

2) Target has locked door 5432

3) Postgres is not set to accept external connection

One possibility, remotely possible, is that there is a difference in the libraries (usually versions) of Hibernate.

  • I am trying to make remote use of postgres, and am receiving the following error: no entry in pg_hba conf for machine "10.12.133.26", user "postgres", database "postgres", ssl disabled.. you know what that would be ?

  • Probably. This file contains some settings for access release.

  • From the minute 24:40 it makes the configuration you need, if you have a little time watch everything..... https://www.youtube.com/watch?v=67XGzdzv9k0

  • Guy worked out here, thank you so much for your help. Now I need to know how to distribute this application on the network, where I would pass the ip address / application name, like : 10.12.133.26/myApplication

  • I don’t understand the problem. Your container is already accessing the database server, users only need to know the container address, something like http : // ip_tomcat:porta_tomcat/application_name.

  • Thanks guy worked out, thanks. Just one more question, on the way to connection to the database, I’m passing .... localhost:5432..., and it’s not working, should I pass the ip along, or something like that? Thank you

  • I managed to settle here, thank you all for your help

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.