users@glassfish.java.net

"java.net.UnknownServiceException: no content-type"

From: <glassfish_at_javadesktop.org>
Date: Wed, 10 Dec 2008 03:18:53 PST

Hi,

here's the situation description:

In an application I use a third party jar (from Pentaho Data Integration - pdi).

A piece of code in a class from that jar is:
[code]
try {
                    // try reading plugins defined in JAR file META-INF/kettle-partition-plugins.xml
                Enumeration<URL> resources = getClass().getClassLoader().getResources("META-INF/kettle-partition-plugins.xml");
                while( resources.hasMoreElements() )
                {
                        URL url = resources.nextElement();
                        Object content = url.getContent();
                        if( content instanceof InputStream )
                        {
                                readPluginFromResource( (InputStream) content, null, null, StepPlugin.TYPE_NATIVE );
                        }
                }
                    // also look in /kettle-partition-plugins.xml
                resources = getClass().getClassLoader().getResources("kettle-partition-plugins.xml");
                while( resources.hasMoreElements() )
                {
                        URL url = resources.nextElement();
                        Object content = url.getContent();
                        if( content instanceof InputStream )
                        {
                                readPluginFromResource( (InputStream) content, null, null, StepPlugin.TYPE_NATIVE );
                        }
                }
            } catch (Exception e) {
                    throw new KettleException("Unable to load plugins specified in 'META-INF/kettle-partition-plugins.xml' files", e);
            }
[/code]


this code works perfectly when launched from J2SE application (the file META-INF/kettle-partition-plugins.xml is of course present in the jar).

But I use it (well actually I call a method that uses it) from a J2EE app EJB and I get an exception.

The method containing this code is called from a @Timeout method in an EJB.
With the invocation an exception is thrown: UnknownServiceException saying that there is no content type specified for the file.

Any idea's why the change of behavior between J2SE and J2EE application?
The app server is Glassfish V2 and the EJB is compilant to EJB 3.0 specfication.

BTW:
ulr.toString() returns a perfectly valid path.

[code]
stack trace:
[#|2008-12-09T18:47:24.878+0100|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=18;_ThreadName=p:
thread-pool-1; w: 4;_RequestID=dac5e0d1-596f-40c4-b40b-09163f0d26f2;|
org.pentaho.di.core.exception.KettleException:
Unable to load plugins specified in
'META-INF/kettle-partition-plugins.xml' files
no content-type
 
       at org.pentaho.di.trans.StepLoader.readPlugins(StepLoader.java:361)
       at org.pentaho.di.trans.StepLoader.init(StepLoader.java:110)
       at org.pentaho.di.trans.StepLoader.init(StepLoader.java:119)
       at org.test.DailyProcessingScheduleBean.startDailySchedule(DailyProcessingScheduleBean.java:157)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
       at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
       at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
       at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:2824)
       at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1401)
       at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:99)
       at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:1952)
       at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.service(EJBTimerService.java:1948)
       at com.sun.ejb.containers.util.WorkAdapter.doWork(WorkAdapter.java:75)
       at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Caused by: java.net.UnknownServiceException: no content-type
       at java.net.URLConnection.getContentHandler(URLConnection.java:1192)
       at java.net.URLConnection.getContent(URLConnection.java:689)
       at java.net.URL.getContent(URL.java:1023)
       at org.pentaho.di.trans.StepLoader.readPlugins(StepLoader.java:343)
       ... 17 more
|#]

[/code]

Regards.
GW
[Message sent by forum member 'grzewal' (grzewal)]

http://forums.java.net/jive/thread.jspa?messageID=320964