Results 1 to 11 of 11
Thread: Custome classloader problem
- 04-25-2009, 07:17 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 37
- Rep Power
- 0
Custome classloader problem
Hi i created servlet program in two different context name
1.Myhello
2.Myhello1
but "com.sample.helloworld" both program has same package name and same class name.
so when i compiled it throws linkage error in my custom classloader.
any one can me help to find to solve this error..
- 04-25-2009, 04:53 PM #2
don't give them the same name
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 04-27-2009, 10:43 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 37
- Rep Power
- 0
ya what u said is correct.. i am creating two folder..
named one for myhello and second for myhello1
this is the context name for each servlet.
inside i created com.sample.helloworld.
for both servlet..
i hope u will help me to solve this problem
- 04-27-2009, 11:02 AM #4
Hi ,
Your question is not that clear.just mention the web.xml file entry related to servlet and servlet class code related to imports
- 04-27-2009, 11:18 AM #5
Member
- Join Date
- Apr 2009
- Posts
- 37
- Rep Power
- 0
hi ramyasivakanth..
i am creating one servlet container using osgi framework.. it will be like tomcat server.
if v put the servlet container in webapps folder in tomcat
in my project, we created war folder.
in war folder, we need to put only war files.
i written the code for that war file will automatically extract and then we will see the output in webbrowser.. its normal only..
its working now..
what my doubt means if we put the different war file in war folder in my project.
like myhello and myhello1
but inside the myhello i created com.sample.helloworld and same thing i did in myhello1 also..
this only throwing linkage error..
if u not clear.. ask me
- 04-27-2009, 07:35 PM #6
You cant have two classes with the same name. You'll have to call one com.sample.helloworld1 and the other com.sample.helloworld2 or something.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 04-30-2009, 08:45 AM #7
Member
- Join Date
- Apr 2009
- Posts
- 37
- Rep Power
- 0
i have created two servlet container named sample1 and sample2
i had created same package name for both.
In sample1,
i created one servlet class with package name like com.sample.Hellowrold and /hello1 is alias name
In sample2,
i created one servlet class like com.sample.Hellowrold and /hello2 is alias name.
i need to register the servlet in registerServlet method.
it takes only the first class name.
pls help me to define the registerServlet for this.
see below code in mainThread class
hs = (HttpServlet) cls.newInstance();
System.out.println("war : "+wars[i]+" context:"+contexts[j][0]);
httpService.registerServlet(wars[i]+contexts[j][0],hs, null,null);
output:
war : /sample1 context:/hello
hs : /sample1 com.sample.HelloWorld@16ba008
war : /sample2 context:/hello
hs : /sample2 com.sample.HelloWorld@@9f2cff
sample1 only work..
- 04-30-2009, 03:45 PM #8
Both of the classes are called com.sample.Helloworld. I'm not going to tell you again.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-05-2009, 11:18 AM #9
Member
- Join Date
- Apr 2009
- Posts
- 37
- Rep Power
- 0
Ya correct orangedog..
but in tomcat it will work..
for example
we created to servlet container sample1 and sample2 in tomcat.
sample1 and sample2 are the context name.
we may create com.sample.HelloWorld in both servlet container.
we will put these two folder in tomcat's webapps.
and start the tomcat.
it will work seperately..
how?
in tomcat also getting the class from classloader only..
it works.. y not in my project..
help to solve this problem..
- 05-06-2009, 10:48 AM #10
Member
- Join Date
- Mar 2009
- Posts
- 22
- Rep Power
- 0
- 05-06-2009, 11:26 AM #11
Member
- Join Date
- Apr 2009
- Posts
- 37
- Rep Power
- 0
Similar Threads
-
classloader
By vijayabaskar in forum Advanced JavaReplies: 8Last Post: 04-06-2009, 08:08 AM -
ClassLoader and JVM
By Pradeen in forum New To JavaReplies: 0Last Post: 01-19-2009, 06:04 PM -
Problem of Classloader in Eclipse Plugin Developemt.
By Ashish Naidu in forum EclipseReplies: 0Last Post: 09-12-2008, 10:16 AM -
My own ClassLoader didn't work.
By snooze-g in forum Advanced JavaReplies: 1Last Post: 07-17-2007, 11:12 AM -
eclipse classloader problem
By sandor in forum EclipseReplies: 2Last Post: 05-10-2007, 03:26 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks