Jboss 7 and datasources - oracle11g

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.

Related

DB2 .Net Connector error : AESEncryptADONet

I have a very simple .Net Core app trying to create and open a connection to a DB2 database (on AS/400).
I have this error when I try to create the DBConnection object, with the message:
ERROR 58005 SQL0902 There are no context policies. Function: AESEncryptADONet.
There are no more details, unfortunately.
We meet the same error and solved it by setting Path of environment variables on Windows / Linux (LD_LIBRARY_PATH) / MacOS (DYLD_LIBRARY_PATH).
For example:
Our environment:
ASP.NET Core v3.1
IBM .NET Core 3.1 / EntityFrameworkCore 3.1 in v11.5.4
IIS 8.5
Windows Server 2012 R2 (64 bits)
In web.config, we add the <environmentVariable name="Path" value="C:\Users\Administrator\.nuget\packages\ibm.data.db2.core\3.1.0.200\buildTransitive\clidriver\bin" />.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location ... >
<system.webServer>
...
<aspNetCore ... >
<environmentVariables>
<environmentVariable name="Path" value="C:\Users\Administrator\.nuget\packages\ibm.data.db2.core\3.1.0.200\buildTransitive\clidriver\bin" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>
Set folder permissions (Read & Execute, Read, and List Folder Contents) for Application Pool Identity Accounts (IIS AppPool\[App_Pool_Name])
Please click the links below for more information.
Frequently asked questions about IBM Db2 .NET Core Provider
Q: I am getting the following error:
An unexpected exception has occurred in Process: 244 Function: AESEncryptADONET (Encryption Info)
The .NET driver is unable to find the compatible GSKit. Set the Path(on Windows) or LD_LIBRARY_PATH(on Linux) to the <Package_Install_location>/<package-name>/<version>/build/clidriver/lib directory of your environment. Remember, this may affect other applications.
Db2 .NET Packages downloading and initial configuration
Install the VC++ runtimes (x86 and x64)
You should go with at least the 2013 version as well as the latest. Should solve your problem. It did for me.
I had a fresh 2019 Windows Server, installed dotnet 6 runtime , and I couldn't run my .NET6 applications (Web and console) trying to connect to my DB2 DB using "Net.IBM.Data.Db2": "6.0.0.200", as it threw the same error as you.
I installed the runtimes and it solved the issue.
Cheers
Putting these lines into my Azure Function App csproj did the trick:
<!--For publishing-->
<Target Name="CopyFilesAfterBuild" AfterTargets="Publish">
<Exec Command="(robocopy $(PublishDir)clidriver\ $(PublishDir)bin\clidriver /E)
^& IF %25ERRORLEVEL%25 LSS 8 SET ERRORLEVEL = 0" />
</Target>
<!--For debugging-->
<Target Name="CopyFilesAfterBuildToPublish" AfterTargets="AfterBuild">
<Exec Command="(robocopy $(TargetDir)clidriver\ $(TargetDir)bin\clidriver /E)
^& IF %25ERRORLEVEL%25 LSS 8 SET ERRORLEVEL = 0" />
</Target>

Spring Boot exception: Could not open ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]

I have developed this proof of concept https://github.com/DISID/disid-proofs/tree/master/spring-boot-weblogic to test the deployment of Spring Boot applications in Weblogic 12c (12.2.1).
The application deploys and starts successfully, but when I try to connect to it (i.e. /accounts?number=1234) the error below is shown:
Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it
from fulfilling the request.
And the log file has the exception:
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run
Did I miss something?
Thanks,
I found a workaround putting a dummy dispatcherServlet-servlet.xml file under WEB-INF:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- Do not remove this file! -->
</beans>
I've reproduced this issue with WebLogic 12.2.1.0 (plain new install) using spring-boot-sample-war (with an additional weblogic.xml to handle logging). Also tried the latest patchset (WLS PATCH SET UPDATE 12.2.1.0.160419), but the issue remains.
For some reason WebLogic decides it needs to create the DispatcherServlet using it's own configuration as soon as you access the application available on /.
I've put in a service request to Oracle Support and we'll see what they think about this issue.
Update: 'Patch 23124727: CANNOT DEPLOY SPRING BOOT .WAR ON 12.2.1 DUE TO JAVA.IO.FILENOTFOUNDEXCEPTION' is available for Oracle WebLogic Server 12.2.1.0.0 and works with both the spring-boot-sample-war as well as a more advanced application.

Wix setup failing with error 1603

I have written a .NET 4 desktop application and when trying to run the Setup.exe I am getting the following error in the log file.
I am using Visual Studio 2012 with Wix 3.7.
MSI (s) (E8:1C) [16:51:54:890]: Invoking remote custom action. DLL: C:\windows\Installer\MSIFECD.tmp, Entrypoint: EncryptConfig
SFXCA: Extracting custom action to temporary directory: C:\windows\Installer\MSIFECD.tmp-\
SFXCA: Binding to CLR version v4.0.30319
Calling custom action SecureConfig!SecureConfig.CustomActions.EncryptConfig
EncryptConfig: Begin
An error occurred creating the configuration section handler for security: Could not load file or assembly 'Order.Configuration.Net' or one of its dependencies. The system cannot find the file specified. (C:\Program Files (x86)\Orbit Order System\Orbit Order System.exe.config line 6)
CustomAction EncryptConfigurationFile returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 16:51:55: InstallFinalize. Return value 3.
I can confirm that `Order.Configuration.Net.dll' exists in the target folder as does the application config file.
This is the app.config file:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="backup"
type="OrderConfiguration.BackupConfig, Order.Configuration.Net"/>
<section name="general"
type="OrderConfiguration.GeneralConfig, Order.Configuration.Net"/>
<section name="security"
type="OrderConfiguration.SecurityConfig, Order.Configuration.Net"/>
<-- ** THIS IS LINE 6 **
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<backup configSource="config\backup.config"/>
<general configSource="config\general.config"/>
<security configSource="config\security.config"/>
<connectionStrings>
<clear/>
<add name="OrderDb"
connectionString="Data Source=(local);Initial Catalog=OrbitOrder;
User Id=User;Password=Pass;MultipleActiveResultSets=true;"/>
</connectionStrings>
</configuration>
I also confirm that config\security.config exists in the target folder.
I have spent three hours trying to figure out what the error means as all files actually exist in the target folder. I actually copied the WIX set up from a prior solution that I worked on a year ago and that one works fine without any issues.
The custom action that is failing is trying to encrypt the security configuration section.
I am at a loss to explain why MSI is throwing a 1603 error when there doesn't appear to be anything amiss.
I managed to resolve this after adding the following code to the Wix custom action:
AppDomain.CurrentDomain.AssemblyResolve += ( sender, args ) =>
{
return Assembly.LoadFrom( string.Format( #"{0}Order.Configuration.Net.dll", installFolder ) );
};
This basically says to load the assembly when it encounters a reference that needs resolving.
As per the log, the error is returned by the custom action written by you, so please debug the custom action dll during installation. Easiest method of debugging custom action is to add a message box in the code (begin of custom action) and attach to process in visual studio when the message box is displayed. other way is to use MsiBreak environment variable as described in http://msdn.microsoft.com/en-us/library/aa368264%28v=vs.85%29.aspx

Invalid Oracle URL specified: OracleDataSource.makeURL in Arquillian ITest

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.

deploying javafx 1.3 application with swing.filechooser

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!!

Resources