Apache HTTD 2.4: AH01630: client denied by server configuration

Submitted by Jochus on Sat, 12/09/2015 - 20:13 | Posted in: Linux
Posted in


I recently upgraded one of my HTTPD severs from version 2.2 to 2.4. When I tried to start the Apache HTTPD daemon, I got the following exception:

AH01630: client denied by server configuration

The problem was related to a change in the configuration specs of the "allow & deny rules". More info was found here:

2.2 configuration:

Order deny,allow
Deny from all

2.4 configuration:

Require all denied

Enable Windows Photo Viewer to open image files in Windows 10

Submitted by Jochus on Sun, 16/08/2015 - 20:30 | Posted in: Windows
Posted in


I'm not really a fan of the app Photo Gallery. Until Windows 8.1, I was using Windows Photo Viewer. I recently upgraded to Windows 10 and I'm unable to open image files with the ancient Windows Photo Viewer.

The good news is - it is still in the operating system! Using a simple hack in the registry, I was able to open image files again with Windows Photo Viewer. Run the followig .reg file, it will create 2 new keys. Repeat the steps for other file formats (png, gif, ...)

Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\jpegfile\shell\open]
"MuiVerb"=hex(2):40,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,\
  69,00,6c,00,65,00,73,00,25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,\
  00,20,00,50,00,68,00,6f,00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,\
  72,00,5c,00,70,00,68,00,6f,00,74,00,6f,00,76,00,69,00,65,00,77,00,65,00,72,\
  00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,33,00,30,00,34,00,33,00,00,00
 
[HKEY_CLASSES_ROOT\jpegfile\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
  6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
  00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
  25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
  00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
  6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
  00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
  5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
  00,31,00,00,00

Creating an interceptor which logs every entry/method call on an EJB

Submitted by Jochus on Tue, 11/08/2015 - 22:39 | Posted in: Java
Posted in



I needed to log all the calls to all methods made to a certain EJB (because I wanted to know which methods were called from which place). The reason was locks I received on a stateless session bean. I could use a debugger, but because I'm talking about a lot of functions and a lot of calls, I created a LogInterceptor:

package be.jochenhebbrecht.ejb.interceptor;
 
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;
 
public class LogInterceptor{
 
	@AroundInvoke
	public Object intercept(InvocationContext context) throws Exception {
                // Log to console before executing method
		System.out.println("Entering method:" + context.getMethod().getName());
 
                // Execute method
		Object result = context.proceed();
 
                // Log to console after executing method
		System.out.println("Leaving method: " + context.getMethod().getName() );
 
		return result;
	}
}

To use the interceptor, simply add the following code

package be.jochenhebbrecht.ejb;
 
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
 
import be.jochenhebbrecht.ejb.interceptor.LogInterceptor;
 
@Stateless
@Interceptors(LogInterceptor.class)
public class SomeStatelessEJB{
 
	public String foo(String bar) {
            // Do something ...
	}
 
}

Running Jaspersoft iReport Designer on Mac OS X with Java 7.0 (update 71-b14)

Submitted by Jochus on Mon, 10/08/2015 - 22:45 | Posted in: Mac
Posted in

  • Go to your applications folder /Applications
  • Right click on Jaspersoft iReport Designer Professional.app and select Show package Contents
  • Navigate to /Contents/Resources/ireport/etc/ and open ireport.conf
  • Edit the default JDK location by changing the jdkhome property

Running JBoss AS 6.1.0.Final on Java 7.0 (update 71-b14)

Submitted by Jochus on Mon, 10/08/2015 - 22:37 | Posted in: Java
Posted in

After changing my JAVA_HOME variable to the JDK 7, I got this exception while starting JBoss AS 6.1.0.Final

21:58:17,438 WARN  [AbstractKernelController] Broken callback: ClassSingleCallbackItem@114fb0a{name=interface org.jboss.wsf.spi.metadata.DescriptorProcessor whenRequired=ControllerState@90ccda{Installed} dependentState=ControllerState@90ccda{Installed} attributeName=setProcessor
owner=AbstractKernelControllerContext@6bedc9{ metadata=AbstractBeanMetaData@6bf2bf{name=WSDescriptorDeployer bean=org.jboss.webservices.integration.deployers.WSDescriptorDeployer properties= classLoader=BeanMetaDataDeployer$DeploymentClassLoaderMetaData@bbb128{classloader=null} constructor=null autowireCandidate=true installCallbacks=[method=setProcessor, method=setParser]}name=WSDescriptorDeployer target=org.jboss.webservices.integration.deployers.WSDescriptorDeployer@1f7a8d0 state=Installed depends=AbstractDependencyInfo@10dfdb7{}} signature=org.jboss.wsf.spi.metadata.DescriptorProcessor}: java.lang.ClassCastException: org.jboss.wsf.stack.cxf.deployment.jms.JMSDescriptorProcessorImpl cannot be cast to org.jboss.wsf.spi.metadata.webservices.WebservicesDescriptorProcessor
at org.jboss.webservices.integration.deployers.WSDescriptorDeployer.setProcessor(WSDescriptorDeployer.java:33) [:6.1.0.Final]

JBoss AS 6.x is EOL for a very long time, but I just wanted to give it a try. I still don't understand the exact reason on how I fixed it, but the problem is the processor which is trying to be set WSDescriptorDeployer. You need to disable this setProcessor callback by editing the file $JBOSS_HOME/server/default/deployers/jbossws.deployer/META-INF/stack-agnostic-jboss-beans.xml

<!-- deployers -->
<bean name="WSDescriptorDeployer" class="org.jboss.webservices.integration.deployers.WSDescriptorDeployer">
    <!-- incallback method="setProcessor"/ -->
    <property name="processor"><inject bean="WSDescriptorProcessor"/></property>
    <incallback method="setParser"/>
</bean>

Repairing the TCP/IP stack when no network connection after installing AVG

Submitted by Jochus on Mon, 10/08/2015 - 22:19 | Posted in: Windows
Posted in

  • Start > All Programs > Accessories and right click on Command Prompt, select Run as Administrator to open a command prompt. In the command prompt window that opens, type type the following commands, each followed by the Enter key:
    • Reset WINSOCK entries to installation defaults:
      $ netsh winsock reset catalog
    • Reset IPv4 TCP/IP stack to installation defaults:
      $ netsh int ipv4 reset reset.log
    • Reset IPv6 TCP/IP stack to installation defaults.
      $ netsh int ipv6 reset reset.log
    • Reboot the machine

Searching for a string in an all tables, rows and columns of a database

Submitted by Jochus on Tue, 14/04/2015 - 20:37 | Posted in: Database
Posted in

Script has been developed and tested for SQL Server (version 2012)

DECLARE
    @search_string  VARCHAR(100),
    @TABLE_NAME     SYSNAME,
    @table_id       INT,
    @column_name    SYSNAME,
    @sql_string     VARCHAR(2000)
 
SET @search_string = 'FOOBAR'
 
DECLARE tables_cur CURSOR FOR SELECT name, object_id FROM sys.objects WHERE TYPE = 'U'
OPEN tables_cur
FETCH NEXT FROM tables_cur INTO @TABLE_NAME, @table_id
 
WHILE (@@FETCH_STATUS = 0)
BEGIN
    DECLARE columns_cur CURSOR FOR SELECT name FROM sys.columns WHERE object_id = @table_id AND system_type_id IN (167, 175, 231, 239)
    OPEN columns_cur
 
    FETCH NEXT FROM columns_cur INTO @column_name
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
        SET @sql_string = 'IF EXISTS (SELECT * FROM ' + @TABLE_NAME + ' WHERE [' + @column_name + '] LIKE ''%' + @search_string + '%'') PRINT ''' + @TABLE_NAME + ', ' + @column_name + ''''
 
        EXECUTE(@sql_string)
 
        FETCH NEXT FROM columns_cur INTO @column_name
    END
 
    CLOSE columns_cur
    DEALLOCATE columns_cur
 
    FETCH NEXT FROM tables_cur INTO @TABLE_NAME, @table_id
END
 
CLOSE tables_cur
DEALLOCATE tables_cur

Dropping a constraint when the name can vary from database to database

Submitted by Jochus on Tue, 14/04/2015 - 20:14 | Posted in: Database
Posted in


DECLARE @TABLE_NAME VARCHAR(255)
DECLARE @col_name VARCHAR(255)
DECLARE @command  VARCHAR(1000)
 
SET @TABLE_NAME = '$YOUR_TABLE_NAME'
SET @column_name = '$YOUR_COLUMN_NAME'
 
SELECT @command = 'ALTER TABLE ' + @TABLE_NAME + ' DROP CONSTRAINT ' + d.name FROM sys.tables t JOIN sys.default_constraints d ON d.parent_object_id = t.object_id JOIN sys.columns c ON c.object_id = t.object_id AND c.column_id = d.parent_column_id WHERE t.name = @TABLE_NAME AND c.name = @column_name
 
EXECUTE (@command)

OS X 10.10 Yosemite and environment variables

Submitted by Jochus on Tue, 14/04/2015 - 18:59 | Posted in: Mac
Posted in


In previous releases of OS X (Mavericks, Mountain Lion, Lion, ...), environment variables are configured in the /etc/launchd.conf file.

As of OS X Yosemite, this is no longer working. To configure environment variables, you can do the following

$ nano ~/Library/LaunchAgents/my.startup.plist

my.startup.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<a href="http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist">http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist</a> version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>launchctl setenv $VARIABLE_NAME $VARIABLE_VALUE</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>