From where org.apache.naming get added to java.naming.factory.url.pkgs in Tomcat 7.x

2016-01-11 Thread Thusitha Thilina Dayaratne
Hi,

I checked the tomcat7 source to find out how tomee set the
*org.apache.naming *to* java.naming.factory.url.pkgs *system property which
uses for JNDI stuffs. But I couldn't find the place.

Could someone point the location from where tomcat set that property?

Thanks
Thusitha
--


Re: From where org.apache.naming get added to java.naming.factory.url.pkgs in Tomcat 7.x

2016-01-11 Thread Thusitha Thilina Dayaratne
Sorry for the trouble.
I found that enableNaming() method sets this

Thanks
Thusitha
2016-01-11 14:34 GMT+05:30 Thusitha Thilina Dayaratne <
thusithathil...@gmail.com>:

> Hi,
>
> I checked the tomcat7 source to find out how tomee set the
> *org.apache.naming *to* java.naming.factory.url.pkgs *system property
> which uses for JNDI stuffs. But I couldn't find the place.
>
> Could someone point the location from where tomcat set that property?
>
> Thanks
> Thusitha
> --
>
>


--


Embedded Tomcat 7.0.59 Some vhost are not get Started Properly

2015-08-30 Thread Thusitha Thilina Dayaratne
Hi,

I'm having an intermittent issue relate to tomcat vhost. I'm using embedded
tomcat version 7.0.59 and I have my own deployers as well. In some of my
virtualhosts apps are get deployed after the server get startup. This
happens only in some vhosts (not all vhosts)

The actual issue is that I'm adding webapp related info while the
deployment. But since vhost is in the NEW state in problematic situations,
app context is null. Therefore I can't get the required info through the
context.
When the issue occur, in the debug mode I can observe that problematic
vhost listed after the localhost. But in other cases vhosts are listed
prior to the localhost.

Can someone put some light to this issue or can someone point me the
location where tomcat read the conf/server.xml and get the list of vhost
defined in it?

Thanks
Best Regards
/Thusitha
--


How to set Session Values with Form Based Authentication

2015-08-25 Thread Thusitha Thilina Dayaratne
Hi,

I'm using form based authentication with j_security_check. I want to set
some session values upon the user login. I can set them in the index page.
But when user directly put some other url then it will redirect to login
page and then back to the actual requested page. Therefore my logic on
index page will not get execute.
Is there a way for me to set the session value when using j-security_check
based form authentication in Tomcat?

Thanks
/Thusitha

--


Can is use as context root in Tomcat 7.0.59

2015-07-20 Thread Thusitha Thilina Dayaratne
Hi All,

Is it possible to set am empty string () as the root context in Tomcat
7.0.59?
I'm currently using / as the root context path. But since tomcat doesn't
like that I want to change the path to something similar.

Thanks
/Thusitha
--


Re: Can is use as context root in Tomcat 7.0.59

2015-07-20 Thread Thusitha Thilina Dayaratne
H Felix,

The context name would be ROOT.
 See naming in https://tomcat.apache.org/tomcat-7.0-doc/config/context.html
 .

Thanks for the quick response :)

Regards

2015-07-20 14:42 GMT+05:30 Felix Schumacher 
felix.schumac...@internetallee.de:



 Am 20. Juli 2015 09:26:04 MESZ, schrieb Thusitha Thilina Dayaratne 
 thusithathil...@gmail.com:
 Hi All,
 
 Is it possible to set am empty string () as the root context in
 Tomcat
 7.0.59?
 I'm currently using / as the root context path. But since tomcat
 doesn't
 like that I want to change the path to something similar.

 The context name would be ROOT.

 See naming in https://tomcat.apache.org/tomcat-7.0-doc/config/context.html
 .

 Regards,
 Felix
 
 Thanks
 /Thusitha
 --


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




--


What is the utility use to generate source html file for jsp pages in example webapp

2015-07-13 Thread Thusitha Thilina Dayaratne
Hi All,

I'm having some jsp pages that I would like to show there source as an html
page like in the example webapp that is provided with tomcat. I have tried
few online java2html converters but couldn't obtain source as in tomcat
example.

e.g cal1.jsp -- source is cal1.jsp.html

Could someone tell me what they have used?
Thanks
Thusitha
--


Re: What is the utility use to generate source html file for jsp pages in example webapp

2015-07-13 Thread Thusitha Thilina Dayaratne
Hi David,

Thanks for the quick response. But I think that will not work. Because lets
say we have some html stuffs in the jsp (e.g. form) then it will show a
form in the page instead of form tag as a source. And the source format
will get lost.
I found an online tool which seems quite fine :)
https://www.palfrader.org/code/code2html/

Thanks

2015-07-13 17:21 GMT+05:30 David kerber dcker...@verizon.net:

 On 7/13/2015 6:03 AM, Thusitha Thilina Dayaratne wrote:

 Hi All,

 I'm having some jsp pages that I would like to show there source as an
 html
 page like in the example webapp that is provided with tomcat. I have tried
 few online java2html converters but couldn't obtain source as in tomcat
 example.

 e.g cal1.jsp -- source is cal1.jsp.html

 Could someone tell me what they have used?


 What happens when you just change the extension of the
 automatically-created .java file in your server?

 I.E. access the page normally through your browser to your TC server, then
 look for cal1_jsp.java in the /work directory and change its extension to
 .html?



 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




--


Accessing static resources return 404 in embedded tomcat

2015-05-16 Thread Thusitha Thilina Dayaratne
Hi,

I'm using embedded Tomcat 7.0.59. I;m trying to access a static resource
through the embedded server. In the server.xml file I've added following
line

Host name=localhost unpackWARs=true deployOnStartup=false
autoDeploy=false
appBase=${carbon.home}/repository/deployment/server/webapps/
*  Context  docBase=/home/thusitha/abc path=/test/res / *

I have an empty xml file in the /home/thusitha/abc folder.

On the browser when I try to access it as follows I'm getting 404 error.
localhost:9443/test/res/abc.xml

What could be the reason for this?

Thanks
Best Regards
--


tomcat-embed-jasper vs tomcat-jasper

2015-05-05 Thread Thusitha Thilina Dayaratne
Hi,

Could someone tell me what is the difference between tomcat-embed-jasper
and tomcat-jasper?
I have checked the both jars. tomcat-embed-jasper contains
javax.servlet.jsp package. Is that the only difference between those 2?

Thanks

--


Re: tomcat-embed-jasper vs tomcat-jasper

2015-05-05 Thread Thusitha Thilina Dayaratne
Hi


 Could someone tell me what is the difference between tomcat-embed-jasper
 and tomcat-jasper?
 I have checked the both jars. tomcat-embed-jasper contains
 javax.servlet.jsp package. Is that the only difference between those 2?
Yes.
Thanks for quick reply.
1. If so why there are 2 jars? Is there a specific reason to have 2 jars?
2. I found that in tomcat-jsp-api is having the same javax.servlet.jsp
package.
So is it possible to use only the tomcat-embed-jasper since it contains all
the packages in tomcat-jasper and tomcat-jsp-api?

Thanks

2015-05-05 21:18 GMT+05:30 Mark Thomas ma...@apache.org:

 On 05/05/2015 16:40, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  Could someone tell me what is the difference between tomcat-embed-jasper
  and tomcat-jasper?
  I have checked the both jars. tomcat-embed-jasper contains
  javax.servlet.jsp package. Is that the only difference between those 2?

 Yes.

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




--


Re: tomcat-embed-jasper vs tomcat-jasper

2015-05-05 Thread Thusitha Thilina Dayaratne
Hi,

 Hi


 Could someone tell me what is the difference between tomcat-embed-jasper
 and tomcat-jasper?
 I have checked the both jars. tomcat-embed-jasper contains
 javax.servlet.jsp package. Is that the only difference between those 2?
 Yes.
 Thanks for quick reply.
 1. If so why there are 2 jars? Is there a specific reason to have 2 jars?

Yes, there is a reason. The embedded packaging is designed to use the
minimum number of JARs. JSP support is optional so all the classes are
in a single JAR.
Thanks for the explanation.
So if I need jsp support, rather than using 2 jars(tomct-jasper and
tomcat-jsp-api) I can directly use only the tomcat-embed-jasper
Please correct me if I'm wrong.

Thanks

2015-05-05 21:31 GMT+05:30 Mark Thomas ma...@apache.org:

 On 05/05/2015 16:55, Thusitha Thilina Dayaratne wrote:
  Hi
 
 
  Could someone tell me what is the difference between tomcat-embed-jasper
  and tomcat-jasper?
  I have checked the both jars. tomcat-embed-jasper contains
  javax.servlet.jsp package. Is that the only difference between those 2?
  Yes.
  Thanks for quick reply.
  1. If so why there are 2 jars? Is there a specific reason to have 2 jars?

 Yes, there is a reason. The embedded packaging is designed to use the
 minimum number of JARs. JSP support is optional so all the classes are
 in a single JAR.

  2. I found that in tomcat-jsp-api is having the same javax.servlet.jsp
  package.
  So is it possible to use only the tomcat-embed-jasper since it contains
 all
  the packages in tomcat-jasper and tomcat-jsp-api?

 Yes.

 Mark



 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




--


Re: Locating WebAppConfig file in embedded tomcat

2015-04-28 Thread Thusitha Thilina Dayaratne
Hi

we use an embedded Tomcat and are trying to update from version 7.0.40 to
 7.0.61. The the embedded tomcat instance starts up fine and our webapp is
 also running. However we get the following warning:
 Apr 28, 2015 8:58:58 AM org.apache.catalina.startup.Tomcat
 getWebappConfigFileFromJar
 WARNING: Unable to determine web application context.xml webapp-name
 java.io.FileNotFoundException: webapp-name (System cannot find file)
 at java.util.zip.ZipFile.open(Native Method)
 at java.util.zip.ZipFile.init(ZipFile.java:215)
 at java.util.zip.ZipFile.init(ZipFile.java:145)
 at java.util.jar.JarFile.init(JarFile.java:153)
 at java.util.jar.JarFile.init(JarFile.java:117)
 at org.apache.catalina.startup.Tomcat.getWebappConfigFileFromJa
 r(Tomcat.java:1162)
 at org.apache.catalina.startup.Tomcat.getWebappConfigFile(Tomca
 t.java:1140)
 at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:543)
 at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:524)
 at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:206)
 (Notice, that webapp-name is not the actual name and System cannot find
 file is a translation of the original German message)

 Our start-up process looks like this:
 this.tomcat = new Tomcat();
 this.tomcat.setBaseDir(.);
 this.tomcat.getHost().setAutoDeploy(false);
 this.tomcat.getHost().setDeployOnStartup(false);
 this.tomcat.setPort(port);
 final StandardContext webAppCtx = (StandardContext)
 this.tomcat.addWebapp(/weppapp-name, webapp-name);


Here parameters should be context and the base path

The directory structure looks like this, while working directory is
 Application-Home: /Application-Home/webapps/webapp-name
 We noticed that in Tomcat.getWebappConfigFileFromJar(Tomcat.java:1162),
 there is the following code:
  protected URL getWebappConfigFile(String path, String url) {
 File docBase = new File(path);
 if (docBase.isDirectory()) {
 return getWebappConfigFileFromDirectory(docBase, url);
 } else {
 return getWebappConfigFileFromJar(docBase, url);
 }
 }
 The parameter path is webapp-name and the parameter url is
 /webapp-name.  With the working dir being Application-Home, new
 File(path) will resolve to /Application-Home/webapp-name, which does
 not exist. Hence, Tomcat is proceeding to load the config file from a jar
 file, which leads to the warning mentioned above.
 My questions are:
 - What are the correct parameters for Tomcat.addWebapp(String contextPath,
 String docBase)?


first parameter is the context of your web app and the 2nd parameter is the
base directory/absolute path

- Is there a special working directory expected, while using an embedded
Tomcat?

2015-04-28 15:06 GMT+05:30 Benjamin Rogge tom...@benjamin-rogge.de:

 Hello,
 we use an embedded Tomcat and are trying to update from version 7.0.40 to
 7.0.61. The the embedded tomcat instance starts up fine and our webapp is
 also running. However we get the following warning:

 Apr 28, 2015 8:58:58 AM org.apache.catalina.startup.Tomcat
 getWebappConfigFileFromJar
 WARNING: Unable to determine web application context.xml webapp-name
 java.io.FileNotFoundException: webapp-name (System cannot find file)
 at java.util.zip.ZipFile.open(Native Method)
 at java.util.zip.ZipFile.init(ZipFile.java:215)
 at java.util.zip.ZipFile.init(ZipFile.java:145)
 at java.util.jar.JarFile.init(JarFile.java:153)
 at java.util.jar.JarFile.init(JarFile.java:117)
 at
 org.apache.catalina.startup.Tomcat.getWebappConfigFileFromJar(Tomcat.java:1162)
 at
 org.apache.catalina.startup.Tomcat.getWebappConfigFile(Tomcat.java:1140)
 at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:543)
 at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:524)
 at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:206)

 (Notice, that webapp-name is not the actual name and System cannot find
 file is a translation of the original German message)


 Our start-up process looks like this:

 this.tomcat = new Tomcat();
 this.tomcat.setBaseDir(.);
 this.tomcat.getHost().setAutoDeploy(false);
 this.tomcat.getHost().setDeployOnStartup(false);
 this.tomcat.setPort(port);
 final StandardContext webAppCtx = (StandardContext)
 this.tomcat.addWebapp(/weppapp-name, webapp-name);

 The directory structure looks like this, while working directory is
 Application-Home: /Application-Home/webapps/webapp-name

 We noticed that in Tomcat.getWebappConfigFileFromJar(Tomcat.java:1162),
 there is the following code:
  protected URL getWebappConfigFile(String path, String url) {
 File docBase = new File(path);
 if (docBase.isDirectory()) {
 return getWebappConfigFileFromDirectory(docBase, url);
 } else {
 return getWebappConfigFileFromJar(docBase, url);
 }
 }

 The parameter path is 

Re: Info: WebSocket connection closed, Code: 1006 when try to run websocket sample

2015-04-24 Thread Thusitha Thilina Dayaratne
Hi,

Hi,

 Hi,

 I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
 example and when I'm trying to run it in my server for all 4 examples
 (Echo, chat, etc..)
 I'm getting

 Info: WebSocket connection closed, Code: 1006


 In the console it prints

 WebSocket connection to 'ws://
 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
 during WebSocket handshake: Unexpected response code: 302


 This same war file is running perfectly on Tomcat distribution.

 Can someone tell me what could be the reason for this?

It looks like you haven't deployed the WebSocket examples correctly. My
guess is you are seeing the 302 redirect to
/examples/websocket/echoProgrammatic/ you'd get if this was being
handled as a static resource.
Thanks for quick response. But I think you misunderstood what I mean.
I'm not getting 10.100.7.26:9763/examples/websocket/echoProgrammatic'
failed: Error during WebSocket handshake: Unexpected response code: 302
I'm getting that for the echo sample programmatic API option.

For each and every websocket sample I'm getting Info: WebSocket
connection closed, Code: 1006
And in the console it says something like
WebSocket connection to ws://10.100.7.26:9763/examples/websocket/
http://10.100.7.26:9763/examples/websocket/echoProgrammatic... failed:
Error during WebSocket handshake: Unexpected response code: 302

When I tried to deploy the sample distributed with Tomcat it works fine
in my server.
Seems that I did something wrong while building the sample. Can someone
help me out?

Furthermore I've tried following things out and both options works without
issue.

   1. Running tomcat distributed examples in my server
   2. Running the war file that I built inside Tomcat

I've mistaken here. My war file doesn't run on Tomcat either.


When I used the following dependency to build the example webapp, instead
of 302 I'm getting 404 error.

dependency
groupIdjavax.websocket/groupId
artifactIdjavax.websocket-api/artifactId
version1.0/version
scopeprovided/scope
/dependency

Am I having wrong dependency here? If so what are the dependencies that I
should include when do the build?

Thanks
Best Regards


2015-04-24 11:13 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi,

  Hi,
 
  I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
  example and when I'm trying to run it in my server for all 4 examples
  (Echo, chat, etc..)
  I'm getting
 
  Info: WebSocket connection closed, Code: 1006
 
 
  In the console it prints
 
  WebSocket connection to 'ws://
  10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
  during WebSocket handshake: Unexpected response code: 302
 
 
  This same war file is running perfectly on Tomcat distribution.
 
  Can someone tell me what could be the reason for this?

 It looks like you haven't deployed the WebSocket examples correctly. My
 guess is you are seeing the 302 redirect to
 /examples/websocket/echoProgrammatic/ you'd get if this was being
 handled as a static resource.
 Thanks for quick response. But I think you misunderstood what I mean.
 I'm not getting 10.100.7.26:9763/examples/websocket/echoProgrammatic'
 failed: Error during WebSocket handshake: Unexpected response code: 302
 I'm getting that for the echo sample programmatic API option.

 For each and every websocket sample I'm getting Info: WebSocket
 connection closed, Code: 1006
 And in the console it says something like
 WebSocket connection to ws://10.100.7.26:9763/examples/websocket/
 http://10.100.7.26:9763/examples/websocket/echoProgrammatic... failed:
 Error during WebSocket handshake: Unexpected response code: 302

 When I tried to deploy the sample distributed with Tomcat it works fine
 in my server.
 Seems that I did something wrong while building the sample. Can someone
 help me out?

 Furthermore I've tried following things out and both options works without
 issue.

1. Running tomcat distributed examples in my server
2. Running the war file that I built inside Tomcat

 The only thing that doesn't work is when try to run the war file that I
 built in my server.

 2015-04-24 10:59 GMT+05:30 Thusitha Thilina Dayaratne 
 thusithathil...@gmail.com:

 Hi,

  Hi,
 
  I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
  example and when I'm trying to run it in my server for all 4 examples
  (Echo, chat, etc..)
  I'm getting
 
  Info: WebSocket connection closed, Code: 1006
 
 
  In the console it prints
 
  WebSocket connection to 'ws://
  10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
  during WebSocket handshake: Unexpected response code: 302
 
 
  This same war file is running perfectly on Tomcat distribution.
 
  Can someone tell me what could be the reason for this?

 It looks like you haven't deployed the WebSocket examples correctly. My
 guess is you are seeing the 302 redirect to
 /examples/websocket/echoProgrammatic/ you'd get

How does Tomcat identify web socket endpoint in a war?

2015-04-24 Thread Thusitha Thilina Dayaratne
Hi,

Could someone tell me how does Tomcat identify the websocket endpoints in
.war file?
Does it scan all the classes and looks for annotations?

Thanks
Best Regards

--


Re: Info: WebSocket connection closed, Code: 1006 when try to run websocket sample

2015-04-24 Thread Thusitha Thilina Dayaratne
Hi,

First I would like to apologize for the inconvenience.
On 4/24/15 7:40 AM, Thusitha Thilina Dayaratne wrote:
 Furthermore I've tried following things out and both options works
 without issue.

 1. Running tomcat distributed examples in my server 2. Running the
 war file that I built inside Tomcat

 I've mistaken here. My war file doesn't run on Tomcat either.


 When I used the following dependency to build the example webapp,
 instead of 302 I'm getting 404 error.

 dependency groupIdjavax.websocket/groupId
 artifactIdjavax.websocket-api/artifactId
 version1.0/version scopeprovided/scope /dependency

 Am I having wrong dependency here? If so what are the dependencies
 that I should include when do the build?

You aren't getting very many responses, here.

The problem is that you are asking for solutions to problems that
nobody understands. You are asking us why doesn't this work, but you
haven't told us what it is.

Imagine that I am writing a web application that needs to process
financial transactions (e.g. DEBIT, CREDIT), and it's not working for
some reason. If I asked you why does my web application return 404,
but didn't provide any code, or any explanation of the architecture,
or any of that, you would have no idea what could possibly be wrong
with my code. It could be simple a configuration problem. It could be
a complete misunderstanding of how a web application works. It could
be a very rarely-seen bug that only occurs when users with an account
number that happens to be a prime number plus one try to do a DEBIT
operation.

So, take a step back.

The Tomcat distributed examples work. That's great: it means that
Tomcat itself is capable of running Websocket applications.

Your application does not work: it seemed to be returning a 302 error
which may suggest that the Websocket library hasn't properly initialized
.

Are you using Tomcat in an embedded way, or are you launching it from
the traditional bin/startup.sh, etc. way? Are you trying to side-load
the Websocket library, or are you expecting that Tomcat will
auto-detect and initialize it? Does your own code include anything
other than servlets that request an upgrade to a Websocket connection
and then do their thing?


Remember that none of us has even a passing understanding of what you
are trying to build, how you are building it, what the Maven
dependencies are (or even mean, in some cases), etc. You need to tell
us all of that to give us some context.

Then we might be able to help you.

I will rephrase my question
I'm using embedded tomcat version 8.0.20. We have created an application
server on top of that and we are packing tomcat provided example webapp
with that.
I get the source of the example webapp in Tomcat (I don't change any code
in that and use that as it is provided) and use Maven in order to build the
sample webapp. In that for websocket I'm using following dependency

dependency
  groupIdjavax.websocket/groupId
  artifactIdjavax.websocket-api/artifactId
  version1.0/version
  scopeprovided/scope/dependency

I've bundle following tomcat websocket dependencies as OSGi bundle and
using that in the server.
dependency
groupIdorg.apache.tomcat.embed/groupId
artifactIdtomcat-embed-jasper/artifactId
version8.0.20/version
optionaltrue/optional
/dependency
dependency
groupIdorg.apache.tomcat/groupId
artifactIdtomcat-websocket-api/artifactId
version8.0.20/version
optionaltrue/optional
/dependency
This OSGi bundle is available with the server.

After building the example webapp, when I try to run the wesocket examples
in that webapp on my server, I'm getting

Info: WebSocket connection closed, Code: 1006


In the browser console it prints (for echo programmatic option in the echo
sample)

WebSocket connection to 'ws://
 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
 during WebSocket handshake: Unexpected response code: 302


I tried to deploy the same example which is distributed with Tomcat
distribution on my server.
It run on my server without any issue.

Thanks
Best Regards

2015-04-24 19:25 GMT+05:30 Christopher Schultz ch...@christopherschultz.net


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Thusitha,

 On 4/24/15 7:40 AM, Thusitha Thilina Dayaratne wrote:
  Furthermore I've tried following things out and both options works
  without issue.
 
  1. Running tomcat distributed examples in my server 2. Running the
  war file that I built inside Tomcat
 
  I've mistaken here. My war file doesn't run on Tomcat either.
 
 
  When I used the following dependency to build the example webapp,
  instead of 302 I'm getting 404 error.
 
  dependency groupIdjavax.websocket/groupId
  artifactIdjavax.websocket-api/artifactId
  version1.0/version scopeprovided/scope /dependency
 
  Am I having wrong dependency here? If so what are the dependencies
  that I should include when do the build?

 You aren't getting very many responses, here.

 The problem is that you are asking

Re: Info: WebSocket connection closed, Code: 1006 when try to run websocket sample

2015-04-23 Thread Thusitha Thilina Dayaratne
Hi

snip
I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
example and when I'm trying to run it in my server for all 4 examples
(Echo, chat, etc..)
I'm getting

 Info: WebSocket connection closed, Code: 1006


In the console it prints

WebSocket connection to 'ws://
 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
 during WebSocket handshake: Unexpected response code: 302


This same war file is running perfectly on Tomcat distribution.

Can someone tell me what could be the reason for this?
/snip
I'm able to connect to ws://echo.websocket.org But not to the ws://
localhost:9763/examples/websocket/echoProgrammatic
http://10.100.7.26:9763/examples/websocket/echoProgrammatic
(My server is running 9763)

2015-04-23 10:21 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi,

 I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
 example and when I'm trying to run it in my server for all 4 examples
 (Echo, chat, etc..)
 I'm getting

 Info: WebSocket connection closed, Code: 1006


 In the console it prints

 WebSocket connection to 'ws://
 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
 during WebSocket handshake: Unexpected response code: 302


 This same war file is running perfectly on Tomcat distribution.

 Can someone tell me what could be the reason for this?

 In the pom, my dependency is as follows
 dependency
 groupIdorg.apache.tomcat/groupId
 artifactIdtomcat-websocket/artifactId
 version8.0.20/version
 /dependency


 Thanks
 Best Regards
 --





--


Re: Info: WebSocket connection closed, Code: 1006 when try to run websocket sample

2015-04-23 Thread Thusitha Thilina Dayaratne
Hi

 Hi,

 I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
 example and when I'm trying to run it in my server for all 4 examples
 (Echo, chat, etc..)
 I'm getting

 Info: WebSocket connection closed, Code: 1006


 In the console it prints

 WebSocket connection to 'ws://
 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
 during WebSocket handshake: Unexpected response code: 302


 This same war file is running perfectly on Tomcat distribution.

 Can someone tell me what could be the reason for this?

It looks like you haven't deployed the WebSocket examples correctly. My
guess is you are seeing the 302 redirect to
/examples/websocket/echoProgrammatic/ you'd get if this was being
handled as a static resource.
Thanks for quick response. But I think you misunderstood what I mean.
I'm not getting 10.100.7.26:9763/examples/websocket/echoProgrammatic'
failed: Error during WebSocket handshake: Unexpected response code: 302
I'm getting that for the echo sample programmatic API option.

For each and every websocket sample I'm getting Info: WebSocket connection
closed, Code: 1006
And in the console it says something like
WebSocket connection to ws://10.100.7.26:9763/examples/websocket/
http://10.100.7.26:9763/examples/websocket/echoProgrammatic... failed:
Error during WebSocket handshake: Unexpected response code: 302

2015-04-23 12:58 GMT+05:30 Mark Thomas ma...@apache.org:

 On 23/04/2015 05:51, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
  example and when I'm trying to run it in my server for all 4 examples
  (Echo, chat, etc..)
  I'm getting
 
  Info: WebSocket connection closed, Code: 1006
 
 
  In the console it prints
 
  WebSocket connection to 'ws://
  10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
  during WebSocket handshake: Unexpected response code: 302
 
 
  This same war file is running perfectly on Tomcat distribution.
 
  Can someone tell me what could be the reason for this?

 It looks like you haven't deployed the WebSocket examples correctly. My
 guess is you are seeing the 302 redirect to
 /examples/websocket/echoProgrammatic/ you'd get if this was being
 handled as a static resource.

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




--


Re: Info: WebSocket connection closed, Code: 1006 when try to run websocket sample

2015-04-23 Thread Thusitha Thilina Dayaratne
Hi,

 Hi,

 I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
 example and when I'm trying to run it in my server for all 4 examples
 (Echo, chat, etc..)
 I'm getting

 Info: WebSocket connection closed, Code: 1006


 In the console it prints

 WebSocket connection to 'ws://
 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
 during WebSocket handshake: Unexpected response code: 302


 This same war file is running perfectly on Tomcat distribution.

 Can someone tell me what could be the reason for this?

It looks like you haven't deployed the WebSocket examples correctly. My
guess is you are seeing the 302 redirect to
/examples/websocket/echoProgrammatic/ you'd get if this was being
handled as a static resource.
Thanks for quick response. But I think you misunderstood what I mean.
I'm not getting 10.100.7.26:9763/examples/websocket/echoProgrammatic'
failed: Error during WebSocket handshake: Unexpected response code: 302
I'm getting that for the echo sample programmatic API option.

For each and every websocket sample I'm getting Info: WebSocket
connection closed, Code: 1006
And in the console it says something like
WebSocket connection to ws://10.100.7.26:9763/examples/websocket/
http://10.100.7.26:9763/examples/websocket/echoProgrammatic... failed:
Error during WebSocket handshake: Unexpected response code: 302

When I tried to deploy the sample distributed with Tomcat it works fine
in my server.
Seems that I did something wrong while building the sample. Can someone
help me out?

Furthermore I've tried following things out and both options works without
issue.

   1. Running tomcat distributed examples in my server
   2. Running the war file that I built inside Tomcat

The only thing that doesn't work is when try to run the war file that I
built in my server.

2015-04-24 10:59 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi,

  Hi,
 
  I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
  example and when I'm trying to run it in my server for all 4 examples
  (Echo, chat, etc..)
  I'm getting
 
  Info: WebSocket connection closed, Code: 1006
 
 
  In the console it prints
 
  WebSocket connection to 'ws://
  10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
  during WebSocket handshake: Unexpected response code: 302
 
 
  This same war file is running perfectly on Tomcat distribution.
 
  Can someone tell me what could be the reason for this?

 It looks like you haven't deployed the WebSocket examples correctly. My
 guess is you are seeing the 302 redirect to
 /examples/websocket/echoProgrammatic/ you'd get if this was being
 handled as a static resource.
 Thanks for quick response. But I think you misunderstood what I mean.
 I'm not getting 10.100.7.26:9763/examples/websocket/echoProgrammatic'
 failed: Error during WebSocket handshake: Unexpected response code: 302
 I'm getting that for the echo sample programmatic API option.

 For each and every websocket sample I'm getting Info: WebSocket
 connection closed, Code: 1006
 And in the console it says something like
 WebSocket connection to ws://10.100.7.26:9763/examples/websocket/
 http://10.100.7.26:9763/examples/websocket/echoProgrammatic... failed:
 Error during WebSocket handshake: Unexpected response code: 302

 When I tried to deploy the sample distributed with Tomcat it works fine in
 my server.
 Seems that I did something wrong while building the sample. Can someone
 help me out?

 Thanks
 Best Regards

 2015-04-23 14:06 GMT+05:30 Thusitha Thilina Dayaratne 
 thusithathil...@gmail.com:

 Hi

  Hi,
 
  I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
  example and when I'm trying to run it in my server for all 4 examples
  (Echo, chat, etc..)
  I'm getting
 
  Info: WebSocket connection closed, Code: 1006
 
 
  In the console it prints
 
  WebSocket connection to 'ws://
  10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
  during WebSocket handshake: Unexpected response code: 302
 
 
  This same war file is running perfectly on Tomcat distribution.
 
  Can someone tell me what could be the reason for this?

 It looks like you haven't deployed the WebSocket examples correctly. My
 guess is you are seeing the 302 redirect to
 /examples/websocket/echoProgrammatic/ you'd get if this was being
 handled as a static resource.
 Thanks for quick response. But I think you misunderstood what I mean.
 I'm not getting 10.100.7.26:9763/examples/websocket/echoProgrammatic'
 failed: Error during WebSocket handshake: Unexpected response code: 302
 I'm getting that for the echo sample programmatic API option.

 For each and every websocket sample I'm getting Info: WebSocket
 connection closed, Code: 1006
 And in the console it says something like
 WebSocket connection to ws://10.100.7.26:9763/examples/websocket/
 http://10.100.7.26:9763/examples/websocket/echoProgrammatic... failed:
 Error during WebSocket handshake

Re: Info: WebSocket connection closed, Code: 1006 when try to run websocket sample

2015-04-23 Thread Thusitha Thilina Dayaratne
Hi,

 Hi,

 I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
 example and when I'm trying to run it in my server for all 4 examples
 (Echo, chat, etc..)
 I'm getting

 Info: WebSocket connection closed, Code: 1006


 In the console it prints

 WebSocket connection to 'ws://
 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
 during WebSocket handshake: Unexpected response code: 302


 This same war file is running perfectly on Tomcat distribution.

 Can someone tell me what could be the reason for this?

It looks like you haven't deployed the WebSocket examples correctly. My
guess is you are seeing the 302 redirect to
/examples/websocket/echoProgrammatic/ you'd get if this was being
handled as a static resource.
Thanks for quick response. But I think you misunderstood what I mean.
I'm not getting 10.100.7.26:9763/examples/websocket/echoProgrammatic'
failed: Error during WebSocket handshake: Unexpected response code: 302
I'm getting that for the echo sample programmatic API option.

For each and every websocket sample I'm getting Info: WebSocket
connection closed, Code: 1006
And in the console it says something like
WebSocket connection to ws://10.100.7.26:9763/examples/websocket/
http://10.100.7.26:9763/examples/websocket/echoProgrammatic... failed:
Error during WebSocket handshake: Unexpected response code: 302

When I tried to deploy the sample distributed with Tomcat it works fine in
my server.
Seems that I did something wrong while building the sample. Can someone
help me out?

Thanks
Best Regards

2015-04-23 14:06 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi

  Hi,
 
  I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
  example and when I'm trying to run it in my server for all 4 examples
  (Echo, chat, etc..)
  I'm getting
 
  Info: WebSocket connection closed, Code: 1006
 
 
  In the console it prints
 
  WebSocket connection to 'ws://
  10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
  during WebSocket handshake: Unexpected response code: 302
 
 
  This same war file is running perfectly on Tomcat distribution.
 
  Can someone tell me what could be the reason for this?

 It looks like you haven't deployed the WebSocket examples correctly. My
 guess is you are seeing the 302 redirect to
 /examples/websocket/echoProgrammatic/ you'd get if this was being
 handled as a static resource.
 Thanks for quick response. But I think you misunderstood what I mean.
 I'm not getting 10.100.7.26:9763/examples/websocket/echoProgrammatic'
 failed: Error during WebSocket handshake: Unexpected response code: 302
 I'm getting that for the echo sample programmatic API option.

 For each and every websocket sample I'm getting Info: WebSocket
 connection closed, Code: 1006
 And in the console it says something like
 WebSocket connection to ws://10.100.7.26:9763/examples/websocket/
 http://10.100.7.26:9763/examples/websocket/echoProgrammatic... failed:
 Error during WebSocket handshake: Unexpected response code: 302

 2015-04-23 12:58 GMT+05:30 Mark Thomas ma...@apache.org:

 On 23/04/2015 05:51, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
  example and when I'm trying to run it in my server for all 4 examples
  (Echo, chat, etc..)
  I'm getting
 
  Info: WebSocket connection closed, Code: 1006
 
 
  In the console it prints
 
  WebSocket connection to 'ws://
  10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
  during WebSocket handshake: Unexpected response code: 302
 
 
  This same war file is running perfectly on Tomcat distribution.
 
  Can someone tell me what could be the reason for this?

 It looks like you haven't deployed the WebSocket examples correctly. My
 guess is you are seeing the 302 redirect to
 /examples/websocket/echoProgrammatic/ you'd get if this was being
 handled as a static resource.

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




 --





--


Info: WebSocket connection closed, Code: 1006 when try to run websocket sample

2015-04-22 Thread Thusitha Thilina Dayaratne
Hi,

I've embedded tomcat 8.0.20 and using that. I build the tomcat websocket
example and when I'm trying to run it in my server for all 4 examples
(Echo, chat, etc..)
I'm getting

 Info: WebSocket connection closed, Code: 1006


In the console it prints

WebSocket connection to 'ws://
 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
 during WebSocket handshake: Unexpected response code: 302


This same war file is running perfectly on Tomcat distribution.

Can someone tell me what could be the reason for this?

In the pom, my dependency is as follows
dependency
groupIdorg.apache.tomcat/groupId
artifactIdtomcat-websocket/artifactId
version8.0.20/version
/dependency


Thanks
Best Regards
--


Re: WebappLoader vs WebappClassLoader

2015-04-21 Thread Thusitha Thilina Dayaratne
Hi

  Could someone tell me what is the purpose of having WebappLoader and
  WebappClassLoader in Tomcat?
 WebappLoader is the Tomcat object that a user can configure that
 represents the class loader. It remains the same across web application
 stop/start.

 WebappClassLoader is the actual class loader. Every time the web
 application is started, a new instance is created and used.

  As I understand WebappClassLoader is per web application and
WebAppLoader
 for
  tomcat server instance. Am I wrong?
 Yes.
 Thanks for the quick explanation.
 So it means WebappClassLoader and WebAppLoader both are per web
 application.
 In tomcat 7 we were able to add repository to the class loader using
 WebAppClassLoader.addRepository()

This is replaced in favor of the new resource implementation.
Check this [1] and this [2].
Thanks for quick response.
I will look into them :)

Best Regards

2015-04-21 12:02 GMT+05:30 Violeta Georgieva violet...@apache.org:

 Hi,

 2015-04-21 6:42 GMT+03:00 Thusitha Thilina Dayaratne 
 thusithathil...@gmail.com:
 
  Hi,
 
   Could someone tell me what is the purpose of having WebappLoader and
   WebappClassLoader in Tomcat?
  WebappLoader is the Tomcat object that a user can configure that
  represents the class loader. It remains the same across web application
  stop/start.
 
  WebappClassLoader is the actual class loader. Every time the web
  application is started, a new instance is created and used.
 
   As I understand WebappClassLoader is per web application and
 WebAppLoader
  for
   tomcat server instance. Am I wrong?
  Yes.
  Thanks for the quick explanation.
  So it means WebappClassLoader and WebAppLoader both are per web
  application.
  In tomcat 7 we were able to add repository to the class loader using
  WebAppClassLoader.addRepository()

 This is replaced in favor of the new resource implementation.
 Check this [1] and this [2].

 Regards,
 Violeta

 [1] http://tomcat.apache.org/migration-8.html#Web_application_resources
 [2] http://tomcat.apache.org/tomcat-8.0-doc/config/resources.html

  So in Tomcat 8 if we wanna add repositories to the classloader we should
  done that trough the WebAppLoader not with WebAppClassLoader?
  Please correct me if I'm wrong.
 
  Thanks
  Best Regards
 
  2015-04-21 1:51 GMT+05:30 Mark Thomas ma...@apache.org:
 
   On 20/04/2015 14:22, Thusitha Thilina Dayaratne wrote:
Hi,
   
Could someone tell me what is the purpose of having WebappLoader and
WebappClassLoader in Tomcat?
  
   WebappLoader is the Tomcat object that a user can configure that
   represents the class loader. It remains the same across web application
   stop/start.
  
   WebappClassLoader is the actual class loader. Every time the web
   application is started, a new instance is created and used.
  
As I understand WebappClassLoader is per web application and
   WebAppLoader for
tomcat server instance. Am I wrong?
  
   Yes.
  
   Mark
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
   For additional commands, e-mail: users-h...@tomcat.apache.org
  
  
 
 
  --




--


Re: WebappLoader vs WebappClassLoader

2015-04-21 Thread Thusitha Thilina Dayaratne
)
 at
 org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
 at
 org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
 at
 org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
 at
 org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
 at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1031)
 at
 org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4909)
 at
 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
 at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
 Caused by: org.apache.catalina.LifecycleException: Failed to start
 component [WebappLoader[/jaxrs_basic]]
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
 at
 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5030)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 ... 95 more
 Caused by: java.lang.IllegalStateException:
 org.apache.catalina.LifecycleException: Failed to initialize component
 [org.apache.catalina.webresources.DirResourceSet@647452d0]
 at
 org.apache.catalina.webresources.DirResourceSet.init(DirResourceSet.java:83)
 at
 org.wso2.carbon.webapp.mgt.loader.CarbonWebappLoader.startInternal(CarbonWebappLoader.java:61)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 ... 97 more
 Caused by: org.apache.catalina.LifecycleException: Failed to initialize
 component [org.apache.catalina.webresources.DirResourceSet@647452d0]
 at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
 at
 org.apache.catalina.webresources.DirResourceSet.init(DirResourceSet.java:81)
 ... 99 more



2015-04-21 12:14 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi

   Could someone tell me what is the purpose of having WebappLoader and
   WebappClassLoader in Tomcat?
  WebappLoader is the Tomcat object that a user can configure that
  represents the class loader. It remains the same across web application
  stop/start.
 
  WebappClassLoader is the actual class loader. Every time the web
  application is started, a new instance is created and used.
 
   As I understand WebappClassLoader is per web application and
 WebAppLoader
  for
   tomcat server instance. Am I wrong?
  Yes.
  Thanks for the quick explanation.
  So it means WebappClassLoader and WebAppLoader both are per web
  application.
  In tomcat 7 we were able to add repository to the class loader using
  WebAppClassLoader.addRepository()

 This is replaced in favor of the new resource implementation.
 Check this [1] and this [2].
 Thanks for quick response.
 I will look into them :)

 Best Regards

 2015-04-21 12:02 GMT+05:30 Violeta Georgieva violet...@apache.org:

 Hi,

 2015-04-21 6:42 GMT+03:00 Thusitha Thilina Dayaratne 
 thusithathil...@gmail.com:
 
  Hi,
 
   Could someone tell me what is the purpose of having WebappLoader and
   WebappClassLoader in Tomcat?
  WebappLoader is the Tomcat object that a user can configure that
  represents the class loader. It remains the same across web
 application
  stop/start.
 
  WebappClassLoader is the actual class loader. Every time the web
  application is started, a new instance is created and used.
 
   As I understand WebappClassLoader is per web application and
 WebAppLoader
  for
   tomcat server instance. Am I wrong?
  Yes.
  Thanks for the quick explanation.
  So it means WebappClassLoader and WebAppLoader both are per web
  application.
  In tomcat 7 we were able to add repository to the class loader using
  WebAppClassLoader.addRepository()

 This is replaced in favor of the new resource implementation.
 Check this [1] and this [2].

 Regards,
 Violeta

 [1] http://tomcat.apache.org/migration-8.html#Web_application_resources
 [2] http://tomcat.apache.org/tomcat-8.0-doc/config/resources.html

  So in Tomcat 8 if we wanna add repositories to the classloader we should
  done that trough the WebAppLoader not with WebAppClassLoader?
  Please correct me if I'm wrong.
 
  Thanks
  Best Regards
 
  2015-04-21 1:51 GMT+05:30 Mark Thomas ma...@apache.org:
 
   On 20/04/2015 14:22, Thusitha Thilina Dayaratne wrote:
Hi,
   
Could someone tell me what is the purpose of having WebappLoader and
WebappClassLoader in Tomcat?
  
   WebappLoader is the Tomcat object that a user

Re: [Tomcat8] What happened to WebappLoader.addRepository()?

2015-04-21 Thread Thusitha Thilina Dayaratne
Hi,

On 21/04/2015 05:59, Thusitha Thilina Dayaratne wrote:
 Hi,

 Try addURL().
 Sorry for the inconvenience.
 As I understand addURL() method is defined in WebAppClassLoaderBase. So
 should I obtain the WebAppClassLoaderBase using getClassLoader() method
 and
 use reflections to call the addURL() method?

 No need for reflection. Cast to URLClassloader.

 Note the cast *should* always work but if someone is using a strange
 custom class loader it will fail. Note that Tomcat 7 required the class
 loader to be an instance of WebappClassLoader.
 Thanks for quick explanation Mark.
 But still addURL() method is defined as protected. So it is not possible
 to call that method by casting right?
 This is my implementation with Tomcat 7

 public class CarbonWebappLoader extends WebappLoader {

 @Override
 protected void startInternal() throws LifecycleException {
 WebappClassloadingContext webappClassloadingContext;
 try {
 webappClassloadingContext =
 ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
 } catch (Exception e) {
 throw new LifecycleException(e.getMessage(), e);
 }

 for (String repository :
 webappClassloadingContext.getProvidedRepositories()) {
 addRepository(repository);
 }
  super.startInternal();

 //Adding the WebappClassloadingContext to the WebappClassloader
 ((CarbonWebappClassLoader)
 getClassLoader()).setWebappCC(webappClassloadingContext);
 }

 In Tomcat 8 don't have addRepository() in the WebAppLoader. Suggestion was
 to use addURL() method.
 But that can be access through WebAppClassLoader. So I must get the
 classloader using getClassLoader() and use reflections to call addURL
 method.
 That would be really costly operation since it will get call for each and
 every application.

 Is there a better approach than that? Or Should I move this logic to
 somewhere else?

Thanks for the response.
It is worth considering other options. E.g.
a) Use the WebResources to map the JARs into WEB-INF/lib
I've tried to do so as follows.

File dir = new File(webappClassloadingContext.getProvidedRepositories()[0]);
WebResourceRoot resources = getContext().getResources();
resources.addJarResources(new DirResourceSet(resources, /WEB-INF/lib,
dir.getAbsolutePath(), getContext().getPath()));
getContext().setResources(resources);

But then I get IllegalStateException

org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/jaxrs_basic]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
Mail Thread -
http://mail-archives.apache.org/mod_mbox/tomcat-users/201504.mbox/%3CCANVncXDD7h49OztF=6a3u=+MR7=_wkdssjyvqh98kios8zq...@mail.gmail.com%3E

What did I do wrong here?

b) Cache the method object so reflection calls are faster.
c) Ignore the performance issue since it only occurs on application start

I was able to fix that by overriding the addURL method and use that to add
repositories.

Thanks
Best Regards


2015-04-21 16:43 GMT+05:30 Mark Thomas ma...@apache.org:

 On 21/04/2015 05:59, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  Try addURL().
  Sorry for the inconvenience.
  As I understand addURL() method is defined in WebAppClassLoaderBase. So
  should I obtain the WebAppClassLoaderBase using getClassLoader() method
  and
  use reflections to call the addURL() method?
 
  No need for reflection. Cast to URLClassloader.
 
  Note the cast *should* always work but if someone is using a strange
  custom class loader it will fail. Note that Tomcat 7 required the class
  loader to be an instance of WebappClassLoader.
  Thanks for quick explanation Mark.
  But still addURL() method is defined as protected. So it is not possible
  to call that method by casting right?
  This is my implementation with Tomcat 7
 
  public class CarbonWebappLoader extends WebappLoader {
 
  @Override
  protected void startInternal() throws LifecycleException {
  WebappClassloadingContext webappClassloadingContext;
  try {
  webappClassloadingContext =
  ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
  } catch (Exception e) {
  throw new LifecycleException(e.getMessage(), e);
  }
 
  for (String repository :
  webappClassloadingContext.getProvidedRepositories()) {
  addRepository(repository);
  }
   super.startInternal();
 
  //Adding the WebappClassloadingContext to the WebappClassloader
  ((CarbonWebappClassLoader)
  getClassLoader()).setWebappCC(webappClassloadingContext);
  }
 
  In Tomcat 8 don't have addRepository() in the WebAppLoader. Suggestion
 was
  to use addURL() method.
  But that can be access through WebAppClassLoader. So I must get the
  classloader using getClassLoader() and use reflections to call addURL
  method.
  That would be really costly operation since it will get call for each and
  every application.
 
  Is there a better approach than that? Or Should I move this logic to
  somewhere else?

 It is worth considering other options. E.g.

 a) Use the WebResources

Re: [Tomcat8] What happened to WebappLoader.addRepository()?

2015-04-20 Thread Thusitha Thilina Dayaratne
Hi,

 Try addURL().
 Sorry for the inconvenience.
 As I understand addURL() method is defined in WebAppClassLoaderBase. So
 should I obtain the WebAppClassLoaderBase using getClassLoader() method
and
 use reflections to call the addURL() method?

No need for reflection. Cast to URLClassloader.

Note the cast *should* always work but if someone is using a strange
custom class loader it will fail. Note that Tomcat 7 required the class
loader to be an instance of WebappClassLoader.
Thanks for quick explanation Mark.
But still addURL() method is defined as protected. So it is not possible
to call that method by casting right?
This is my implementation with Tomcat 7

public class CarbonWebappLoader extends WebappLoader {

@Override
protected void startInternal() throws LifecycleException {
WebappClassloadingContext webappClassloadingContext;
try {
webappClassloadingContext =
ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
} catch (Exception e) {
throw new LifecycleException(e.getMessage(), e);
}

for (String repository :
webappClassloadingContext.getProvidedRepositories()) {
addRepository(repository);
}
 super.startInternal();

//Adding the WebappClassloadingContext to the WebappClassloader
((CarbonWebappClassLoader)
getClassLoader()).setWebappCC(webappClassloadingContext);
}

In Tomcat 8 don't have addRepository() in the WebAppLoader. Suggestion was
to use addURL() method.
But that can be access through WebAppClassLoader. So I must get the
classloader using getClassLoader() and use reflections to call addURL
method.
That would be really costly operation since it will get call for each and
every application.

Is there a better approach than that? Or Should I move this logic to
somewhere else?

Thanks
Best Regards

2015-04-07 16:19 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi,

  Hi Mark,
 
  snipe/

 :)
 I think you meant snip rather than snipe.

  Try addURL().
  Sorry for the inconvenience.
  As I understand addURL() method is defined in WebAppClassLoaderBase. So
  should I obtain the WebAppClassLoaderBase using getClassLoader() method
 and
  use reflections to call the addURL() method?

 No need for reflection. Cast to URLClassloader.

 Note the cast *should* always work but if someone is using a strange
 custom class loader it will fail. Note that Tomcat 7 required the class
 loader to be an instance of WebappClassLoader.
 Thanks for quick explanation Mark.
 But still addURL() method is defined as protected. So it is not possible
 to call that method by casting right?



 
 
  Thanks
  Best Regards
 
  On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas ma...@apache.org wrote:
 
  On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
  Hi All,
 
  I'm having the same issue. We have extend the WebAppLoader as follows
 in
  the Tomcat 7
 
  public class CarbonWebappLoader extends WebappLoader {
  @Override
  protected void startInternal() throws LifecycleException {
  WebappClassloadingContext webappClassloadingContext;
  try {
  webappClassloadingContext =
  ClassloadingContextBuilder.buildClassloadingContext(
 getWebappFilePath());
  } catch (Exception e) {
  throw new LifecycleException(e.getMessage(), e);
  }
 
  //Adding provided classpath entries, if any
  for (String repository :
  webappClassloadingContext.getProvidedRepositories()) {
  addRepository(repository);
  }
 
  super.startInternal();
 
  //Adding the WebappClassloadingContext to the WebappClassloader
  ((CarbonWebappClassLoader)
  getClassLoader()).setWebappCC(webappClassloadingContext);
  }
  }
 
  Since addRepository method have been removed, what could I do?
 
  Don't top-post.
 
  Read the thread history. The answer has already been provided by Chris.
 
  Mark
 
 
 
 
  Thanks
  Best Regards
  /Thusitha
 
  On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas ma...@apache.org
 wrote:
 
  On 17/03/2015 18:30, Ed Rouse wrote:
 
 
  -Original Message-
  From: Pilkington, Simon [mailto:simo...@amazon.com]
  Sent: Tuesday, March 17, 2015 12:45 PM
  To: users@tomcat.apache.org
  Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
 
  Hey tomcat users,
 
  The javadoc for WebappLoader still tells me to use addRepository(),
  but
  that method no longer exists. My team has implemented an extension
 of
  WebappLoader that looked like this:
 
 
  http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
 
  9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
 
  LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
 
  lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
  _6HtfelAv3UYK2FRlJI-
 
  Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
  IiNEEd598S-UrI1Lf5-sL
 
 http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
  YqenASjqdQPhO

Re: WebappLoader vs WebappClassLoader

2015-04-20 Thread Thusitha Thilina Dayaratne
Hi,

 Could someone tell me what is the purpose of having WebappLoader and
 WebappClassLoader in Tomcat?
WebappLoader is the Tomcat object that a user can configure that
represents the class loader. It remains the same across web application
stop/start.

WebappClassLoader is the actual class loader. Every time the web
application is started, a new instance is created and used.

 As I understand WebappClassLoader is per web application and WebAppLoader
for
 tomcat server instance. Am I wrong?
Yes.
Thanks for the quick explanation.
So it means WebappClassLoader and WebAppLoader both are per web
application.
In tomcat 7 we were able to add repository to the class loader using
WebAppClassLoader.addRepository()
So in Tomcat 8 if we wanna add repositories to the classloader we should
done that trough the WebAppLoader not with WebAppClassLoader?
Please correct me if I'm wrong.

Thanks
Best Regards

2015-04-21 1:51 GMT+05:30 Mark Thomas ma...@apache.org:

 On 20/04/2015 14:22, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  Could someone tell me what is the purpose of having WebappLoader and
  WebappClassLoader in Tomcat?

 WebappLoader is the Tomcat object that a user can configure that
 represents the class loader. It remains the same across web application
 stop/start.

 WebappClassLoader is the actual class loader. Every time the web
 application is started, a new instance is created and used.

  As I understand WebappClassLoader is per web application and
 WebAppLoader for
  tomcat server instance. Am I wrong?

 Yes.

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




--


WebappLoader vs WebappClassLoader

2015-04-20 Thread Thusitha Thilina Dayaratne
Hi,

Could someone tell me what is the purpose of having WebappLoader and
WebappClassLoader in Tomcat?
As I understand WebappClassLoader is per web application and WebAppLoader for
tomcat server instance. Am I wrong?

Thanks
Best Regards

--


org.apache.catalina.authenticator.SingleSignOn.sessionEvent() equivalent in Tomcat 8

2015-04-19 Thread Thusitha Thilina Dayaratne
Hi,

In tomcat 7 there is a method to set session event as follows in the
org.apache.catalina.authenticator.SingleSignOn
void sessionEvent(SessionEvent event)

But this method has been removed in tomcat 8.
Is there a equivalent in Tomcat 8? Or is there a specific reason to remove
that?

Thanks
Best Regards

--


Re: org.apache.catalina.authenticator.SingleSignOn.sessionEvent() equivalent in Tomcat 8

2015-04-19 Thread Thusitha Thilina Dayaratne
Hi

In tomcat 7 there is a method to set session event as follows in the
org.apache.catalina.authenticator.SingleSignOn
void sessionEvent(SessionEvent event)

But this method has been removed in tomcat 8.
Is there a equivalent in Tomcat 8? Or is there a specific reason to
remove that?
I think I found the answer
I can get the sessionListner and configure through that

getSessionListener(ssID).sessionEvent(event)


Thanks

Best Regards


2015-04-20 11:01 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi,

 In tomcat 7 there is a method to set session event as follows in the
 org.apache.catalina.authenticator.SingleSignOn
 void sessionEvent(SessionEvent event)

 But this method has been removed in tomcat 8.
 Is there a equivalent in Tomcat 8? Or is there a specific reason to remove
 that?

 Thanks
 Best Regards

 --





--


Re: org.apache.catalina.authenticator.SingleSignOn.sessionEvent() equivalent in Tomcat 8

2015-04-19 Thread Thusitha Thilina Dayaratne
Hi

In tomcat 7 there is a method to set session event as follows in the
org.apache.catalina.authenticator.SingleSignOn
void sessionEvent(SessionEvent event)

But this method has been removed in tomcat 8.
Is there a equivalent in Tomcat 8? Or is there a specific reason to
remove that?
I think I found the answer
I can get the sessionListner and configure through that

getSessionListener(ssID).sessionEvent(event)

But how can I get the ssoID ?


2015-04-20 11:05 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi

 In tomcat 7 there is a method to set session event as follows in the
 org.apache.catalina.authenticator.SingleSignOn
 void sessionEvent(SessionEvent event)

 But this method has been removed in tomcat 8.
 Is there a equivalent in Tomcat 8? Or is there a specific reason to
 remove that?
 I think I found the answer
 I can get the sessionListner and configure through that

 getSessionListener(ssID).sessionEvent(event)


 Thanks

 Best Regards


 2015-04-20 11:01 GMT+05:30 Thusitha Thilina Dayaratne 
 thusithathil...@gmail.com:

 Hi,

 In tomcat 7 there is a method to set session event as follows in the
 org.apache.catalina.authenticator.SingleSignOn
 void sessionEvent(SessionEvent event)

 But this method has been removed in tomcat 8.
 Is there a equivalent in Tomcat 8? Or is there a specific reason to
 remove that?

 Thanks
 Best Regards

 --





 --





--


Access ServletContext from Session in new websocket implementation

2015-04-09 Thread Thusitha Thilina Dayaratne
Hi,

I'm trying to upgrade websocket application which is using Tomcat 7 to
Tomcat 8.0.20(Which supports javax.websocket v1)
In the current implementation we have extended the WebSocketServlet

Is there a way that I can access the servletContext in the new websocket
implementation?
As I understand I get the Session and msg @OnMessage


Thanks
Best Regards
/Thusitha
--


Re: [Tomcat8] What happened to WebappLoader.addRepository()?

2015-04-07 Thread Thusitha Thilina Dayaratne
Hi Mark,

snipe/
 @Override protected void startInternal() throws LifecycleException
 { // validate the context, which is used for debugging messages
 Context context; { Container container = getContainer(); if
 (container == null) { throw new LifecycleException(Container is
 null?!); } if (!(container instanceof Context)) { throw new
 LifecycleException(Container is not an instance of Context?!); }
 context = (Context) container; }

 if (ENVIRONMENT_ROOT != null  ENVIRONMENT_ROOT.length()  0) { //
 validate targetPackage if (null == targetPackage) { throw new
 LifecycleException( Missing required Loader attribute
 \targetPackage\ in Context configuration  +
 context.getConfigFile()); }

 try { // Excluded jars are those already pulled in by tomcat.
 SetString allExcludedJars = getAllExcludedJars(); SetString
 reallyExcludedJars = new HashSetString(); // add JARs from target
 package as repositories // getPackageClasspath finds the list of
 jars I want to include for this webapp. for (String jar :
 getPackageClasspath(targetPackage)) { File file = new
 File(ENVIRONMENT_ROOT, jar); // skip bad and unwanted JARs if
 (allExcludedJars.contains(jar) || isBadJar(file)) {
 reallyExcludedJars.add(jar); } else { // TODO: HOW TO FIX ME??
 addRepository(file.toURI().toString());


Try addURL().
Sorry for the inconvenience.
As I understand addURL() method is defined in WebAppClassLoaderBase. So
should I obtain the WebAppClassLoaderBase using getClassLoader() method and
use reflections to call the addURL() method?


Thanks
Best Regards

On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas ma...@apache.org wrote:

 On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
  Hi All,
 
  I'm having the same issue. We have extend the WebAppLoader as follows in
  the Tomcat 7
 
  public class CarbonWebappLoader extends WebappLoader {
  @Override
  protected void startInternal() throws LifecycleException {
  WebappClassloadingContext webappClassloadingContext;
  try {
  webappClassloadingContext =
  ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
  } catch (Exception e) {
  throw new LifecycleException(e.getMessage(), e);
  }
 
  //Adding provided classpath entries, if any
  for (String repository :
  webappClassloadingContext.getProvidedRepositories()) {
  addRepository(repository);
  }
 
  super.startInternal();
 
  //Adding the WebappClassloadingContext to the WebappClassloader
  ((CarbonWebappClassLoader)
  getClassLoader()).setWebappCC(webappClassloadingContext);
  }
  }
 
  Since addRepository method have been removed, what could I do?

 Don't top-post.

 Read the thread history. The answer has already been provided by Chris.

 Mark


 
 
  Thanks
  Best Regards
  /Thusitha
 
  On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas ma...@apache.org wrote:
 
  On 17/03/2015 18:30, Ed Rouse wrote:
 
 
  -Original Message-
  From: Pilkington, Simon [mailto:simo...@amazon.com]
  Sent: Tuesday, March 17, 2015 12:45 PM
  To: users@tomcat.apache.org
  Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
 
  Hey tomcat users,
 
  The javadoc for WebappLoader still tells me to use addRepository(),
 but
  that method no longer exists. My team has implemented an extension of
  WebappLoader that looked like this:
 
 
 http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
 
 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
 
 LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
 
 lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
  _6HtfelAv3UYK2FRlJI-
 
 Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
  IiNEEd598S-UrI1Lf5-sL
  http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
  YqenASjqdQPhO-
 
 YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
  qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
 
 Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
  2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
 
 Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
  IiNEEd598S-UrHrI5
 
 @Override
 protected void startInternal() throws LifecycleException {
 // validate the context, which is used for debugging messages
 Context context;
 {
 Container container = getContainer();
 if (container == null) {
 throw new LifecycleException(Container is null?!);
 }
 if (!(container instanceof Context)) {
 throw new LifecycleException(Container is not an
  instance of Context?!);
 }
 context = (Context) container;
 }
 
 if (ENVIRONMENT_ROOT != null  ENVIRONMENT_ROOT.length()  0)
 {
 // validate targetPackage
 if (null == targetPackage) {
 throw

[Tomcat8] Alternative for WebAppClassLoader.started

2015-04-07 Thread Thusitha Thilina Dayaratne
Hi,

In tomcat 7, there is a field in the WebAppClassLoader as
protected boolean started - Has this component been started?

But In Tomcat 8 this field have been remove. What is the alternative way in
Tomcat 8 for this?

Thanks
--


Re: [Tomcat8] What happened to WebappLoader.addRepository()?

2015-04-07 Thread Thusitha Thilina Dayaratne
Hi All,

I'm having the same issue. We have extend the WebAppLoader as follows in
the Tomcat 7

public class CarbonWebappLoader extends WebappLoader {
@Override
protected void startInternal() throws LifecycleException {
WebappClassloadingContext webappClassloadingContext;
try {
webappClassloadingContext =
ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
} catch (Exception e) {
throw new LifecycleException(e.getMessage(), e);
}

//Adding provided classpath entries, if any
for (String repository :
webappClassloadingContext.getProvidedRepositories()) {
addRepository(repository);
}

super.startInternal();

//Adding the WebappClassloadingContext to the WebappClassloader
((CarbonWebappClassLoader)
getClassLoader()).setWebappCC(webappClassloadingContext);
}
}

Since addRepository method have been removed, what could I do?


Thanks
Best Regards
/Thusitha

On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas ma...@apache.org wrote:

 On 17/03/2015 18:30, Ed Rouse wrote:
 
 
  -Original Message-
  From: Pilkington, Simon [mailto:simo...@amazon.com]
  Sent: Tuesday, March 17, 2015 12:45 PM
  To: users@tomcat.apache.org
  Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
 
  Hey tomcat users,
 
  The javadoc for WebappLoader still tells me to use addRepository(), but
  that method no longer exists. My team has implemented an extension of
  WebappLoader that looked like this:
 
  http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
  9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
  LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
  lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
  _6HtfelAv3UYK2FRlJI-
  Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
  IiNEEd598S-UrI1Lf5-sL
  http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
  YqenASjqdQPhO-
  YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
  qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
  Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
  2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
  Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
  IiNEEd598S-UrHrI5
 
 @Override
 protected void startInternal() throws LifecycleException {
 // validate the context, which is used for debugging messages
 Context context;
 {
 Container container = getContainer();
 if (container == null) {
 throw new LifecycleException(Container is null?!);
 }
 if (!(container instanceof Context)) {
 throw new LifecycleException(Container is not an
  instance of Context?!);
 }
 context = (Context) container;
 }
 
 if (ENVIRONMENT_ROOT != null  ENVIRONMENT_ROOT.length()  0) {
 // validate targetPackage
 if (null == targetPackage) {
 throw new LifecycleException(
 Missing required Loader attribute
  \targetPackage\ in Context configuration  +
 context.getConfigFile());
 }
 
 try {
 // Excluded jars are those already pulled in by tomcat.
 SetString allExcludedJars = getAllExcludedJars();
 SetString reallyExcludedJars = new HashSetString();
 // add JARs from target package as repositories
 // getPackageClasspath finds the list of jars I want to
  include for this webapp.
 for (String jar : getPackageClasspath(targetPackage)) {
 File file = new File(ENVIRONMENT_ROOT, jar);
 // skip bad and unwanted JARs
 if (allExcludedJars.contains(jar) || isBadJar(file))
  {
 reallyExcludedJars.add(jar);
 } else {
 // TODO: HOW TO FIX ME??
 addRepository(file.toURI().toString());
 }
 }
 log.info(Context path \ + context.getPath() + \
  excluding JARs:  + reallyExcludedJars);
 } catch (IOException e) {
 throw new LifecycleException(
 Problem setting classpath for context path \
  + context.getPath() + \,
 e);
 }
 
 // getRepositoriesString() has been renamed to
  getLoaderRepositoriesString()...
 log.info(Context path \ + context.getPath() + \ using
  classpath:  + getRepositoriesString());
 } else {
 log.warning(MyWebappLoader seems to be used outside of my
  environment. Delegating to parent.);
 }
 
 super.startInternal();
 }
 
  Can the community help 

Re: [Tomcat8] Alternative for WebAppClassLoader.started

2015-04-07 Thread Thusitha Thilina Dayaratne
Hi

In tomcat 7, there is a field in the WebAppClassLoader as
protected boolean started - Has this component been started?

But In Tomcat 8 this field have been remove. What is the alternative way
in Tomcat 8 for this?
I think I can use

getState()== LifecycleState.STARTED

Thanks


2015-04-07 14:13 GMT+05:30 Thusitha Thilina Dayaratne 
thusithathil...@gmail.com:

 Hi,

 In tomcat 7, there is a field in the WebAppClassLoader as
 protected boolean started - Has this component been started?

 But In Tomcat 8 this field have been remove. What is the alternative way
 in Tomcat 8 for this?

 Thanks
 --





--


Re: [Tomcat8] What happened to WebappLoader.addRepository()?

2015-04-07 Thread Thusitha Thilina Dayaratne
Hi,

 Hi Mark,

 snipe/

:)
I think you meant snip rather than snipe.

 Try addURL().
 Sorry for the inconvenience.
 As I understand addURL() method is defined in WebAppClassLoaderBase. So
 should I obtain the WebAppClassLoaderBase using getClassLoader() method
and
 use reflections to call the addURL() method?

No need for reflection. Cast to URLClassloader.

Note the cast *should* always work but if someone is using a strange
custom class loader it will fail. Note that Tomcat 7 required the class
loader to be an instance of WebappClassLoader.
Thanks for quick explanation Mark.
But still addURL() method is defined as protected. So it is not possible to
call that method by casting right?




 Thanks
 Best Regards

 On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas ma...@apache.org wrote:

 On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
 Hi All,

 I'm having the same issue. We have extend the WebAppLoader as follows in
 the Tomcat 7

 public class CarbonWebappLoader extends WebappLoader {
 @Override
 protected void startInternal() throws LifecycleException {
 WebappClassloadingContext webappClassloadingContext;
 try {
 webappClassloadingContext =
 ClassloadingContextBuilder.buildClassloadingContext(
getWebappFilePath());
 } catch (Exception e) {
 throw new LifecycleException(e.getMessage(), e);
 }

 //Adding provided classpath entries, if any
 for (String repository :
 webappClassloadingContext.getProvidedRepositories()) {
 addRepository(repository);
 }

 super.startInternal();

 //Adding the WebappClassloadingContext to the WebappClassloader
 ((CarbonWebappClassLoader)
 getClassLoader()).setWebappCC(webappClassloadingContext);
 }
 }

 Since addRepository method have been removed, what could I do?

 Don't top-post.

 Read the thread history. The answer has already been provided by Chris.

 Mark




 Thanks
 Best Regards
 /Thusitha

 On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas ma...@apache.org wrote:

 On 17/03/2015 18:30, Ed Rouse wrote:


 -Original Message-
 From: Pilkington, Simon [mailto:simo...@amazon.com]
 Sent: Tuesday, March 17, 2015 12:45 PM
 To: users@tomcat.apache.org
 Subject: [Tomcat8] What happened to WebappLoader.addRepository()?

 Hey tomcat users,

 The javadoc for WebappLoader still tells me to use addRepository(),
 but
 that method no longer exists. My team has implemented an extension of
 WebappLoader that looked like this:


 http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL

 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-

 LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R

 lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
 _6HtfelAv3UYK2FRlJI-

 Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
 IiNEEd598S-UrI1Lf5-sL
 http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
 YqenASjqdQPhO-

 YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
 qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-

 Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-

 Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
 IiNEEd598S-UrHrI5

@Override
protected void startInternal() throws LifecycleException {
// validate the context, which is used for debugging messages
Context context;
{
Container container = getContainer();
if (container == null) {
throw new LifecycleException(Container is null?!);
}
if (!(container instanceof Context)) {
throw new LifecycleException(Container is not an
 instance of Context?!);
}
context = (Context) container;
}

if (ENVIRONMENT_ROOT != null  ENVIRONMENT_ROOT.length()  0)
 {
// validate targetPackage
if (null == targetPackage) {
throw new LifecycleException(
Missing required Loader attribute
 \targetPackage\ in Context configuration  +
context.getConfigFile());
}

try {
// Excluded jars are those already pulled in by
tomcat.
SetString allExcludedJars = getAllExcludedJars();
SetString reallyExcludedJars = new
HashSetString();
// add JARs from target package as repositories
// getPackageClasspath finds the list of jars I want
to
 include for this webapp.
for (String jar : getPackageClasspath(targetPackage))
{
File file = new File(ENVIRONMENT_ROOT, jar);
// skip bad and unwanted JARs
if (allExcludedJars.contains(jar) ||
 isBadJar(file))
 {
reallyExcludedJars.add(jar

Re: After parsing the custom server.xml file, catalinaBase is set to null

2015-04-06 Thread Thusitha Thilina Dayaratne
Hi,

2015-04-02 14:01 GMT+03:00 Thusitha Thilina Dayaratne thusit...@wso2.com:
 Hi,

 I'm using embedded-tomcat 8.0.20 in my project. In that I'm parsing a
 custom server.xml file. After the parsing CatalinaBase value of the Server
 is set to null.
 Could someone tell me why would be the reason?
 Before parsing the file it is set to the correct path.

 Here is the code segment
 ExtendedCatalina catalina = new ExtendedCatalina();

 Digester digester = catalina.createStartDigester();
 digester.push(this); /* Here this refers to an instance of the
 extended Tomcat class*/
 digester.parse(inputStream); /*After this line get executed
 getServer().getCatalinaBase() is null */

 class ExtendedCatalina extends Catalina {
 @Override
 public Digester createStartDigester() {
 return super.createStartDigester();
 }
 }


You have not called the setter method for that property
(StandardServer.setCatalinaHome(), StandardServer.setCatalinaBase()).

E.g. Catalina.load() calls it.
Thanks for response. I manually set the CatalinaBase after parsing the
InputStream. I couldn't figure out why already setted CatalinaBase value
set to null just after parsing the server.xml.

Thanks
Best Regards


On Tue, Apr 7, 2015 at 3:18 AM, Konstantin Kolinko knst.koli...@gmail.com
wrote:

 2015-04-02 14:01 GMT+03:00 Thusitha Thilina Dayaratne thusit...@wso2.com
 :
  Hi,
 
  I'm using embedded-tomcat 8.0.20 in my project. In that I'm parsing a
  custom server.xml file. After the parsing CatalinaBase value of the
 Server
  is set to null.
  Could someone tell me why would be the reason?
  Before parsing the file it is set to the correct path.
 
  Here is the code segment
  ExtendedCatalina catalina = new ExtendedCatalina();
 
  Digester digester = catalina.createStartDigester();
  digester.push(this); /* Here this refers to an instance of the
  extended Tomcat class*/
  digester.parse(inputStream); /*After this line get executed
  getServer().getCatalinaBase() is null */
 
  class ExtendedCatalina extends Catalina {
  @Override
  public Digester createStartDigester() {
  return super.createStartDigester();
  }
  }
 

 You have not called the setter method for that property
 (StandardServer.setCatalinaHome(), StandardServer.setCatalinaBase()).

 E.g. Catalina.load() calls it.

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Better way to register a URLStreamHandlerService for JNDI from Tomcat 8

2015-04-06 Thread Thusitha Thilina Dayaratne
Hi,

At the moment, I'm registering a URLStreamHandleerService for JNDI in OSGi
BundleContext as follows.

private static final String JNDI_PROTOCOL = jndi;



HashtableString, String[] properties = new HashtableString, String[]();
properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[] {
JNDI_PROTOCOL });
bundleContext.registerService(URLStreamHandlerService.class.getName(),
new JNDIURLStreamHandlerService(), properties);

...

class JNDIURLStreamHandlerService extends AbstractURLStreamHandlerService {

   URLStreamHandler urlStreamHandler =
TomcatURLStreamHandlerFactory.getInstance().createURLStreamHandler(JNDI_PROTOCOL);

   @Override public URLConnection openConnection(URL url) throws IOException {
  return new URL(url, , urlStreamHandler).openConnection();
   }
}


Is there a better approach to do this with Tomcat 8.0.20?

Thanks
Best Regards
Thusitha
-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: How to access JNDI Directory Context in Tomcat 8

2015-04-06 Thread Thusitha Thilina Dayaratne
Hi

Is there a Tomcat provided URLStreamHandlerFactory for JNDI in tomcat
8.0.20?
I tried
TomcatURLStreamHandlerFactory.getInstance().createURLStreamHandler(jndi);

But that returns null.

Thanks
Best Regards
/Thusitha

On Wed, Mar 25, 2015 at 2:48 PM, Thusitha Thilina Dayaratne 
thusit...@wso2.com wrote:

 Hi Mark,

  Thanks all for responses. But what I actually want is to register a
  URLStreamHandlerService for JNDI

 Finally. More than 2 weeks since the first e-mail in this thread the
 list members know what it is you are actually trying to do.

 You want:
 
 http://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/webresources/TomcatURLStreamHandlerFactory.html
 Thanks a lot for the quick response and I'm really sorry for the delay and
 any inconvenience caused due to that

 Best Regards
 /Thusitha

 On Wed, Mar 25, 2015 at 2:28 PM, Mark Thomas ma...@apache.org wrote:

 On 25/03/2015 08:14, Thusitha Thilina Dayaratne wrote:
 snip/

  Thanks all for responses. But what I actually want is to register a
  URLStreamHandlerService for JNDI

 Finally. More than 2 weeks since the first e-mail in this thread the
 list members know what it is you are actually trying to do.

 You want:

 http://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/webresources/TomcatURLStreamHandlerFactory.html

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




 --
 Thusitha Dayaratne
 Software Engineer
 WSO2 Inc. - lean . enterprise . middleware |  wso2.com

 Mobile  +94712756809
 Blog  alokayasoya.blogspot.com
 Abouthttp://about.me/thusithathilina




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: How to access JNDI Directory Context in Tomcat 8

2015-04-06 Thread Thusitha Thilina Dayaratne
Hi

2015-04-06 14:33 GMT+03:00 Thusitha Thilina Dayaratne thusit...@wso2.com:

 Hi

 Is there a Tomcat provided URLStreamHandlerFactory for JNDI in tomcat
 8.0.20?
 I tried

TomcatURLStreamHandlerFactory.getInstance().createURLStreamHandler(jndi);

jndi schema is removed in Tomcat 8. You may want to check this
discussion
[1].
Thanks for the quick response.
So is this implies that there is no way  to get a URLStreamHaandler for
JNDI in Tomcat 8?
If so what should be my approach?

Thanks
Best Regards

On Mon, Apr 6, 2015 at 6:01 PM, Violeta Georgieva miles...@gmail.com
wrote:

 Hi,

 2015-04-06 14:33 GMT+03:00 Thusitha Thilina Dayaratne thusit...@wso2.com
 :
 
  Hi
 
  Is there a Tomcat provided URLStreamHandlerFactory for JNDI in tomcat
  8.0.20?
  I tried
 
 TomcatURLStreamHandlerFactory.getInstance().createURLStreamHandler(jndi);

 jndi schema is removed in Tomcat 8. You may want to check this discussion
 [1].

 Regards,
 Violeta

 [1] http://marc.info/?t=13790884487r=1w=2

  But that returns null.
 
  Thanks
  Best Regards
  /Thusitha
 
  On Wed, Mar 25, 2015 at 2:48 PM, Thusitha Thilina Dayaratne 
  thusit...@wso2.com wrote:
 
   Hi Mark,
  
Thanks all for responses. But what I actually want is to register a
URLStreamHandlerService for JNDI
  
   Finally. More than 2 weeks since the first e-mail in this thread the
   list members know what it is you are actually trying to do.
  
   You want:
   
  

 http://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/webresources/TomcatURLStreamHandlerFactory.html
   Thanks a lot for the quick response and I'm really sorry for the delay
 and
   any inconvenience caused due to that
  
   Best Regards
   /Thusitha
  
   On Wed, Mar 25, 2015 at 2:28 PM, Mark Thomas ma...@apache.org wrote:
  
   On 25/03/2015 08:14, Thusitha Thilina Dayaratne wrote:
   snip/
  
Thanks all for responses. But what I actually want is to register a
URLStreamHandlerService for JNDI
  
   Finally. More than 2 weeks since the first e-mail in this thread the
   list members know what it is you are actually trying to do.
  
   You want:
  
  

 http://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/webresources/TomcatURLStreamHandlerFactory.html
  
   Mark
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
   For additional commands, e-mail: users-h...@tomcat.apache.org
  
  
  
  
   --
   Thusitha Dayaratne
   Software Engineer
   WSO2 Inc. - lean . enterprise . middleware |  wso2.com
  
   Mobile  +94712756809
   Blog  alokayasoya.blogspot.com
   Abouthttp://about.me/thusithathilina
  
  
 
 
  --
  Thusitha Dayaratne
  Software Engineer
  WSO2 Inc. - lean . enterprise . middleware |  wso2.com
 
  Mobile  +94712756809
  Blog  alokayasoya.blogspot.com
  Abouthttp://about.me/thusithathilina




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Why getInfo method removed from ValveBase

2015-04-02 Thread Thusitha Thilina Dayaratne
Hi,

Is there a any specific reason why String getInfo() method in ValveBase has
been removed from Tomcat 8?

Thanks
Best Regards
/Thusitha

-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: Why getInfo method removed from ValveBase

2015-04-02 Thread Thusitha Thilina Dayaratne
Hi Mark,

 Hi,

 Is there a any specific reason why String getInfo() method in ValveBase
has
 been removed from Tomcat 8?

Because it served no useful purpose.
Thanks for quick response.

Best Regards
/Thusitha

On Thu, Apr 2, 2015 at 4:09 PM, Mark Thomas ma...@apache.org wrote:

 On 02/04/2015 11:14, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  Is there a any specific reason why String getInfo() method in ValveBase
 has
  been removed from Tomcat 8?

 Because it served no useful purpose.

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


After parsing the custom server.xml file, catalinaBase is set to null

2015-04-02 Thread Thusitha Thilina Dayaratne
Hi,

I'm using embedded-tomcat 8.0.20 in my project. In that I'm parsing a
custom server.xml file. After the parsing CatalinaBase value of the Server
is set to null.
Could someone tell me why would be the reason?
Before parsing the file it is set to the correct path.

Here is the code segment
ExtendedCatalina catalina = new ExtendedCatalina();

Digester digester = catalina.createStartDigester();
digester.push(this); /* Here this refers to an instance of the
extended Tomcat class*/
digester.parse(inputStream); /*After this line get executed
getServer().getCatalinaBase() is null */

class ExtendedCatalina extends Catalina {
@Override
public Digester createStartDigester() {
return super.createStartDigester();
}
}

-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: How to use Jar Scan Filters

2015-03-31 Thread Thusitha Thilina Dayaratne
Hi All,

I'm using embedded tomcat as an OSGi bundle. In tomcat 7.0.59 we extended
the StandardJarScanner to scan some jars which are resides in a custom
location. Since these jars are needed for all the applications putting them
in WEB-INF is not applicable,
We are now trying to use Tomcat 8.0.20 with that. I saw newly introduced
Jar Scan Filter there.

Can someone give me an example code segment to show how to use
JarScanFilters?
I go through the [1]. There it mention

 JarScanner
JarScanFilter
pluggabilityScan=${tomcat.util.scan.StandardJarScanFilter.jarsToScan},
   my_pluggable_feature.jar/
  /JarScanner


Is this can be use only to scan jars inside WEB-INF and class path?
or can I scan some jar file which are located in custom locations? (Since
those jar files are needed for all the web applications)
If it is possible how can I provide the custom path? Should I give the
absolute path?


[1] - http://tomcat.apache.org/tomcat-8.0-doc/config/jar-scan-filter.html
Any suggestions or help on this would be really nice.

Thanks
Best Regards
/Thusitha

On Thu, Mar 26, 2015 at 9:35 AM, Thusitha Thilina Dayaratne 
thusit...@wso2.com wrote:

 Hi,

 I'm using embedded tomcat as an OSGi bundle. In tomcat 7.0.59 we extended
 the StandardJarScanner to scan some jars which are resides in a custom
 location. Since these jars are needed for all the applications putting them
 in WEB-INF is not applicable,
 We are now trying to use Tomcat 8.0.20 with that. I saw newly introduced
 Jar Scan Filter there.

 Can someone give me an example code segment to show how to use
 JarScanFilters?
 I go through the [1]. There it mention

  JarScanner
 JarScanFilter
 
 pluggabilityScan=${tomcat.util.scan.StandardJarScanFilter.jarsToScan},
my_pluggable_feature.jar/
   /JarScanner


 Is this can be use only to scan jars inside WEB-INF and class path?
 or can I scan some jar file which are located in custom locations? (Since
 those jar files are needed for all the web applications)
 If it is possible how can I provide the custom path? Should I give the
 absolute path?


 [1] - http://tomcat.apache.org/tomcat-8.0-doc/config/jar-scan-filter.html

 Thanks
 Best Regards
 /Thusitha
 --
 Thusitha Dayaratne
 Software Engineer
 WSO2 Inc. - lean . enterprise . middleware |  wso2.com

 Mobile  +94712756809
 Blog  alokayasoya.blogspot.com
 Abouthttp://about.me/thusithathilina




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: org.apache.jasper.JasperException: The absolute uri: http://tiles.apache.org/tags-tiles cannot be resolved in either web.xml or the jar files deployed with this application

2015-03-26 Thread Thusitha Thilina Dayaratne
Hi,


 Hi Chris,

 Thanks a lot for the quick response. Please find inline answers.

 On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
  I'm in the process of migrating embedded tomcat 7.0.59 application
  to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
  get a NullPointerException when trying to access the server home
  page. I fixed that manually setting an empty TldCache instance in
  the context as follows
 
  [snip]
 
 
  Now it is not throwing the NPE. but instead of that I'm getting
  following exception
 
  org.apache.jasper.JasperException: The absolute uri:
  http://tiles.apache.org/tags-tiles cannot be resolved in either
  web.xml or the jar files deployed with this application at
 

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)

 I
 
 looks like you are missing the Tiles JAR. Is it located in your
 WEB-INF/lib directory?
 These jar files are located in a folder called plugins. We are reading
them
 from our JarScanner

  I'm also using a extended JarScanner as follows

 
  public class CarbonTomcatJarScanner extends StandardJarScanner{

  Without trying to read and understand all this code, can you explain
  why you are using your own JarScanner instead of Tomcat's? Perhaps
  there is a way to do this where you don't need to write your own
  JarScanner.

 According the servlet 3.0 spec, tldScanner classes are picked up
 during web-app load phase from
 the classPath using SPI mechanism. Normal sequence is to scan;
  - WEB-INF/lib
  - parent URL classPath
 However with the BundleClassLoader being the parent classLoader of
 Tomcat web-app classLoder, it fails to pick up
 TLD scanner references reside in plugins directory. That is why we
 have used a our own JarScanner

  It seems that this is relate to JarScanner. Can someone tell me
  what I have done wrong here? Or a way to fix this? Is this occur
  because I set TldCache manually?

 I'm curious as to why the TldCache isn't being set up correctly in the
 first place. In your other recent thread (NPE in
 JspCompilationContext.getTldResourcePath), there were a couple of
 questions from the community that it doesn't look like you have
 answered. Perhaps answering those might help you solve both problems
 at once.
 I'm not so quite sure about that. I manually set the TldCache and manually
 added the JasperInitializer to the StandardContext
 to get rid of the NPE
 I will try to answer the an answered questions in other thread.

You may want to have a look at Eclipse Gemini Web (OSGi Web Container
Reference Implementation)
Thanks for the reference. We are using eclipse equinox jasper. Could
that be a reason that TldCache not getting initialized?

I'm using In tomcat 7 when creating EmbeddedServletOptions (get call from
JspServlet init method) inside the constructor tldLocationsCache is
initiated as

tldLocationsCache = TldLocationsCache.getInstance(context);

in the getInstance method, if context don't have cache set it will set
a new empty cache and return that.

public static synchronized TldLocationsCache getInstance(
ServletContext ctxt) {
if (ctxt == null) {
throw new IllegalArgumentException(ServletContext was null);
}
TldLocationsCache cache = (TldLocationsCache) ctxt.getAttribute(KEY);
if (cache == null) {
cache = new TldLocationsCache(ctxt);
ctxt.setAttribute(KEY, cache);
}
return cache;
}

In tomcat 8 that method looks like follows. So if cache is not set at
the context then this will return null

public static TldCache getInstance(ServletContext servletContext) {
if (servletContext == null) {
throw new IllegalArgumentException(Localizer.getMessage(
org.apache.jasper.compiler.TldCache.servletContextNull));
}
return (TldCache)
servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
}

In my application I have 2 contexts. One is the StandardContext which
is created by the root app, and another context which is created by
equinox jasper.

I have manually added the SCI for the Tomcat OSGi bundle and then
TldCache is get initialized by the JasperInitializer onStartup method.

But how can I initialize the TldCache for jsp? ATM I manually set the
already initialized Tldcache for the jsp.


Can someone tell me what might be the issue here? What I've done wrong here?

In tomcat 7.0.59. We didn't use SCI to initialize the Jasper.


Thanks

Best Regards

/Thusitha


On Fri, Mar 20, 2015 at 1:55 PM, Thusitha Thilina Dayaratne 
thusit...@wso2.com wrote:

 Hi,

 
  Hi Chris,
 
  Thanks a lot for the quick response. Please find inline answers.
 
  On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
   I'm in the process of migrating embedded tomcat 7.0.59 application
   to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
   get a NullPointerException when trying to access the server home
   page. I fixed that manually setting an empty TldCache instance in
   the context as follows

Why setUniqueId removed from ClusterMessage in Tomcat 8

2015-03-26 Thread Thusitha Thilina Dayaratne
Hi,

Is there a specific reason to remove

public void setUniqueId(String id); method from
org.apache.catalina.ha.ClusterMessage.java
in Tomcat 8.0.20?

Thanks
Best Regards
/Thusitha
-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: How to access JNDI Directory Context in Tomcat 8

2015-03-25 Thread Thusitha Thilina Dayaratne
Hi

 how can that be modified to load the jndi.properties file?

 The javadoc for InitialContext seems to indicate that this file will be
 processed automatically.

 If it isn't processed automatically, I'd suggest trying to figure out
 why.


Good to know, thank you.

Amazingly, this is the only Java example code I've ever seen which,
potentially, enables remote JNDI lookup for JMSContext.

Thanks all for responses. But what I actually want is to register a
URLStreamHandlerService for JNDI
In tomcat 7
I have used DirContextURLStreamHandler for that as follows

Properties properties = new Properties();
properties.put(URLConstants.URL_HANDLER_PROTOCOL, jndi);
final URLStreamHandler handler = new DirContextURLStreamHandler();

bundleContext.registerService(URLStreamHandlerService.class.getName(),
new AbstractURLStreamHandlerService() {
private final static String EMPTY_STRING = ;
public URLConnection openConnection(URL u) throws IOException {
return new URL(u, EMPTY_STRING, 
handler).openConnection();
}
}, properties);


But since with Tomcat 8 DirContextURLStreamHandler have been removed.

So how can I achieve the same thing in Tomcat 8?


Thanks

Best Regards

/Thusitha


On Tue, Mar 10, 2015 at 4:02 AM, Thufir hawat.thu...@gmail.com wrote:

 On Mon, 09 Mar 2015 14:11:08 -0400, Christopher Schultz wrote:

  how can that be modified to load the jndi.properties file?
 
  The javadoc for InitialContext seems to indicate that this file will be
  processed automatically.
 
  If it isn't processed automatically, I'd suggest trying to figure out
  why.


 Good to know, thank you.

 Amazingly, this is the only Java example code I've ever seen which,
 potentially, enables remote JNDI lookup for JMSContext.



 -Thufir


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: How to access JNDI Directory Context in Tomcat 8

2015-03-25 Thread Thusitha Thilina Dayaratne
Hi Mark,

 Thanks all for responses. But what I actually want is to register a
 URLStreamHandlerService for JNDI

Finally. More than 2 weeks since the first e-mail in this thread the
list members know what it is you are actually trying to do.

You want:

http://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/webresources/TomcatURLStreamHandlerFactory.html
Thanks a lot for the quick response and I'm really sorry for the delay and
any inconvenience caused due to that

Best Regards
/Thusitha

On Wed, Mar 25, 2015 at 2:28 PM, Mark Thomas ma...@apache.org wrote:

 On 25/03/2015 08:14, Thusitha Thilina Dayaratne wrote:
 snip/

  Thanks all for responses. But what I actually want is to register a
  URLStreamHandlerService for JNDI

 Finally. More than 2 weeks since the first e-mail in this thread the
 list members know what it is you are actually trying to do.

 You want:

 http://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/webresources/TomcatURLStreamHandlerFactory.html

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


How to use Jar Scan Filters

2015-03-25 Thread Thusitha Thilina Dayaratne
Hi,

I'm using embedded tomcat as an OSGi bundle. In tomcat 7.0.59 we extended
the StandardJarScanner to scan some jars which are resides in a custom
location. Since these jars are needed for all the applications putting them
in WEB-INF is not applicable,
We are now trying to use Tomcat 8.0.20 with that. I saw newly introduced
Jar Scan Filter there.

Can someone give me an example code segment to show how to use
JarScanFilters?
I go through the [1]. There it mention

 JarScanner
JarScanFilter
pluggabilityScan=${tomcat.util.scan.StandardJarScanFilter.jarsToScan},
   my_pluggable_feature.jar/
  /JarScanner


Is this can be use only to scan jars inside WEB-INF and class path?
or can I scan some jar file which are located in custom locations? (Since
those jar files are needed for all the web applications)
If it is possible how can I provide the custom path? Should I give the
absolute path?


[1] - http://tomcat.apache.org/tomcat-8.0-doc/config/jar-scan-filter.html

Thanks
Best Regards
/Thusitha
-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: org.apache.jasper.JasperException: The absolute uri: http://tiles.apache.org/tags-tiles cannot be resolved in either web.xml or the jar files deployed with this application

2015-03-20 Thread Thusitha Thilina Dayaratne
Hi,


 Hi Chris,

 Thanks a lot for the quick response. Please find inline answers.

 On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
  I'm in the process of migrating embedded tomcat 7.0.59 application
  to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
  get a NullPointerException when trying to access the server home
  page. I fixed that manually setting an empty TldCache instance in
  the context as follows
 
  [snip]
 
 
  Now it is not throwing the NPE. but instead of that I'm getting
  following exception
 
  org.apache.jasper.JasperException: The absolute uri:
  http://tiles.apache.org/tags-tiles cannot be resolved in either
  web.xml or the jar files deployed with this application at
 

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)

 I
 
 looks like you are missing the Tiles JAR. Is it located in your
 WEB-INF/lib directory?
 These jar files are located in a folder called plugins. We are reading
them
 from our JarScanner

  I'm also using a extended JarScanner as follows

 
  public class CarbonTomcatJarScanner extends StandardJarScanner{

  Without trying to read and understand all this code, can you explain
  why you are using your own JarScanner instead of Tomcat's? Perhaps
  there is a way to do this where you don't need to write your own
  JarScanner.

 According the servlet 3.0 spec, tldScanner classes are picked up
 during web-app load phase from
 the classPath using SPI mechanism. Normal sequence is to scan;
  - WEB-INF/lib
  - parent URL classPath
 However with the BundleClassLoader being the parent classLoader of
 Tomcat web-app classLoder, it fails to pick up
 TLD scanner references reside in plugins directory. That is why we
 have used a our own JarScanner

  It seems that this is relate to JarScanner. Can someone tell me
  what I have done wrong here? Or a way to fix this? Is this occur
  because I set TldCache manually?

 I'm curious as to why the TldCache isn't being set up correctly in the
 first place. In your other recent thread (NPE in
 JspCompilationContext.getTldResourcePath), there were a couple of
 questions from the community that it doesn't look like you have
 answered. Perhaps answering those might help you solve both problems
 at once.
 I'm not so quite sure about that. I manually set the TldCache and manually
 added the JasperInitializer to the StandardContext
 to get rid of the NPE
 I will try to answer the an answered questions in other thread.

You may want to have a look at Eclipse Gemini Web (OSGi Web Container
Reference Implementation)
Thanks for the reference. We are using eclipse equinox jasper. Could that
be a reason that TldCache not getting initialized?

Thanks
Best Regards
/Thusitha


On Fri, Mar 20, 2015 at 12:00 AM, Violeta Georgieva miles...@gmail.com
wrote:

 Hi,

 2015-03-19 5:34 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com:
 
  Hi Chris,
 
  Thanks a lot for the quick response. Please find inline answers.
 
  On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
   I'm in the process of migrating embedded tomcat 7.0.59 application
   to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
   get a NullPointerException when trying to access the server home
   page. I fixed that manually setting an empty TldCache instance in
   the context as follows
  
   [snip]
  
  
   Now it is not throwing the NPE. but instead of that I'm getting
   following exception
  
   org.apache.jasper.JasperException: The absolute uri:
   http://tiles.apache.org/tags-tiles cannot be resolved in either
   web.xml or the jar files deployed with this application at
  
 

 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
 
  I
  
  looks like you are missing the Tiles JAR. Is it located in your
  WEB-INF/lib directory?
  These jar files are located in a folder called plugins. We are reading
 them
  from our JarScanner
 
   I'm also using a extended JarScanner as follows
 
  
   public class CarbonTomcatJarScanner extends StandardJarScanner{
 
   Without trying to read and understand all this code, can you explain
   why you are using your own JarScanner instead of Tomcat's? Perhaps
   there is a way to do this where you don't need to write your own
   JarScanner.
 
  According the servlet 3.0 spec, tldScanner classes are picked up
  during web-app load phase from
  the classPath using SPI mechanism. Normal sequence is to scan;
   - WEB-INF/lib
   - parent URL classPath
  However with the BundleClassLoader being the parent classLoader of
  Tomcat web-app classLoder, it fails to pick up
  TLD scanner references reside in plugins directory. That is why we
  have used a our own JarScanner
 
   It seems that this is relate to JarScanner. Can someone tell me
   what I have done wrong here? Or a way to fix this? Is this occur
   because I set TldCache manually?
 
  I'm curious as to why the TldCache isn't being set up correctly in the
  first place. In your other

Can't set context to / in Tomcat 8.0.20

2015-03-19 Thread Thusitha Thilina Dayaratne
Hi,

I'm in the process of migrating to a embedded tomcat 7.0.59 application to
tomcat 8.0.20. In the application i'm setting the context as */* This
works fine in tomcat 7

But in Tomcat 8 when I set the context as */*, internally it is set as .

Is this a bug in Tomcat 8?

Thanks
Best Regards
/Thusitha
-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: Can't set context to / in Tomcat 8.0.20

2015-03-19 Thread Thusitha Thilina Dayaratne
Hi All,

Prior to Tomcat 7.0.58, we are able to set the context as /. In the code
it will go to else part and set the context without any issues.

public void setPath(String path) {
if (path == null || (!path.equals()  !path.startsWith(/))) {
this.path = / + path;
log.warn(sm.getString(
standardContext.pathInvalid, path, this.path));
} else {
this.path = path;
}
encodedPath = urlEncoder.encode(this.path);
if (getName() == null) {
setName(this.path);
}
}


But from 7.0.58, when we trying to set context as /, it will matches
the first of condition as make the path an empty string().

public void setPath(String path) {
boolean invalid = false;
if (path == null || path.equals(/)) {
invalid = true;
this.path = ;
} else if (.equals(path) || path.startsWith(/)) {
this.path = path;
} else {
invalid = true;
this.path = / + path;
}
if (this.path.endsWith(/)) {
invalid = true;
this.path = this.path.substring(0, this.path.length() - 1);
}
if (invalid) {
log.warn(sm.getString(
standardContext.pathInvalid, path, this.path));
}
encodedPath = urlEncoder.encode(this.path);
if (getName() == null) {
setName(this.path);
}
}

Is there a any specific reason for this change?
Why it is not allowing to set the context path as /

Thanks
Best Regards
/Thusitha


On Thu, Mar 19, 2015 at 4:35 PM, Thusitha Thilina Dayaratne 
thusit...@wso2.com wrote:

 Hi

 Thanks for quick response.
  Hi,
 
  I'm in the process of migrating to a embedded tomcat 7.0.59 application
 to
  tomcat 8.0.20. In the application i'm setting the context as */* This
  works fine in tomcat 7
 
  But in Tomcat 8 when I set the context as */*, internally it is set as
 .
 
  Is this a bug in Tomcat 8?

 No.
 Why it it is not allowing to set Context as / in tomcat 8?

 Thanks
 Regards
 /Thusitha


 On Thu, Mar 19, 2015 at 4:26 PM, Mark Thomas ma...@apache.org wrote:

 On 19/03/2015 10:55, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  I'm in the process of migrating to a embedded tomcat 7.0.59 application
 to
  tomcat 8.0.20. In the application i'm setting the context as */* This
  works fine in tomcat 7
 
  But in Tomcat 8 when I set the context as */*, internally it is set
 as .
 
  Is this a bug in Tomcat 8?

 No.

 Mark


 -
 To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: dev-h...@tomcat.apache.org




 --
 Thusitha Dayaratne
 Software Engineer
 WSO2 Inc. - lean . enterprise . middleware |  wso2.com

 Mobile  +94712756809
 Blog  alokayasoya.blogspot.com
 Abouthttp://about.me/thusithathilina




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: Scan custom directory from JarScanner

2015-03-19 Thread Thusitha Thilina Dayaratne
Hi

Thanks for quick response.
 Hi,

 I'm having an extended StandardJarScanner to scan for jar files which are
 located in a custom location. In tomcat 8 Jar scan filters have been
 introduced. Is i possible to scan my custom location without extending the
 StandardJarScanner in Tomcat 8?

That is not the correct approach. The Jar scanner is not intended (and
probably won't work) to be used to add JARs to your classpath.

If you have additional JARs they need to be added to the web application
and via WebResources the JarScanner will treat them just like any other
application JAR.
Since I'm using embedded tomcat as an OSGI bundle, I used extended
JarScanner to scan for all the required jars in custom location.
These Jars will be used by all other applications.


 In the [1] it say that we can specify comma separated jar files for
 tldlibraries and pluggable features.
 Is it possible to specify a directory rather than separate jars?

No. That is a list of file names to use for filtering, not a list of
locations to scan.
Can I specify absolute paths of Jars that need to be scan here?

Thanks
Regards
/Thusitha

On Thu, Mar 19, 2015 at 9:37 PM, Mark Thomas ma...@apache.org wrote:

 On 19/03/2015 16:00, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  I'm having an extended StandardJarScanner to scan for jar files which are
  located in a custom location. In tomcat 8 Jar scan filters have been
  introduced. Is i possible to scan my custom location without extending
 the
  StandardJarScanner in Tomcat 8?

 That is not the correct approach. The Jar scanner is not intended (and
 probably won't work) to be used to add JARs to your classpath.

 If you have additional JARs they need to be added to the web application
 and via WebResources the JarScanner will treat them just like any other
 application JAR.

  In the [1] it say that we can specify comma separated jar files for
  tldlibraries and pluggable features.
  Is it possible to specify a directory rather than separate jars?

 No. That is a list of file names to use for filtering, not a list of
 locations to scan.

 Mark

 
 
  [1] -
 http://tomcat.apache.org/tomcat-8.0-doc/config/jar-scan-filter.html
  Thanks
  Best Regards
  /Thusitha
 


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Scan custom directory from JarScanner

2015-03-19 Thread Thusitha Thilina Dayaratne
Hi,

I'm having an extended StandardJarScanner to scan for jar files which are
located in a custom location. In tomcat 8 Jar scan filters have been
introduced. Is i possible to scan my custom location without extending the
StandardJarScanner in Tomcat 8?

In the [1] it say that we can specify comma separated jar files for
tldlibraries and pluggable features.
Is it possible to specify a directory rather than separate jars?


[1] - http://tomcat.apache.org/tomcat-8.0-doc/config/jar-scan-filter.html
Thanks
Best Regards
/Thusitha

-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


org.apache.jasper.JasperException: The absolute uri: http://tiles.apache.org/tags-tiles cannot be resolved in either web.xml or the jar files deployed with this application

2015-03-18 Thread Thusitha Thilina Dayaratne
Hi,

I'm in the process of migrating embedded tomcat 7.0.59 application to
Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle.
First I get a NullPointerException when trying to access the server home
page. I fixed that manually setting an empty TldCache instance in the
context as follows

if(config.getServletContext().getAttribute(org.apache.jasper.compiler.TldCache)
== null){
Constructor? constructor =
Class.forName(org.apache.jasper.compiler.TldCache).getConstructor(ServletContext.class,
Map.class, Map.class);
Object instance =
constructor.newInstance(config.getServletContext(), new
HashMapString, TldResourcePath(), new HashMapTldResourcePath,
TaglibXml());

config.getServletContext().setAttribute(org.apache.jasper.compiler.TldCache,
instance);
}

Now it is not throwing the NPE. but instead of that I'm getting
following exception

org.apache.jasper.JasperException: The absolute uri:
 http://tiles.apache.org/tags-tiles cannot be resolved in either web.xml
 or the jar files deployed with this application
 at
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
 at
 org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:277)
 at
 org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:75)
 at
 org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:240)
 at
 org.apache.jasper.compiler.TagLibraryInfoImpl.init(TagLibraryInfoImpl.java:124)
 at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:411)
 at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
 at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
 at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
 at
 org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
 at
 org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
 at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
 at
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:570)
 at
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:175)
 at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at
 org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
 at
 org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
 at
 org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
 at
 org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at
 org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:64)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at
 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
 at
 org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
 at
 org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
 at
 org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
 at
 org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.forward(RequestDispatcherAdaptor.java:30)
 at
 org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDispatcherAdaptor.forward(ContextPathServletAdaptor.java:362)
 at
 org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:198)
 at
 org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:185)
 at
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:419)
 at
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370)
 at org.wso2.carbon.ui.action.ActionHelper.render(ActionHelper.java:52)
 at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:101)
 at 

Re: org.apache.jasper.JasperException: The absolute uri: http://tiles.apache.org/tags-tiles cannot be resolved in either web.xml or the jar files deployed with this application

2015-03-18 Thread Thusitha Thilina Dayaratne
Hi Chris,

Thanks a lot for the quick response. Please find inline answers.

On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
 I'm in the process of migrating embedded tomcat 7.0.59 application
 to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
 get a NullPointerException when trying to access the server home
 page. I fixed that manually setting an empty TldCache instance in
 the context as follows

 [snip]


 Now it is not throwing the NPE. but instead of that I'm getting
 following exception

 org.apache.jasper.JasperException: The absolute uri:
 http://tiles.apache.org/tags-tiles cannot be resolved in either
 web.xml or the jar files deployed with this application at

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)

I

looks like you are missing the Tiles JAR. Is it located in your
WEB-INF/lib directory?
These jar files are located in a folder called plugins. We are reading them
from our JarScanner

 I'm also using a extended JarScanner as follows


 public class CarbonTomcatJarScanner extends StandardJarScanner{

 Without trying to read and understand all this code, can you explain
 why you are using your own JarScanner instead of Tomcat's? Perhaps
 there is a way to do this where you don't need to write your own
 JarScanner.

According the servlet 3.0 spec, tldScanner classes are picked up
during web-app load phase from
the classPath using SPI mechanism. Normal sequence is to scan;
 - WEB-INF/lib
 - parent URL classPath
However with the BundleClassLoader being the parent classLoader of
Tomcat web-app classLoder, it fails to pick up
TLD scanner references reside in plugins directory. That is why we
have used a our own JarScanner

 It seems that this is relate to JarScanner. Can someone tell me
 what I have done wrong here? Or a way to fix this? Is this occur
 because I set TldCache manually?

I'm curious as to why the TldCache isn't being set up correctly in the
first place. In your other recent thread (NPE in
JspCompilationContext.getTldResourcePath), there were a couple of
questions from the community that it doesn't look like you have
answered. Perhaps answering those might help you solve both problems
at once.
I'm not so quite sure about that. I manually set the TldCache and manually
added the JasperInitializer to the StandardContext
to get rid of the NPE
I will try to answer the an answered questions in other thread.

Thanks
Best Regards
/Thusitha

On Thu, Mar 19, 2015 at 3:08 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Thusitha,

 On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
  I'm in the process of migrating embedded tomcat 7.0.59 application
  to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
  get a NullPointerException when trying to access the server home
  page. I fixed that manually setting an empty TldCache instance in
  the context as follows
 
  [snip]
 
 
  Now it is not throwing the NPE. but instead of that I'm getting
  following exception
 
  org.apache.jasper.JasperException: The absolute uri:
  http://tiles.apache.org/tags-tiles cannot be resolved in either
  web.xml or the jar files deployed with this application at
 
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)

 It
 
 looks like you are missing the Tiles JAR. Is it located in your
 WEB-INF/lib directory?

  I'm also using a extended JarScanner as follows
 
  public class CarbonTomcatJarScanner extends StandardJarScanner{

 Without trying to read and understand all this code, can you explain
 why you are using your own JarScanner instead of Tomcat's? Perhaps
 there is a way to do this where you don't need to write your own
 JarScanner.

  It seems that this is relate to JarScanner. Can someone tell me
  what I have done wrong here? Or a way to fix this? Is this occur
  because I set TldCache manually?

 I'm curious as to why the TldCache isn't being set up correctly in the
 first place. In your other recent thread (NPE in
 JspCompilationContext.getTldResourcePath), there were a couple of
 questions from the community that it doesn't look like you have
 answered. Perhaps answering those might help you solve both problems
 at once.

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org

 iQIcBAEBCAAGBQJVCfBVAAoJEBzwKT+lPKRYdSoP/1jjvwNnNlTDSaR8ptkN3TLk
 u37oZ5qmuNNTcY/F7Clh0cEmslvu8e3oqqTZQ7IBT9PMwBUmyoUhN2PtljQLY3UQ
 QFPQyARHKdf6f+MJx3zFBpJr/mlzrMtaNXMGXtCMkesD6Kf8FdWn70/irKG69/fv
 TyGI8lD07p/lRbkKIsg7uFuWItuRgCG4SO00XqmpTEnE22kpjwW9IRp1Ajn6EFk0
 cKuRNXZzkXoTSqMT+PpqwZf/dr3Bx7cBajievhoBIXL41EhMI2gYpzhSKljkwb9x
 mP3bMDl7XyYX43Ka5ojyZaI1RXouGK95X8TKpyr+nxjuFUX1asQdJ40vAb6zICO7
 UTDUDJep7Kr0x9VtX/EiRuNJVl0zETe8uAUVmKhGovZ6xpAXUN0T/tb3BcfHAqXl
 65WmcqfeELdNYyQdd2FTK7t9UXWDVKv0v/C0GXSnZxGO1pWLv7brEF2gikEXucum
 zRZiQLA+EZ5jLtkRJ/Vhe15IDpzspvsZKoe3BTAIICe0AYScy80rZHNW1DOdW8JK

Re: java.lang.NullPointerException at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) when starting Embedded Tomcat Instance

2015-03-17 Thread Thusitha Thilina Dayaratne
)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at
 org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
 at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
 at
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
 at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
 at
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
 at
 org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
 at
 org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
 at
 org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
 at
 org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
 at
 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
 at
 org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
 at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
 at
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
 at
 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)
 at
 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659)
 at
 org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
 at
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558)
 at
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515)
 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at
 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Thread.java:745)


I'm having a custom JarScanner as well. Is this relate to the JarScanner?
Can someone help me out?

Thanks
regards
/Thusitha

On Tue, Mar 17, 2015 at 7:11 PM, Thusitha Thilina Dayaratne 
thusit...@wso2.com wrote:

 2015-03-17 15:16 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com
 :
 
  Hi
  
   Hi Violeta
  
   Hi,
  
   2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne 
 thusit...@wso2.com
  :
   
 ERROR {org.apache.catalina.core.ApplicationDispatcher} -
 Servlet.service() for servlet bridgeservlet threw exception
 java.lang.NullPointerException
 at


   
  
 

 org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
 at

  org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
 at
 org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
 at
 org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
 at org.apache.jasper.compiler.Parser.parse(Parser.java:139)

 snip/

 I can't figure out the reason to get this NullPointerException.
 Can someone help me out?

 If we knew which version of Tomcat 8 you were using, someone
 could
   look
 at the relevant source code to try to figure out what was going
 on.
 I'm using tomcat version *8.0.20*
   
Browse to the sourcecode of v8.0.20 of tomcat here:
   
 public TldResourcePath getTldResourcePath(String uri) {
 return getOptions().getTldCache().getTldResourcePath(uri);
 }
Thanks for the quick response
   
 Obviously either getOptions() or getTldCache() is returning null.
   
I debug the code as you suggest and found that getTldCache() is null.
In the code As I understand there are 2 point which set the
 *tldCache*
 variable
one is the setTldCache() method and other is
public static TldCache getInstance(ServletContext servletContext) {
   
if (servletContext == null) {
throw new IllegalArgumentException(Localizer.getMessage(
   
   org.apache.jasper.compiler.TldCache.servletContextNull));
}
return (TldCache)
servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
}
  
  
  
   If you can attach a debugger try to see whether the code below is
  invoked:
  
   org.apache.jasper.servlet.JasperInitializer.onStartup(SetClass?,
   ServletContext

Re: java.lang.NullPointerException at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) when starting Embedded Tomcat Instance

2015-03-17 Thread Thusitha Thilina Dayaratne
Hi

 Hi Violeta

 Hi,

 2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com
:
 
   ERROR {org.apache.catalina.core.ApplicationDispatcher} -
   Servlet.service() for servlet bridgeservlet threw exception
   java.lang.NullPointerException
   at
  
  
 

org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
   at
  
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
   at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
   at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
   at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
  
   snip/
  
   I can't figure out the reason to get this NullPointerException.
   Can someone help me out?
  
   If we knew which version of Tomcat 8 you were using, someone could
 look
   at the relevant source code to try to figure out what was going on.
   I'm using tomcat version *8.0.20*
 
  Browse to the sourcecode of v8.0.20 of tomcat here:
 
   public TldResourcePath getTldResourcePath(String uri) {
   return getOptions().getTldCache().getTldResourcePath(uri);
   }
  Thanks for the quick response
 
   Obviously either getOptions() or getTldCache() is returning null.
 
  I debug the code as you suggest and found that getTldCache() is null.
  In the code As I understand there are 2 point which set the *tldCache*
   variable
  one is the setTldCache() method and other is
  public static TldCache getInstance(ServletContext servletContext) {
 
  if (servletContext == null) {
  throw new IllegalArgumentException(Localizer.getMessage(
 
 org.apache.jasper.compiler.TldCache.servletContextNull));
  }
  return (TldCache)
  servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
  }



 If you can attach a debugger try to see whether the code below is
invoked:

 org.apache.jasper.servlet.JasperInitializer.onStartup(SetClass?,
 ServletContext) {
 .
 context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME,
 new TldCache(context,
scanner.getUriTldResourcePathMap(),
 scanner.getTldResourcePathTaglibXmlMap()));
 
 }
 I have checked that as well. But that method didn't get hot when I'm
 debugging the source.
 what could be the reason?

You wrote that you are running an embedded Tomcat. Is that true?
In Tomcat 8, Jasper initialization is implemented as a standard
ServletContainderInitializer (check Servlet specification).
So you should ensure
that org.apache.jasper.servlet.JasperInitializer.onStartup is invoked
during web app startup

Could someone tell me how can I make sure that this method get call during
the web app startup?

Best Regards
Thusitha

On Tue, Mar 17, 2015 at 9:37 AM, Thusitha Thilina Dayaratne 
thusit...@wso2.com wrote:

 Hi Violeta,

 2015-03-16 15:33 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com
 :
 
  Hi Violeta
 
  Hi,
 
  2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne 
 thusit...@wso2.com
 :
  
ERROR {org.apache.catalina.core.ApplicationDispatcher} -
Servlet.service() for servlet bridgeservlet threw exception
java.lang.NullPointerException
at
   
   
  
 

 org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
at
   
 org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
at
 org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
at
 org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
   
snip/
   
I can't figure out the reason to get this NullPointerException.
Can someone help me out?
   
If we knew which version of Tomcat 8 you were using, someone could
  look
at the relevant source code to try to figure out what was going on.
I'm using tomcat version *8.0.20*
  
   Browse to the sourcecode of v8.0.20 of tomcat here:
  
public TldResourcePath getTldResourcePath(String uri) {
return getOptions().getTldCache().getTldResourcePath(uri);
}
   Thanks for the quick response
  
Obviously either getOptions() or getTldCache() is returning null.
  
   I debug the code as you suggest and found that getTldCache() is null.
   In the code As I understand there are 2 point which set the *tldCache*
variable
   one is the setTldCache() method and other is
   public static TldCache getInstance(ServletContext servletContext) {
  
   if (servletContext == null) {
   throw new IllegalArgumentException(Localizer.getMessage(
  
  org.apache.jasper.compiler.TldCache.servletContextNull));
   }
   return (TldCache)
   servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
   }
 
 
 
  If you can attach a debugger try to see whether the code below is
 invoked:
 
  org.apache.jasper.servlet.JasperInitializer.onStartup(SetClass?,
  ServletContext) {
  .
  context.setAttribute

Re: java.lang.NullPointerException at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) when starting Embedded Tomcat Instance

2015-03-17 Thread Thusitha Thilina Dayaratne
2015-03-17 15:16 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com:

 Hi
 
  Hi Violeta
 
  Hi,
 
  2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne 
thusit...@wso2.com
 :
  
ERROR {org.apache.catalina.core.ApplicationDispatcher} -
Servlet.service() for servlet bridgeservlet threw exception
java.lang.NullPointerException
at
   
   
  
 

org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
at
   
 org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
at
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
at
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
   
snip/
   
I can't figure out the reason to get this NullPointerException.
Can someone help me out?
   
If we knew which version of Tomcat 8 you were using, someone could
  look
at the relevant source code to try to figure out what was going
on.
I'm using tomcat version *8.0.20*
  
   Browse to the sourcecode of v8.0.20 of tomcat here:
  
public TldResourcePath getTldResourcePath(String uri) {
return getOptions().getTldCache().getTldResourcePath(uri);
}
   Thanks for the quick response
  
Obviously either getOptions() or getTldCache() is returning null.
  
   I debug the code as you suggest and found that getTldCache() is null.
   In the code As I understand there are 2 point which set the *tldCache*
variable
   one is the setTldCache() method and other is
   public static TldCache getInstance(ServletContext servletContext) {
  
   if (servletContext == null) {
   throw new IllegalArgumentException(Localizer.getMessage(
  
  org.apache.jasper.compiler.TldCache.servletContextNull));
   }
   return (TldCache)
   servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
   }
 
 
 
  If you can attach a debugger try to see whether the code below is
 invoked:
 
  org.apache.jasper.servlet.JasperInitializer.onStartup(SetClass?,
  ServletContext) {
  .
  context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME,
  new TldCache(context,
 scanner.getUriTldResourcePathMap(),
  scanner.getTldResourcePathTaglibXmlMap()));
  
  }
  I have checked that as well. But that method didn't get hot when I'm
  debugging the source.
  what could be the reason?

 You wrote that you are running an embedded Tomcat. Is that true?
 In Tomcat 8, Jasper initialization is implemented as a standard
 ServletContainderInitializer (check Servlet specification).
 So you should ensure
 that org.apache.jasper.servlet.JasperInitializer.onStartup is invoked
 during web app startup

 Could someone tell me how can I make sure that this method get call during
 the web app startup?

You didn't tell us whether you are embedding Tomcat or not.
Thanks for response and I'm Sorry for missing the info in previous mail.
Yes I'm embedding tomcat version 8.0.20

If you are embedding it which jar files from Tomcat distribution you are
using etc.
I'm using following tomcat jars

   - tomcat-embed-core
   - tomcat-embed-jasper
   - tomcat-websocket-api
   - tomcat-embed-websocket
   - tomcat-jasper


You can start debugging
with org.apache.catalina.startup.ContextConfig.webConfig()

- processServletContainerInitializers(sContext);

Thanks
Regards
Thusitha

On Tue, Mar 17, 2015 at 6:56 PM, Violeta Georgieva miles...@gmail.com
wrote:

 Hi,

 2015-03-17 15:16 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com
 :
 
  Hi
  
   Hi Violeta
  
   Hi,
  
   2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne 
 thusit...@wso2.com
  :
   
 ERROR {org.apache.catalina.core.ApplicationDispatcher} -
 Servlet.service() for servlet bridgeservlet threw exception
 java.lang.NullPointerException
 at


   
  
 

 org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
 at

  org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
 at
 org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
 at
 org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
 at org.apache.jasper.compiler.Parser.parse(Parser.java:139)

 snip/

 I can't figure out the reason to get this NullPointerException.
 Can someone help me out?

 If we knew which version of Tomcat 8 you were using, someone
 could
   look
 at the relevant source code to try to figure out what was going
 on.
 I'm using tomcat version *8.0.20*
   
Browse to the sourcecode of v8.0.20 of tomcat here:
   
 public TldResourcePath getTldResourcePath(String uri) {
 return getOptions().getTldCache().getTldResourcePath(uri);
 }
Thanks for the quick response
   
 Obviously either getOptions() or getTldCache() is returning null.
   
I debug the code as you suggest and found

Re: java.lang.NullPointerException at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) when starting Embedded Tomcat Instance

2015-03-16 Thread Thusitha Thilina Dayaratne
Hi Violeta

Hi,

2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com:

  ERROR {org.apache.catalina.core.ApplicationDispatcher} -
  Servlet.service() for servlet bridgeservlet threw exception
  java.lang.NullPointerException
  at
 
 

org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
  at
  org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
  at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
  at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
 
  snip/
 
  I can't figure out the reason to get this NullPointerException.
  Can someone help me out?
 
  If we knew which version of Tomcat 8 you were using, someone could
look
  at the relevant source code to try to figure out what was going on.
  I'm using tomcat version *8.0.20*

 Browse to the sourcecode of v8.0.20 of tomcat here:

  public TldResourcePath getTldResourcePath(String uri) {
  return getOptions().getTldCache().getTldResourcePath(uri);
  }
 Thanks for the quick response

  Obviously either getOptions() or getTldCache() is returning null.

 I debug the code as you suggest and found that getTldCache() is null.
 In the code As I understand there are 2 point which set the *tldCache*
  variable
 one is the setTldCache() method and other is
 public static TldCache getInstance(ServletContext servletContext) {

 if (servletContext == null) {
 throw new IllegalArgumentException(Localizer.getMessage(

org.apache.jasper.compiler.TldCache.servletContextNull));
 }
 return (TldCache)
 servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
 }



If you can attach a debugger try to see whether the code below is invoked:

org.apache.jasper.servlet.JasperInitializer.onStartup(SetClass?,
ServletContext) {
.
context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME,
new TldCache(context, scanner.getUriTldResourcePathMap(),
scanner.getTldResourcePathTaglibXmlMap()));

}
I have checked that as well. But that method didn't get hot when I'm
debugging the source.
what could be the reason?

Thanks
Regards
Thusitha


On Mon, Mar 16, 2015 at 6:59 PM, Violeta Georgieva miles...@gmail.com
wrote:

 Hi,

 2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com
 :
 
   ERROR {org.apache.catalina.core.ApplicationDispatcher} -
   Servlet.service() for servlet bridgeservlet threw exception
   java.lang.NullPointerException
   at
  
  
 

 org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
   at
   org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
   at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
   at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
   at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
  
   snip/
  
   I can't figure out the reason to get this NullPointerException.
   Can someone help me out?
  
   If we knew which version of Tomcat 8 you were using, someone could
 look
   at the relevant source code to try to figure out what was going on.
   I'm using tomcat version *8.0.20*
 
  Browse to the sourcecode of v8.0.20 of tomcat here:
 
   public TldResourcePath getTldResourcePath(String uri) {
   return getOptions().getTldCache().getTldResourcePath(uri);
   }
  Thanks for the quick response
 
   Obviously either getOptions() or getTldCache() is returning null.
 
  I debug the code as you suggest and found that getTldCache() is null.
  In the code As I understand there are 2 point which set the *tldCache*
   variable
  one is the setTldCache() method and other is
  public static TldCache getInstance(ServletContext servletContext) {
 
  if (servletContext == null) {
  throw new IllegalArgumentException(Localizer.getMessage(
 
 org.apache.jasper.compiler.TldCache.servletContextNull));
  }
  return (TldCache)
  servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
  }



 If you can attach a debugger try to see whether the code below is invoked:

 org.apache.jasper.servlet.JasperInitializer.onStartup(SetClass?,
 ServletContext) {
 .
 context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME,
 new TldCache(context, scanner.getUriTldResourcePathMap(),
 scanner.getTldResourcePathTaglibXmlMap()));

 }


 Regards,
 Violeta

 
   from this 2 methods I couldn't find any point that setTldCache() is been
  used. So I think getInstance() is the method that is been used.
 
  Should I manually set the value o tldCache?
 
  Thanks
  Regards
  /Thusitha




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: java.lang.NullPointerException at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) when starting Embedded Tomcat Instance

2015-03-16 Thread Thusitha Thilina Dayaratne
 ERROR {org.apache.catalina.core.ApplicationDispatcher} -
 Servlet.service() for servlet bridgeservlet threw exception
 java.lang.NullPointerException
 at


org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
 at
 org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
 at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
 at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
 at org.apache.jasper.compiler.Parser.parse(Parser.java:139)

 snip/

 I can't figure out the reason to get this NullPointerException.
 Can someone help me out?

 If we knew which version of Tomcat 8 you were using, someone could look
 at the relevant source code to try to figure out what was going on.
 I'm using tomcat version *8.0.20*

Browse to the sourcecode of v8.0.20 of tomcat here:

 public TldResourcePath getTldResourcePath(String uri) {
 return getOptions().getTldCache().getTldResourcePath(uri);
 }
Thanks for the quick response

 Obviously either getOptions() or getTldCache() is returning null.

I debug the code as you suggest and found that getTldCache() is null.
In the code As I understand there are 2 point which set the *tldCache*
 variable
one is the setTldCache() method and other is
public static TldCache getInstance(ServletContext servletContext) {

if (servletContext == null) {
throw new IllegalArgumentException(Localizer.getMessage(
org.apache.jasper.compiler.TldCache.servletContextNull));
}
return (TldCache)
servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
}

 from this 2 methods I couldn't find any point that setTldCache() is been
used. So I think getInstance() is the method that is been used.

Should I manually set the value o tldCache?

Thanks
Regards
/Thusitha


Re: java.lang.NullPointerException at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) when starting Embedded Tomcat Instance

2015-03-16 Thread Thusitha Thilina Dayaratne
Hi Violeta,

2015-03-16 15:33 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com:

 Hi Violeta

 Hi,

 2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com
:
 
   ERROR {org.apache.catalina.core.ApplicationDispatcher} -
   Servlet.service() for servlet bridgeservlet threw exception
   java.lang.NullPointerException
   at
  
  
 

org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
   at
  
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
   at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
   at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
   at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
  
   snip/
  
   I can't figure out the reason to get this NullPointerException.
   Can someone help me out?
  
   If we knew which version of Tomcat 8 you were using, someone could
 look
   at the relevant source code to try to figure out what was going on.
   I'm using tomcat version *8.0.20*
 
  Browse to the sourcecode of v8.0.20 of tomcat here:
 
   public TldResourcePath getTldResourcePath(String uri) {
   return getOptions().getTldCache().getTldResourcePath(uri);
   }
  Thanks for the quick response
 
   Obviously either getOptions() or getTldCache() is returning null.
 
  I debug the code as you suggest and found that getTldCache() is null.
  In the code As I understand there are 2 point which set the *tldCache*
   variable
  one is the setTldCache() method and other is
  public static TldCache getInstance(ServletContext servletContext) {
 
  if (servletContext == null) {
  throw new IllegalArgumentException(Localizer.getMessage(
 
 org.apache.jasper.compiler.TldCache.servletContextNull));
  }
  return (TldCache)
  servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
  }



 If you can attach a debugger try to see whether the code below is
invoked:

 org.apache.jasper.servlet.JasperInitializer.onStartup(SetClass?,
 ServletContext) {
 .
 context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME,
 new TldCache(context,
scanner.getUriTldResourcePathMap(),
 scanner.getTldResourcePathTaglibXmlMap()));
 
 }
 I have checked that as well. But that method didn't get hot when I'm
 debugging the source.
 what could be the reason?

You wrote that you are running an embedded Tomcat. Is that true?
In Tomcat 8, Jasper initialization is implemented as a standard
ServletContainderInitializer (check Servlet specification).
So you should ensure
that org.apache.jasper.servlet.JasperInitializer.onStartup is invoked
during web app startup
Thanks for the quick response. Could you please tell me how can I do so?

Thanks
Best Regards
/Thusitha

On Mon, Mar 16, 2015 at 7:22 PM, Violeta Georgieva miles...@gmail.com
wrote:

 Hi,


 2015-03-16 15:33 GMT+02:00 Thusitha Thilina Dayaratne thusit...@wso2.com
 :
 
  Hi Violeta
 
  Hi,
 
  2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne 
 thusit...@wso2.com
 :
  
ERROR {org.apache.catalina.core.ApplicationDispatcher} -
Servlet.service() for servlet bridgeservlet threw exception
java.lang.NullPointerException
at
   
   
  
 

 org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
at
   
 org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
at
 org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
at
 org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
   
snip/
   
I can't figure out the reason to get this NullPointerException.
Can someone help me out?
   
If we knew which version of Tomcat 8 you were using, someone could
  look
at the relevant source code to try to figure out what was going on.
I'm using tomcat version *8.0.20*
  
   Browse to the sourcecode of v8.0.20 of tomcat here:
  
public TldResourcePath getTldResourcePath(String uri) {
return getOptions().getTldCache().getTldResourcePath(uri);
}
   Thanks for the quick response
  
Obviously either getOptions() or getTldCache() is returning null.
  
   I debug the code as you suggest and found that getTldCache() is null.
   In the code As I understand there are 2 point which set the *tldCache*
variable
   one is the setTldCache() method and other is
   public static TldCache getInstance(ServletContext servletContext) {
  
   if (servletContext == null) {
   throw new IllegalArgumentException(Localizer.getMessage(
  
  org.apache.jasper.compiler.TldCache.servletContextNull));
   }
   return (TldCache)
   servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME);
   }
 
 
 
  If you can attach a debugger try to see whether the code below is
 invoked:
 
  org.apache.jasper.servlet.JasperInitializer.onStartup(SetClass?,
  ServletContext

java.lang.NullPointerException at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) when starting Embedded Tomcat Instance

2015-03-16 Thread Thusitha Thilina Dayaratne
Hi All,

I'm in the process of migrating embedded tomcat application from Tomcat 7
to Tomcat 8.
When I'm trying to start the embedded instance I'm getting a
NullPointerException
Here is the stacktrace


 ERROR {org.apache.catalina.core.ApplicationDispatcher} -
  Servlet.service() for servlet bridgeservlet threw exception
 java.lang.NullPointerException
 at
 org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
 at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
 at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
 at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
 at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
 at
 org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
 at
 org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
 at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
 at
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:570)
 at
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
 at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at
 org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
 at
 org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
 at
 org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
 at
 org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at
 org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at
 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
 at
 org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
 at
 org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
 at
 org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
 at
 org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.forward(RequestDispatcherAdaptor.java:30)
 at
 org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDispatcherAdaptor.forward(ContextPathServletAdaptor.java:362)
 at
 org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:198)
 at
 org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:185)
 at
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:419)
 at
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370)
 at org.wso2.carbon.ui.action.ActionHelper.render(ActionHelper.java:52)
 at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:101)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at
 org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
 at
 org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
 at
 org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
 at
 org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at
 org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 at
 

Re: java.lang.NullPointerException at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) when starting Embedded Tomcat Instance

2015-03-16 Thread Thusitha Thilina Dayaratne
On 16/03/2015 09:26, Thusitha Thilina Dayaratne wrote:
 Hi All,

 I'm in the process of migrating embedded tomcat application from Tomcat 7
 to Tomcat 8.
 When I'm trying to start the embedded instance I'm getting a
 NullPointerException
 Here is the stacktrace


 ERROR {org.apache.catalina.core.ApplicationDispatcher} -
  Servlet.service() for servlet bridgeservlet threw exception
 java.lang.NullPointerException
 at

org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
 at
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
 at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
 at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
 at org.apache.jasper.compiler.Parser.parse(Parser.java:139)

snip/

 I can't figure out the reason to get this NullPointerException.
 Can someone help me out?

 If we knew which version of Tomcat 8 you were using, someone could look
 at the relevant source code to try to figure out what was going on.
I'm using tomcat version *8.0.20*

Thanks
Thusitha

On Mon, Mar 16, 2015 at 3:07 PM, Mark Thomas ma...@apache.org wrote:

 On 16/03/2015 09:26, Thusitha Thilina Dayaratne wrote:
  Hi All,
 
  I'm in the process of migrating embedded tomcat application from Tomcat 7
  to Tomcat 8.
  When I'm trying to start the embedded instance I'm getting a
  NullPointerException
  Here is the stacktrace
 
 
  ERROR {org.apache.catalina.core.ApplicationDispatcher} -
   Servlet.service() for servlet bridgeservlet threw exception
  java.lang.NullPointerException
  at
 
 org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536)
  at
 org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
  at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430)
  at org.apache.jasper.compiler.Parser.parse(Parser.java:139)

 snip/

  I can't figure out the reason to get this NullPointerException.
  Can someone help me out?

 If we knew which version of Tomcat 8 you were using, someone could look
 at the relevant source code to try to figure out what was going on.

 Hint: Tomcat is open source. You can look at the source code too.

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: How to access JNDI Directory Context in Tomcat 8

2015-03-09 Thread Thusitha Thilina Dayaratne
Hi Mark,

Thanks for the quick response.

Regards
/Thusitha

On Mon, Mar 9, 2015 at 2:29 PM, Mark Thomas ma...@apache.org wrote:

 On 09/03/2015 03:59, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  I want to access the JNDI Directory context in Tomcat8. I've used
  *DirContextURLStreamHandler* class which was in Tomcat 7. But now that
 has
  been removed.
  Can someone tell me how can I access the JNDI Directory Context in
 Tomcat 8?

 Via the standard JNDI API.

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


java.lang.Error: factory already defined when trying to start the Tomcat

2015-03-09 Thread Thusitha Thilina Dayaratne
Hi,

When I'm trying to start the embedded tomcat server I'm getting following
exception. Could someone tell me why am I getting that? Did I missed
anything in configuration?
I'm using JDK 1.8 and tomcat 8.0.20

ERROR {org.apache.catalina.core.ContainerBase} -  A child container failed
 during start
 java.util.concurrent.ExecutionException:
 org.apache.catalina.LifecycleException: Failed to start component
 [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]]
 at java.util.concurrent.FutureTask.report(FutureTask.java:122)
 at java.util.concurrent.FutureTask.get(FutureTask.java:192)
 at
 org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917)
 at
 org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
 at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
 Caused by: org.apache.catalina.LifecycleException: Failed to start
 component
 [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]]
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
 ... 6 more
 Caused by: org.apache.catalina.LifecycleException: Failed to initialize
 component [org.apache.catalina.webresources.StandardRoot@7658b991]
 at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
 at
 org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4840)
 at
 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4970)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 ... 6 more
 Caused by: java.lang.Error: factory already defined
 at java.net.URL.setURLStreamHandlerFactory(URL.java:1105)
 at
 org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.init(TomcatURLStreamHandlerFactory.java:122)
 at
 org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:51)
 at
 org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:75)
 at
 org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:677)
 at
 org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:660)
 at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
 ... 10 more
 [2015-03-09 14:58:45,913] ERROR {org.apache.catalina.core.ContainerBase} -
  A child container failed during start
 java.util.concurrent.ExecutionException:
 org.apache.catalina.LifecycleException: Failed to start component
 [StandardEngine[Catalina].StandardHost[localhost]]
 at java.util.concurrent.FutureTask.report(FutureTask.java:122)
 at java.util.concurrent.FutureTask.get(FutureTask.java:192)
 at
 org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917)
 at
 org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at
 org.wso2.carbon.tomcat.ext.service.ExtendedStandardService.startInternal(ExtendedStandardService.java:49)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at
 org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:769)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at
 org.wso2.carbon.tomcat.internal.CarbonTomcat.start(CarbonTomcat.java:103)
 at
 org.wso2.carbon.tomcat.internal.ServerManager$1.run(ServerManager.java:99)
 at java.lang.Thread.run(Thread.java:745)
 Caused by: org.apache.catalina.LifecycleException: Failed to start
 component [StandardEngine[Catalina].StandardHost[localhost]]
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
 at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
 at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 ... 1 more
 Caused by: org.apache.catalina.LifecycleException: A child container
 failed during start
 at
 org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:925)
 at
 org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 ... 6 more
 [2015-03-09 14:58:45,914] ERROR
 

How to access JNDI Directory Context in Tomcat 8

2015-03-08 Thread Thusitha Thilina Dayaratne
Hi,

I want to access the JNDI Directory context in Tomcat8. I've used
*DirContextURLStreamHandler* class which was in Tomcat 7. But now that has
been removed.
Can someone tell me how can I access the JNDI Directory Context in Tomcat 8?

Thanks
Best Regards
/Thusitha

-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?

2015-03-07 Thread Thusitha Thilina Dayaratne
Hi,

First I would like to apologies for any inconvenience caused.

 I'll ask again. What are you trying to do?
 Difficult to say unless you tell us what problem you're actually trying
to solve rather than yet again what you think should be done to solve it.
I'm using extended class of *DirContextURLStreamHandler* to handle jndi
resources in the application.

Thanks
Best Regards
/Thusitha

On Sat, Mar 7, 2015 at 7:24 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: Thusitha Thilina Dayaratne [mailto:thusit...@wso2.com]
  Subject: Re: Is org.apache.naming.resources package have been removed in
 tomcat 8.0.20?

 Don't top post.  Read the mailing list rules:
 http://tomcat.apache.org/lists.html#tomcat-users

  I'm trying to bundle the tomcat as a OSGI bundle. While doing so, I've
  extended the DirContextURLStreamHandler class and overriding the
  method openConnection(URL
  u)as a public method. Then I'm registering my extended class as a service
  http://tomcat.apache.org/lists.html#tomcat-usersin the bundle context.

  Could someone tell me is that a good approach? If not what is the best
  alternative?

 Difficult to say unless you tell us what problem you're actually trying to
 solve rather than yet again what you think should be done to solve it.  As
 Mark said, read this before replying:
 http://xyproblem.info/

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you
 received this in error, please contact the sender and delete the e-mail and
 its attachments from all computers.


 -Original Message-
 From: Thusitha Thilina Dayaratne [mailto:thusit...@wso2.com]
 Sent: 2015 March 6, Friday 22:25
 To: Tomcat Users List
 Subject: Re: Is org.apache.naming.resources package have been removed in
 tomcat 8.0.20?

 Hi Mark,

 I'm trying to bundle the tomcat as a OSGI bundle. While doing so, I've
 extended the DirContextURLStreamHandler class and overriding the
 method openConnection(URL
 u)as a public method. Then I'm registering my extended class as a service
 in the bundle context.

 Since *org.apache.naming.resource* package have been removed I'm trying to
 use the *WarStreamURLHandler *class in the
 *org.apache.catalina.webresource*
 package and get my work done.

 Could someone tell me is that a good approach? If not what is the best
 alternative?

 Thanks
 Best Regards
 /Thusitha

 On Fri, Mar 6, 2015 at 6:50 PM, Mark Thomas ma...@apache.org wrote:

  On 06/03/2015 10:53, Thusitha Thilina Dayaratne wrote:
   Hi,
  
   Is there an alternative method from some other class that I can use
  instead
   of removed *protected URLConnection openConnection(URL u) *in Tomcat 8?
 
  I'll ask again. What are you trying to do?
 
  Read this: http://xyproblem.info/ before you answer.
 
  Mark
 
 
  
   Thanks
   Regards
   /Thusitha
  
   On Fri, Mar 6, 2015 at 2:57 PM, Thusitha Thilina Dayaratne 
   thusit...@wso2.com wrote:
  
   Hi Mark,
  
   Thanks for your quick response.
   I'm extending that class and overriding the method openConnection(URL
  u)as
   a public method. So I can use it from somewhere else.
  
   Thanks
   Best Regards
   /Thusitha
  
   On Fri, Mar 6, 2015 at 2:53 PM, Mark Thomas ma...@apache.org wrote:
  
   On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote:
   Hi All,
  
   I'm working on migrating embedded tomcat 7 project to latest release
  of
   *tomcat
   8.0.20* When compiling the project, I'm getting compilation errors
   saying
   that *org.apache.naming.resources* package can't be found. (I'm
 using
   *DirContextURLStreamHandler* which was resided in above package in
   tomcat 7)
  
   I've checked the Tomcat API doc too. It seems that the package
 doesn't
   exists there.
   Is that package removed from tomcat 8?
   Yes.
  
   If so what is/are the alternative(s)?
   That depends what you are trying to do.
  
   I couldn't found any source saying that it is been removed or
   deprecated.
   http://tomcat.apache.org/migration-8.html
  
   Mark
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
   For additional commands, e-mail: users-h...@tomcat.apache.org
  
  
  
  
   --
   Thusitha Dayaratne
   Software Engineer
   WSO2 Inc. - lean . enterprise . middleware |  wso2.com
  
   Mobile  +94712756809
   Blog  alokayasoya.blogspot.com
   Abouthttp://about.me/thusithathilina
  
  
  
  
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 


 --
 Thusitha Dayaratne
 Software Engineer
 WSO2 Inc. - lean . enterprise . middleware |  wso2.com

 Mobile  +94712756809
 Blog  alokayasoya.blogspot.com
 Abouthttp://about.me/thusithathilina

Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?

2015-03-06 Thread Thusitha Thilina Dayaratne
Hi Mark,

Thanks for your quick response.
I'm extending that class and overriding the method openConnection(URL u)as
a public method. So I can use it from somewhere else.

Thanks
Best Regards
/Thusitha

On Fri, Mar 6, 2015 at 2:53 PM, Mark Thomas ma...@apache.org wrote:

 On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote:
  Hi All,
 
  I'm working on migrating embedded tomcat 7 project to latest release of
 *tomcat
  8.0.20* When compiling the project, I'm getting compilation errors saying
  that *org.apache.naming.resources* package can't be found. (I'm using
  *DirContextURLStreamHandler* which was resided in above package in
 tomcat 7)
 
  I've checked the Tomcat API doc too. It seems that the package doesn't
  exists there.
  Is that package removed from tomcat 8?
 Yes.

  If so what is/are the alternative(s)?
 That depends what you are trying to do.

  I couldn't found any source saying that it is been removed or deprecated.
 http://tomcat.apache.org/migration-8.html

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Is org.apache.naming.resources package have been removed in tomcat 8.0.20?

2015-03-06 Thread Thusitha Thilina Dayaratne
Hi All,

I'm working on migrating embedded tomcat 7 project to latest release of *tomcat
8.0.20* When compiling the project, I'm getting compilation errors saying
that *org.apache.naming.resources* package can't be found. (I'm using
*DirContextURLStreamHandler* which was resided in above package in tomcat 7)

I've checked the Tomcat API doc too. It seems that the package doesn't
exists there.
Is that package removed from tomcat 8? If so what is/are the alternative(s)
?
I couldn't found any source saying that it is been removed or deprecated.


Thanks
Best Regards
/Thusitha
-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?

2015-03-06 Thread Thusitha Thilina Dayaratne
Hi,

Is there an alternative method from some other class that I can use instead
of removed *protected URLConnection openConnection(URL u) *in Tomcat 8?

Thanks
Regards
/Thusitha

On Fri, Mar 6, 2015 at 2:57 PM, Thusitha Thilina Dayaratne 
thusit...@wso2.com wrote:

 Hi Mark,

 Thanks for your quick response.
 I'm extending that class and overriding the method openConnection(URL u)as
 a public method. So I can use it from somewhere else.

 Thanks
 Best Regards
 /Thusitha

 On Fri, Mar 6, 2015 at 2:53 PM, Mark Thomas ma...@apache.org wrote:

 On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote:
  Hi All,
 
  I'm working on migrating embedded tomcat 7 project to latest release of
 *tomcat
  8.0.20* When compiling the project, I'm getting compilation errors
 saying
  that *org.apache.naming.resources* package can't be found. (I'm using
  *DirContextURLStreamHandler* which was resided in above package in
 tomcat 7)
 
  I've checked the Tomcat API doc too. It seems that the package doesn't
  exists there.
  Is that package removed from tomcat 8?
 Yes.

  If so what is/are the alternative(s)?
 That depends what you are trying to do.

  I couldn't found any source saying that it is been removed or
 deprecated.
 http://tomcat.apache.org/migration-8.html

 Mark


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




 --
 Thusitha Dayaratne
 Software Engineer
 WSO2 Inc. - lean . enterprise . middleware |  wso2.com

 Mobile  +94712756809
 Blog  alokayasoya.blogspot.com
 Abouthttp://about.me/thusithathilina




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?

2015-03-06 Thread Thusitha Thilina Dayaratne
Hi Mark,

I'm trying to bundle the tomcat as a OSGI bundle. While doing so, I've
extended the DirContextURLStreamHandler class and overriding the
method openConnection(URL
u)as a public method. Then I'm registering my extended class as a service
in the bundle context.

Since *org.apache.naming.resource* package have been removed I'm trying to
use the *WarStreamURLHandler *class in the *org.apache.catalina.webresource*
package and get my work done.

Could someone tell me is that a good approach? If not what is the best
alternative?

Thanks
Best Regards
/Thusitha

On Fri, Mar 6, 2015 at 6:50 PM, Mark Thomas ma...@apache.org wrote:

 On 06/03/2015 10:53, Thusitha Thilina Dayaratne wrote:
  Hi,
 
  Is there an alternative method from some other class that I can use
 instead
  of removed *protected URLConnection openConnection(URL u) *in Tomcat 8?

 I'll ask again. What are you trying to do?

 Read this: http://xyproblem.info/ before you answer.

 Mark


 
  Thanks
  Regards
  /Thusitha
 
  On Fri, Mar 6, 2015 at 2:57 PM, Thusitha Thilina Dayaratne 
  thusit...@wso2.com wrote:
 
  Hi Mark,
 
  Thanks for your quick response.
  I'm extending that class and overriding the method openConnection(URL
 u)as
  a public method. So I can use it from somewhere else.
 
  Thanks
  Best Regards
  /Thusitha
 
  On Fri, Mar 6, 2015 at 2:53 PM, Mark Thomas ma...@apache.org wrote:
 
  On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote:
  Hi All,
 
  I'm working on migrating embedded tomcat 7 project to latest release
 of
  *tomcat
  8.0.20* When compiling the project, I'm getting compilation errors
  saying
  that *org.apache.naming.resources* package can't be found. (I'm using
  *DirContextURLStreamHandler* which was resided in above package in
  tomcat 7)
 
  I've checked the Tomcat API doc too. It seems that the package doesn't
  exists there.
  Is that package removed from tomcat 8?
  Yes.
 
  If so what is/are the alternative(s)?
  That depends what you are trying to do.
 
  I couldn't found any source saying that it is been removed or
  deprecated.
  http://tomcat.apache.org/migration-8.html
 
  Mark
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 
 
  --
  Thusitha Dayaratne
  Software Engineer
  WSO2 Inc. - lean . enterprise . middleware |  wso2.com
 
  Mobile  +94712756809
  Blog  alokayasoya.blogspot.com
  Abouthttp://about.me/thusithathilina
 
 
 
 


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina


Tomcat 8 embedded - ERROR {org.apache.catalina.core.ContainerBase} - A child container failed during start

2015-03-06 Thread Thusitha Thilina Dayaratne
Hi All,

I'm using tomcat embedded and when I try to star the server following error
get occurred. I'm using tomcat 8.0.20 and jdk8

ERROR {org.apache.catalina.core.ContainerBase} -  A child container
failed during start
java.util.concurrent.ExecutionException:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start
component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize
component [org.apache.catalina.webresources.StandardRoot@178ad6ef]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
at
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4840)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4970)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Caused by: java.lang.Error: factory already defined
at java.net.URL.setURLStreamHandlerFactory(URL.java:1105)
at
org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.init(TomcatURLStreamHandlerFactory.java:122)
at
org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:51)
at
org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:75)
at
org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:677)
at
org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:660)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
... 10 more
[2015-03-07 10:24:08,114] ERROR
{org.apache.catalina.core.ContainerBase} -  A child container failed during
start
java.util.concurrent.ExecutionException:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.wso2.carbon.tomcat.ext.service.ExtendedStandardService.startInternal(ExtendedStandardService.java:49)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:769)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.wso2.carbon.tomcat.internal.CarbonTomcat.start(CarbonTomcat.java:103)
at
org.wso2.carbon.tomcat.internal.ServerManager$1.run(ServerManager.java:99)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start
component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: org.apache.catalina.LifecycleException: A child container
failed during start
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:925)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)