hibernate.cfg.xml not found error while running on server - java

project run on local machine, but after deploy on server get hibernate.cfg.xml not found error.same war file deploy on local machine tomcat it work.
2015-07-13 07:00:00 ERROR JobRunShell:211 - Job grpPM.jobPM threw an unhandled Exception:
org.hibernate.HibernateException: Hibernate.cfg.xml not found
at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2095)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2076)
at hibernet.HibernateConnection.getInstance(HibernateConnection.java:32)
at hibernet.HibernateData.getConnection(HibernateData.java:45)
at stockRefresh.Script330.runScript(Script330.java:34)
at StockRefresh330.execute(StockRefresh330.java:13)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2015-07-13 07:00:00 ERROR ErrorLogger:2425 - Job (grpPM.jobPM threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.hibernate.HibernateException: Hibernate.cfg.xml not found]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.hibernate.HibernateException: Hibernate.cfg.xml not found
at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2095)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2076)
at hibernet.HibernateConnection.getInstance(HibernateConnection.java:32)
at hibernet.HibernateData.getConnection(HibernateData.java:45)
at stockRefresh.Script330.runScript(Script330.java:34)
at StockRefresh330.execute(StockRefresh330.java:13)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)

Put your hibernate.cfg.xml in your classpath. and if you don't want, use the below to get context of your XML file.
Configuration configuration = new Configuration();
configuration.configure("hibernate.cfg.xml");//Here you can give your exact path w.r.t your project`

Put your hibernate.cfg.xml under src/main/resources if the file is the same folder as your Java files your build system may not copy it.

Related

SOAP webservice app init fails with Unsupported protocol: https'

I have a SOAP webservice backend only application which fails to start(deploy) since March 30th with the error //Unsupported protocol: https'// (including the single quote next to https), no code change went in since an year or so and none of the other system URL's are configured within the application code or property file other than xlmns namespace uri in the XSD. I get that error during the application deployment (initialization) even before testing any webservice within the application.
I am on JDK 1.6.0.45 on a weblogic 10.3.6 server. (Sorry, I know I need to upgrade to newer, I will get there eventually I promise)
The full stacktrace is as below, I did enable ssl debug logs during weblogic start up but I do not see any error that would convey a missing certificate.
<Apr 5, 2022 2:31:49 PM IST> <Warning> <HTTP> <BEA-101162> <User defined listener org.springframework.web.context.ContextLoaderListener failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection#0': Invocation of init method failed; nested exception is org.springframework.xml.xsd.commons.CommonsXsdSchemaException: Schema [ServletContext resource [/WEB-INF/xsd/AcmeAppGateway.xsd]] could not be loaded; nested exception is org.apache.ws.commons.schema.XmlSchemaException: Unsupported protocol: https'.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection#0': Invocation of init method failed; nested exception is org.springframework.xml.xsd.commons.CommonsXsdSchemaException: Schema [ServletContext resource [/WEB-INF/xsd/AcmeAppGateway.xsd]] could not be loaded; nested exception is org.apache.ws.commons.schema.XmlSchemaException: Unsupported protocol: https'
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
Truncated. see log file for complete stacktrace
Caused By: org.springframework.xml.xsd.commons.CommonsXsdSchemaException: Schema [ServletContext resource [/WEB-INF/xsd/AcmeAppGateway.xsd]] could not be loaded; nested exception is org.apache.ws.commons.schema.XmlSchemaException: Unsupported protocol: https'
at org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection.afterPropertiesSet(CommonsXsdSchemaCollection.java:147)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
Truncated. see log file for complete stacktrace
Caused By: org.apache.ws.commons.schema.XmlSchemaException: Unsupported protocol: https'
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:710)
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:706)
at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:538)
at org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementChild(SchemaBuilder.java:1513)
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:658)
Truncated. see log file for complete stacktrace
Caused By: java.net.ProtocolException: Unsupported protocol: https'
at weblogic.net.http.HttpClient.openServer(HttpClient.java:384)
at weblogic.net.http.HttpClient.New(HttpClient.java:252)
at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:213)
at weblogic.net.http.HttpURLConnection.followRedirect(HttpURLConnection.java:698)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:464)
Truncated. see log file for complete stacktrace
>
The xsd mentioned in the error has xlmns URI's as below, is it possible these are causing the problem by being on higher TLS version (TLS 1.2 which is not supported on JDK 1.6)?
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
There is no other URL configured in that xsd other than above. I came across another similiar error here, but that was due to a missing certificate. Much appreciated if anyone can point me in the right direction.
Okay finally figured out what the problem was after trial and error.
On our SOAP WS project we have set schemaLocation as below:
I believe* this site schemas.xmlsoap.org has turned on TLS1.2 on March 30th (*I am open to other reasons but this is my assumption at this time) which is why our application was working fine until that day and start to fail post that date. I verified the TLS configuration of that URL on SSLABS which said anything below TLS1.2 was disabled for that site.
Since I am still on JDK 1.6 there is no way to connect to this site which is on higher TLS than the one supported by 1.6, which is why the application initialization was failing while establishing connection to that url. The solution was to manually download the xml content of the soap encoding from the URL to a xml file and place this file within the project folder and then refer this file within the XSD for schemaLocation as shown below. This did the trick!!

getting Exception in thread "main" java.lang.NoClassDefFoundError: weblogic.descriptor.BeanUpdateListener after applying weblogic 10.3.6 patch

getting error while applying patch on web logic 10.3.6 version .
Exception in thread "main" java.lang.NoClassDefFoundError:
weblogic.descriptor.BeanUpdateListener
Caused by: java.lang.ClassNotFoundException: weblogic.descriptor.BeanUpdateListener
this is the error in log file after applying patch . you need to give the execute permission at /prod/applc/bea1036/wlserver/server/lib directory to newly created .jar files.

Errors when deploying Jar files to weblogic 12.1.3

This is the error log resulting from the exception. I'm not sure what causing it to fail during the deployments
2016-05-23 10:19:57,656 INFO [com.sdars.util.EJBUtil]: {java.naming.provider.url=t3:/localhost:7001, java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory, weblogic.jndi.enableServerAffinity=true}
2016-05-23 10:19:57,656 INFO [com.sdars.util.EJBUtil]: javax.naming.ConfigurationException: t3:/localhost:7001 [Root exception is java.net.MalformedURLException: t3:/localhost:7001]
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:36)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:808)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:365)
at weblogic.jndi.Environment.getContext(Environment.java:319)
at weblogic.jndi.Environment.getContext(Environment.java:288)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.init(InitialContext.java:244)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
Caused by: java.net.MalformedURLException: t3:/localhost:7001
at weblogic.protocol.ServerURL.parseURL(ServerURL.java:486)
at weblogic.protocol.ServerURL.<init>(ServerURL.java:104)
at weblogic.rjvm.ServerURL.<init>(ServerURL.java:49)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:335)
... 37 more
I believe that the error is due to trivial typo in java.naming.provider.url property value. Missing a / in the url.
Change from : t3:/localhost:7001
to : t3://localhost:7001
You may look at an example here from oracle's documentation.
Exception you are getting is
Root exception is java.net.MalformedURLException: t3:/localhost:7001. Standard weblogic url is of following format.
t3://ip:port
Looks like you are missing / in your url configuration
t3://localhost:7001

Izpack. Cannot find named resource: 'info'

I have built executable .jar file with izpack-maven-plugin.
If i run it like:
java -jar install.jar -everything is okay.
But if I run it using JWS i have got an error message:
Can't load log handler "com.izforge.izpack.util.LogHandler"
java.lang.ClassNotFoundException: com.izforge.izpack.util.LogHandler
java.lang.ClassNotFoundException: com.izforge.izpack.util.LogHandler
Exception in thread "AWT-EventQueue-0" com.izforge.izpack.api.exception.IzPackException: com.izforge.izpack.api.exception.ContainerException: com.izforge.izpack.api.exception.ResourceNotFoundException: Cannot find named resource: 'info'
at com.izforge.izpack.installer.bootstrap.InstallerGui$1.run(InstallerGui.java:64)
Caused by: com.izforge.izpack.api.exception.ContainerException: com.izforge.izpack.api.exception.ResourceNotFoundException: Cannot find named resource: 'info'
Caused by: com.izforge.izpack.api.exception.ResourceNotFoundException: Cannot find named resource: 'info'
Any ideas?
Thanks.

Cassandra Cannot locate storage-conf.xml

I was trying to start Cassandra on FreeBSD with /usr/local/share/cassandra/bin/cassandra.
But it gives me the following error messages, any idea how to get around the problem? Any suggestions will be GREATLY appreciated. Thank you.
INFO 21:16:38,666 JNA not found. Native methods will be disabled.
ERROR 21:16:38,684 Exception encountered during startup.
java.lang.ExceptionInInitializerError
at org.apache.cassandra.thrift.CassandraDaemon.setup(CassandraDaemon.java:73)
at org.apache.cassandra.thrift.CassandraDaemon.main(CassandraDaemon.java:224)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Cannot locate storage-conf.xml via storage-config system property or classpath lookup.
at org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:584)
... 2 more
Caused by: java.lang.RuntimeException: Cannot locate storage-conf.xml via storage-config system property or classpath lookup.
at org.apache.cassandra.config.DatabaseDescriptor.getStorageConfigPath(DatabaseDescriptor.java:180)
at org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:187)
... 2 more
Exception encountered during startup.
java.lang.ExceptionInInitializerError
at org.apache.cassandra.thrift.CassandraDaemon.setup(CassandraDaemon.java:73)
at org.apache.cassandra.thrift.CassandraDaemon.main(CassandraDaemon.java:224)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Cannot locate storage-conf.xml via storage-config system property or classpath lookup.
at org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:584)
... 2 more
Caused by: java.lang.RuntimeException: Cannot locate storage-conf.xml via storage-config system property or classpath lookup.
at org.apache.cassandra.config.DatabaseDescriptor.getStorageConfigPath(DatabaseDescriptor.java:180)
at org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:187)
... 2 more
Is this cassandra 0.6.x? You probably want to upgrade to the latest cassandra, 0.7.4
The error is because Cassandra can't locate storage-conf.xml. This file should be in your cassandra conf directory, see http://wiki.apache.org/cassandra/StorageConfiguration
If you upgrade to cassandra 0.7.x, you will need a cassandra.yaml file instead.

Categories