Unsupported protocol: jndi with Websphere 6.1 when trying to access a file as a resource

I have the problem, that getting a ressource from my archive failed with a MalformedURLException: unknown protocol: jndi

The archive is a war file and is deployed into Websphere successfully.

When I try to access some files inside the archive via

jndi://server/context/filename

I get the MalformedURLException.


Asked by: Kimberly282 | Posted: 23-01-2022






Answer 1

URLs with the "jndi" scheme are returned by the ServletContext#getResource method in Tomcat. However, this is non standard (i.e. the J2EE specs don't impose a URL scheme to be used in the return value of that method) and on other application servers it will be different. Always use the ServletContext#getResource method instead of trying to compose the URL directly.

Answered by: Maya889 | Posted: 24-02-2022



Answer 2

Unless you registered a custom URL handler, "jndi" is not a supported protocol.

Are you trying to read the file through Java code?

Answered by: Paul987 | Posted: 24-02-2022



Similar questions

java - Unsupported protocol: t3 exception while trying to get number of threads in weblogic

I am using JMX to get number of threads in Weblogic but an error happens. This is my code: import java.util.Hashtable; import javax.management.MBeanServer; import javax.management.MBeanServerConnection; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.manage...


java - Error running Maven project: Unsupported protocol: t3

I have a Maven project for monitoring of weblogic servers through JMX. In the maven POM.xml, I specify the dependency for wlfullclient.jar through scope tag due to previous errors. <dependency> <groupId>weblogic</groupId> <artifactId>wlfullclient</artifactId> <scope>system</scope> <systemPath>${base...


java - Unsupported major.minor version 49.0

I am getting the following exception whenever I login to my application ... javax.servlet.ServletException: com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl (Unsupported major.minor version 49.0) What does this mean and how can I resolve the problem?


Java unsupported version -- Classic Problem

If you have ever used java I think at least one times you ever got error about unsupported version. Everybody known how to fixed it, change JRE and etc. Today, I would like to know how to make jar file which can run any where (any JRE).


java - post xml to Spring REST server returns Unsupported Media Type

I'm trying to create a simple spring based webservice that supports a "post" with xml content. In spring, I define an AnnotationMethodHandler: <bean id="inboundMessageAdapter" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> <property name="messageConverters"> <util:list> <bean class="org.springframework.h...


java - "Unsupported Image Type" exception in only few images

In my java-swing project. I have one frame in which user can drop the images and save that images in database. Now this work perfectly but their are some images which is not showing. This are images Image 1 , Imag...


java - WevDav example project in Apache Wink throws unsupported encoding exception

I am trying to compile and run WebDav example project supplied as part of examples of Apache Wink project. I have successfully deployed the project into JBoss and can reach it throw http. However, when i try to use Total Commander with WebDav plug in, i get the following exception: 15:13:41,595 ERROR [[restSdkService]] Servlet.service() for servlet restSdkService threw exception java.io.UnsupportedEncodingExcept...


Is there an unsupported operation annotation in Java?

Are there any annotations in java which mark a method as unsupported? E.g. Let's say I'm writing a new class which implements the java.util.List interface. The add() methods in this interface are optional and I don't need them in my implementation and so I to do the following: public void add(Object obj) { throw new UnsupportedOperationException("This impl doesn't support add"); }


java - Is Restlet returning 415 Unsupported Media Type when it should return 400 Bad Request?

I'm using Restlet 2.1 with jackson to build a json REST api. When I make a request with the expected content type but a malformed body, I get back a 415 "Unsuppored Media Type" status code. I think the correct error code should be 400 "Bad Request". Apparently the mixup happens when Jackson tries and fails to decode the garbage. I'll try to make the case more clear with some code: //...


eclipse - Java Unsupported major.minor version 49.0 - where is it coming from?

I have downloaded the zxing Google QR code from SVN and used eclipse to edit one of the class files. I've compiled the changes using ANT and it runs fine locally. When I run it on alive server I get an error: 500 com/google/zxing/client/j2se/MatrixToImageWriter (Unsupported major.minor version 49.0) com/google/zxing/client/j2se/MatrixToImageWriter (Unsupported major.minor version 49.0) ...


java - Format date in JSP for unsupported Locale

This question already has answers here:


restlet - Java client throwing Unsupported Media Type Exception

I am developing an application that uses restful api. A java client sending a request to a standalone server is throwing Unsupported Media Type exception. The client code is as follows StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\" encoding=\"${encoding}\"?>").append("\n"); xml.append("<root>").append("\n"); xml.append("...






Still can't find your answer? Check out these amazing Java communities for help...



Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)



top