I persist with every error I get thrown and mostly always work out the solution. I find a good walk helps. But this one has me stumped, I've been staring at this same error all day. Like Ticcie in Invalid Oracle URL specified: OracleDataSource.makeURL suggests, the error message does nothing to help understand what is wrong.
SEVERE: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Invalid Oracle URL specified: OracleDataSource.makeURL
Error Code: 0
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:762)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
I am doing Arquillian Integration Testing for a Java EE 7 EAR application. Its been going well using JPA and the DerbyDb but I now need to test Native Oracle DB (11g) SQL. So I've setup a new testing project to connect to an OracleDB using EclipseLink.
I CAN connect to the database through the Eclipse IDE DataSource explorer and ping it no problems.
I DO connect to a sister Oracle database in Glassfish standalone and ping it no problems.
But the Arquillian Test cannot connect to it with the above ambiguous error. It would be nice if the error said what exactly is the problem.
I use exactly the same URL as I have with the Eclipse IDE DataSource explorer:
jdbc:oracle:thin:#marina.work.com:1521:orcl
The Arquillian setup is the same as I did for DerbyDb (pretty-much same as http://arquillian.org/guides/testing_java_persistence/) with these variations for OracleDB:
src/main/resources-glassfish-embedded/sun-resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-resource pool-name="ArquillianOraclePool" jndi-name="jdbc/arquillian" />
<jdbc-connection-pool name="ArquillianOraclePool" res-type="javax.sql.DataSource" datasource-classname="oracle.jdbc.pool.OracleDataSource"
is-isolation-level-guaranteed="false" >
</jdbc-connection-pool>
</resources>
src/main/resources-glassfish-embedded/test-persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="esaarch01-pu" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/arquillian</jta-data-source>
<jar-file>test.jar</jar-file>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.Url" value="jdbc:oracle:thin:#marina.work.com:1521:orcl" />
<property name="javax.persistence.jdbc.Password" value="demo" />
<property name="javax.persistence.jdbc.User" value="test" />
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver" /> <!-- driver. -->
<property name="javax.persistence.jdbc.platform" value="org.eclipse.persistence.platform.database.oracle.OraclePlatform" />
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.logging.level" value="FINE" />
<property name="eclipselink.logging.level.sql" value="FINE" />
</properties>
</persistence-unit>
</persistence>
I've introduced XML well-formedness errors such as text in the properties element and receive the following error. This shows that this file is being picked up for the correct purposes:
java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 21; columnNumber: 16; Deployment descriptor file META-INF/persistence.xml in archive [test.jar]. cvc-complex-type.2.3: Element 'properties' cannot have character [children], because the ...
I've tried different property names but none change the error message. Which makes me think that the URL property isn't being picked up at all.
I've tried different variations of the URL (with matching mods for name and password):
javax.persistence.jdbc.url URL Url (three variations)
eclipselink.jdbc.url URL Url (three variations)
No variation works. Same error.
It would be really nice if the exception can be more specific about what it can and cannot find.
My question is, can anyone tell me the solution or suggest what's wrong or something I can try and work out what is going wrong?
UPDATE
I've posted this question on the Oracle forums and included the entire stack trace and the sample minimal code plus some instructions. If anyone is keen to look at it I'd be grateful.
https://forums.oracle.com/message/11152777#11152777
driver type is not provided, for my case, I used "thin" xaProperties.driverType="thin", please find similar config for your case.
Related
at the beginning of the project we worked with Corda Opensource, and we used the command line argument logging-level=WARN to change the log level of the nodes.
When we started using Corda Enterprise, we noticed that a details-node-.log file was created. It is a log file that grows fast and is at TRACE level.
Our question: can the log in this file affect the performance of our cordapps and can we change the level of this log or disable it?
Corda Enterprise adds that logger which is not present in Open Source Corda.
The only impact I can see for a CordApp could be probably the lack of space on the server, so if in your case this log file becomes too big too quickly, it would be a good idea to configure it to avoid possible problems.
You can override the log4j configuration file and give it as input to the jar like this:
java -jar Dlog4j.configurationFile=new-log-config.xml <en-service>.jar
It is standard log4j, so you can also configure the rollover period and the size.
For reference, you can also take a look to this log4j.xml in open source Corda to see how the loggers are configured.
So, can probably override the logger you're concerned about with the following:
<?xml version="1.0" encoding="UTF-8"?>
<Properties>
...
<Property name="detailLogLevel">TRACE</Property>
</Properties>
<Appenders>
...
<RollingRandomAccessFile name="Detailed-RollingFile-Appender"
fileName="${log-path}/details-${log-name}.log"
filePattern="${archive}/details-${log-name}.%date{yyyy-MM-dd}-%i.log.gz">
<Policies>
...your policies...
</Policies>
<DefaultRolloverStrategy>
...your strategy...
</DefaultRolloverStrategy>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
...
<Logger name="DetailedInfo" additivity="false" level="${detailLogLevel}">
<AppenderRef ref="Detailed-RollingFile-Appender"/>
</Logger>
</Loggers>
I'm using thymeleaf 2.0.5 with spring 3 mvc configured as follows in webmvc-config.xml
<bean id="templateResolver"
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver"
p:prefix="/WEB-INF/templates/"
p:suffix=".html"
p:templateMode="HTML5" />
<bean id="templateEngine"
class="org.thymeleaf.spring3.SpringTemplateEngine"
p:templateResolver-ref="templateResolver" />
<bean id="viewResolver"
class="org.thymeleaf.spring3.view.ThymeleafViewResolver"
p:templateEngine-ref="templateEngine" />
The above configuration is working fine. The problem is that when an exception is thrown I see the following cryptic message in the logs:
ERROR org.thymeleaf.TemplateEngine - [THYMELEAF][1] Exception processing template "dataAccessFailure": Error resolving template "dataAccessFailure", template might not exist or might not be accessible by any of the configured Template Resolvers
Is there a way to configure the view resolver to exclude certain patterns?
As per the accepted answer I changed the following bean config in webmvc-config.xml
<bean id="viewResolver"
class="org.thymeleaf.spring3.view.ThymeleafViewResolver"
p:templateEngine-ref="templateEngine"
p:viewNames="index,questionnaires/*" />
You can configure your template resolver to only resolve certain view names by means of the template resolver's viewNames property. In this property you can enter several patterns (separated by commas) and use wildcards like e.g. admin/*.
Disclaimer, due to StackOverflow rules: I am thymeleaf's author.
Could you possibly have an error page mapped to "dataAccessFailure" in your web.xml. Something like:
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/dataAccessFailure</location>
</error-page>
I successfully configured Jboss 7 to work with Oracle 11g by installing the jdbc drivers as a module and adding the datasource definition in the standalone.xml.
However, now I want to move the datasource definition to it's own file which I dropped into the deployments directory.
That resulted in the following failure:
javax.naming.NameNotFoundException: jdbc/MyDatasource -- service jboss.naming.context.java.jboss.jdbc.MyDatasource
Is that not possible anymore with jboss 7?(I believe it used to be the case with jboss 5) Here is how the ds file looks:
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jndi-name="java:jboss/jdbc/MyDatasource" pool-name="OracleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:#oracle.host:1521:mydb</connection-url>
<driver>
oracle
</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<use-fast-fail>false</use-fast-fail>
</validation>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.jdbc"/>
</drivers>
</datasources>
I do not know how you are doing the jndi look up,but from the error message it looks you are using the normal (old way) of java:jdbc/DatasourceName instead of the new way java:jboss/datasources/DatasourceName.
I tried xxx-ds.xml for data source configuration.
I got a WARN
12:22:12,988 WARN [org.jboss.as.connector.deployer.dsdeployer]
(MSC service thread 1-2) JBAS010411: <drivers/> in standalone -ds.xml
deployments aren't supported: Ignoring xxx-ds.xml
So from the message, I confirmed that JBoss7 doesn't support a separate ds file in stadalone mode.
I have a Java application and I integrated JavaFX 1.3 on it. I have spent more than three days trying to deploy it as a Web Start Application and it is impossible.
I have a jar running with the console (javafx -jar MatchTestCaseGenerator-2.0-jar-with-dependencies.jar) but when I try to execute the jnlp I have the following error:
java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1285)
at java.lang.System.getProperty(System.java:667)
at sun.awt.shell.ShellFolderManager.get(ShellFolderManager.java:57)
at sun.awt.shell.ShellFolder.get(ShellFolder.java:227)
at javax.swing.filechooser.FileSystemView.getDefaultDirectory(FileSystemView.java:404)
at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:552)
at javax.swing.JFileChooser.<init>(JFileChooser.java:334)
at javax.swing.JFileChooser.<init>(JFileChooser.java:286) ...
I have the jar file signed and verified and my JNLP file is like that:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="file:/Users/ana/Projects/Java/workspace/Match Test Case Generator 2.0/target" href="MatchTestCaseGenerator.jnlp">
<information>
<title>Match Test Case Generator</title>
<vendor>KV </vendor>
<homepage href=""/>
<description>some_description</description>
<offline-allowed/>
<shortcut>
<desktop/>
</shortcut>
</information>
<resources>
<j2se version="1.6+"/>
<extension name="JavaFX Runtime" href="http://dl.javafx.com/1.3/javafx-rt.jnlp"/>
<jar href="MatchTestCaseGenerator-2.0-jar-with-dependencies.jar" main="true"/>
</resources>
<application-desc main-class="com.sun.javafx.runtime.main.Main" progress-class="com.javafx.progressbar.ProgressManager">
<argument>MainJavaFXScript=com.knowledgevalues.mtcg.javafx.MainFx</argument>
</application-desc>
</jnlp>
Am I missing something? should I introduces a policy file in the jar?? I'm totally lost
Thank you very much in advance for any help.
Try to add next section to your jnlp file:
<security>
<all-permissions/>
</security>
The final solution was to remove all the folders that included javafx classes except the Main class.
With that, it worked without problems!!
I am trying to deploy a spring mvc webapp into a tomcat server. I have been testing locally using the maven-jetty-plugin. In my spring configuration I am using a properties placeholder, and pulling my properties from an external file:
<context:property-placeholder ignore-resource-not-found="true" ignore-unresolvable="true"/>
<bean id="modelPropertyPlaceholder" class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<property name="searchContextAttributes" value="true"/>
<property name="contextOverride" value="true"/>
<property name="ignoreResourceNotFound" value="true"/>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="locations">
<list>
<value>classpath:default.model.properties</value>
<value>file:/etc/app/app.properties</value>
<value>${config}</value>
</list>
</property>
</bean>
This worked with my jetty plugin...however when I deploy the WAR file to the tomcat server I receive the following error:
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
In my external properties file I have the driver class and connect url defined. as so:
jndi.jpa.rms.datasource=jdbc/testDS
rms.db.driver=com.mysql.jdbc.Driver
rms.db.url=jdbc:mysql://testdatabaseurl:3306/test
rms.db.user=sa
rms.db.password=asfdas
rms.db.checkconnsql=select 1
rms.hibernate.generateddl=false
rms.hibernate.showsql=true
rms.hibernate.dbdialect=org.hibernate.dialect.MySQLDialect
Update:
It seems that tomcat does pickup the external properties file:
14:23:09.803 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'modelPropertyPlaceholder'
14:23:09.810 [main] INFO o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from class path resource [default.model.properties]
14:23:09.810 [main] INFO o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from URL [file:/etc/app/app.properties]
14:23:09.810 [main] INFO o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/${config}]
14:23:09.811 [main] WARN o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Could not load properties from ServletContext resource [/${config}]: Could not open ServletContext resource [/${config}]
I'm not sure why tomcat isn't picking up the connection url and driver.
Is this a tomcat issue or am I missing something? Thanks
It's not a Tomcat issue, you must have made some minor mistake and properties are not loaded.
Are properties files located in proper place on your Tomcat environment?
Are you sure that in those properties files you have not left some keys blank?
If both answers to that questions are true, try changing your config with following:
<context:property-placeholder location="ADD_PATH_TO_YOUR_FILES SEPARATED_WITH_SPACES"/>
I guess that you are mixing here two property placeholders, one 'regular' and the other - bounded to servlet context. I can bet that somehow they get overlapped and one of them is getting silently ignored.
I would just stick to property-placeholder.
Old question, but...
Judging from the log output, it appears that Spring has not resolved your ${config} reference, or else this would have been substituted into the path given in the last log message:
Could not load properties from ServletContext resource [/${config}]: Could not open ServletContext resource [/${config}]
Here's a case I just encountered where it resolved ${catalina.home}/conf/myprops.properties correctly but was unable to load the referenced file:
Could not load properties from ServletContext resource [/D:/somepath/apache-tomcat/conf/myprops.properties]: Could not open ServletContext resource [/D:/somepath/apache-tomcat/conf/myprops.properties]
I tracked down the error in my case - I needed to prefix the external file reference with 'file:'. That is, it should have been file:${catalina.home}/conf/myprops.properties
(It is possible the Spring version difference may have impacted on the log output for you though also, and that it did resolve the reference but just did not show this in the output. For reference, I'm using Spring 4.1.6 at present).