28. September 2011

Oracle 11G XE Installation error: Database Configuration failed

While running the oracle configuration after installation:

/etc/init.d/oracle-xe configure

 the following error specified:

Database Configuration failed. Look into /u01/app/oracle/product/11.2.0/xe/config/log for details

After looking inside the log file /u01/app/oracle/product/11.2.0/xe/config/log/CloneRmanRestore.log you can see an error which looks like:

 ORA-00119: invalid specification for system parameter LOCAL_LISTENER ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=oralinux)(PORT=1521))'

The hostname "oralinux" cannot be found because it is not registered inside the dns-server. You can simply add an /etc/hosts file:

127.0.0.1 oralinux

After saving the file, rerun "/etc/init.d/oracle-xe configure" and everything should be fine.

10. September 2011

Oracle - Error - ORA-00257: archiver error. Connect internal only, until freed.

The problem was that the harddisk space ist full and oracle has no space to create new archivelogs. I am removing the obsolete archive logs to regain the space.

First of all I remove all the archive-logs from harddisk:

cd /u01/app/oracle/ORCL/archivelog/
rm -rf 2011_09_08 2011_09_09


Now the system utilities would tell you that all was great but the connect to oracle still tells you the same error. We have to remove the files from the oracle internal storage management. We need to connect via rman to our database:

rman
RMAN> connect target user/password

And now we instruct rman to check internal storage against the filesystem:

RMAN> crosscheck archivelog all;

He will flag all the archivelogs as "expired". Now we remove all the obsolete files from storage:

delete expired archivelog all;

Now the connect to oracle works fine.

30. August 2011

Streaming Sound via Airtunes (AirportExpress)

While using Airtunes via iTunes I messed around with the problem to stream the system sound to the AirportExpress (e.g. Youtube Music).
After looking through some forums I stumbled over a little tool called "Airfoil".

After installing it I can choose the AirportExpress as the output speaker for my system sound:

Now all system sounds are streamed to the AirportExpress and it's possible to play sound of youtube videos directly to the AirportExpress. The sound is a little bit delayed (so using it as movie sound stream is senthless).

28. Juni 2011

Java: JAXB: Extend generated Classes

We use the same maven2 configuration as mentioned in this post.

Now we add the following line to the JAXB-plugin configuration:

<bindingDirectory>${basedir}/xml/binding</bindingDirectory>

Our complete pom.xml now looks like here:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.my.package</groupId>
  <artifactId>my-jaxb-artifact</artifactId>
  <version>0.1</version>
  <dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-testing</artifactId>
<version>0.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
   <groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.5.2</version>
<type>jar</type>
   <scope>compile</scope>
</dependency>
  </dependencies>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<url>http://download.java.net/maven/2</url>
</repository>
  </repositories>
<pluginRepositories>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
<pluginRepository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<build>
     <plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>

<configuration>
<extension>true</extension>
<args>
<arg>-XtoString</arg>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
<arg>-Xcopyable</arg>
<arg>-Xmergeable</arg>
<arg>-Xinheritance</arg>
</args>

<bindingDirectory>${basedir}/xml/binding</bindingDirectory>
<schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
<packagename>com.my.package</packagename>
<generateDirectory>${basedir}/target/generated-sources/xjc</generateDirectory>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.5.2</version>
</plugin>
</plugins>
</configuration>
</plugin>
<plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
         <outputDirectory>${basedir}/build/libs</outputDirectory>
        </configuration>
      </plugin>
     </plugins>
</build>
<reporting>
  
  </reporting>
</project>


After that we create a file called "extend.binding.xml" in the folder "xml/binding/".
The file contains the following information:


<jxb:bindings
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:pd="http://chubb.com/cpi/polsvc/xmlobj"
    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
    jxb:extensionBindingPrefixes="inheritance"
    version="2.1">
     <jxb:bindings schemaLocation="../../src/main/resources/xsd/schema.xsd">
        <jxb:bindings node="//xs:element[@name='main.object']/xs:complexType">
            <inheritance:extends>com.my.package.BaseClass</inheritance:extends>
        </jxb:bindings>
    </jxb:bindings>
</jxb:bindings>


The previous XML tells the xjc compiler that he should extend the class created for the xsd-object main.object from the class called com.my.package.BaseClass.

When running mvn generate-sources the BaseClass is subclassed by the generated class for main.object.

Java: JAXB Classes with maven2

With existing XSD-Files JAXB gives a very nice opportunity to autogenerate the fitting Java classes to use the xml-Data based on the mentioned XSD-files.

Based on the xsd objects JAXB (xjc) generates the Java Beans.

The following pom.xml enables JAXB Java source file generation via maven's "generate-sources" goal. The files are created at the directory specified by the "generateDirectory"-tag.


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.my.package</groupId>
  <artifactId>my-jaxb-artifact</artifactId>
  <version>0.1</version>
  <dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-testing</artifactId>
<version>0.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
   <groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.5.2</version>
<type>jar</type>
   <scope>compile</scope>
</dependency>
  </dependencies>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<url>http://download.java.net/maven/2</url>
</repository>
  </repositories>
<pluginRepositories>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
<pluginRepository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<build>
     <plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>

<configuration>
<extension>true</extension>
<args>
<arg>-XtoString</arg>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
<arg>-Xcopyable</arg>
<arg>-Xmergeable</arg>
<arg>-Xinheritance</arg>
</args>

<schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
<packagename>com.my.package</packagename>
<generateDirectory>${basedir}/target/generated-sources/xjc</generateDirectory>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.5.2</version>
</plugin>
</plugins>
</configuration>
</plugin>
<plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
         <outputDirectory>${basedir}/build/libs</outputDirectory>
        </configuration>
      </plugin>
     </plugins>
</build>
</project>

12. April 2011

DBVisualizer: ERROR: column c.reltriggers does not exist

DBVisualizer is one of my favourite database development tools because it's plattform and database independent and is really intuitive.

Since I updated my PostgreSQL Database Instance to V9 I get an error in DBVisualizer due to missing relations in the database.

It is possible to edit the statements DBVisualizer executes for displaying tables and data. Go to the Application folder and Right-Click on the DBVisualizer.app and Choose "Show package contents":

Then step down to the following directory


Now open the postgresql8.xml file and search and replace:


Search: (c.reltriggers > 0)
Replace: (/*c.reltriggers*/ 0 > 0)


Save and close the file. After a restart of the DBVisualizer everything should work fine.

18. Februar 2011

ASP.NET: Consuming a PHP WSDL SOAP Webservice

After starting Visual Studio we create a new Visual Basic ASP.NET Web Application project:


After it opens up we right-click on the project name in the "Solution Explorer" and choose "Add Web Reference..."


Now we can enter the URL of the WSDL file 'http://customer-ws.tld/customer-ws_Customers.wsdl' and press 'Enter'. Visual Studio fetches all the information provided by the xml file and shows up all the data:


We enter a "Web reference name" (I choose 'WSDLWebService') and click on "Add Reference". Now we can see the entered Web Reference in the "Solution Explorer":


Now we right-click the Web Reference called "WSDLWebService" and choose "View in Object Window":


We can see here that Visual Studio has created all the objects and methods that the WSDL file announced.

So we go to the "Code Editor" of our Default.aspx by right-clicking the file in the "Solution Explorer" and enter the following lines:



Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim CallWebservice As New WSDLWebService.customer-ws_Customers

        Dim Cache As System.Net.CredentialCache = New System.Net.CredentialCache

        Dim vUserId As String
        vUserId = "1889941"

        Dim vCustomer() As WSDLWebService.Customer
        vCustomer = CallWebservice.getCustomers()

        Label1.Text = vCustomer.length

    End Sub

End Class


I have added a Label with the ID "Label1" with the "Designer" and the Toolbar to the Default-Page:



Now we can press debug and the Internet Explorer should pop up and display in the Label1 field the amount of Customers returned by the WebService.

More information about SOAP Webservices:
PHP : SOAP: Creating and Consuming a WSDL Web-Service