Home » Language IDEs » ServerTools (WTP) » Eclipse WTP Web Service, Axis2, and JAR project dependencies
| |
Re: Eclipse WTP Web Service, Axis2, and JAR project dependencies [message #688391 is a reply to message #688383] |
Fri, 24 June 2011 15:48 |
|
On 24-Jun-11 09:33, James Cleland wrote:
> So the more accurate and concise question appears to be: How do you
> build a jar in your workspace, reference it with another project in the
> same workspace, and have the JAR publish to your server. This is what is
> not happening.
> The dependency builds fine. I have an ANT script that automatically
> builds the JAR in the dependency project root directory. The dependant
> project builds fine with the project dependency configured in the Java
> Build Path (Libraries->Add JAR...). I have NOT added the dependency as a
> project reference, just added the JAR and checked it under Java Build
> Path->Order and Export.
> My dependency is missing from the server deployment WEB-INF/lib
> directory. How can I make Eclipse publish this jar to the server? My
> next step is to add it to the deployable project's libraries and build
> the JAR directly into the dependant project, but this seems gross.
At the risk of injecting confusion here, I would not do Add JARs or Add
External JARs from one project to get a JAR created inside another. I
think that might result in a full path in .classpath rendering this file
unportable (so, if you're committing to a version-control system, ...).
Instead, perhaps Build Path -> Libraries -> Web App Libraries? Or just
make any update the JAR from the original project to the consuming one?
On deployment...
I assume you're familiar with Preferences -> Deployment Assembly? That's
how Eclipse gives you control over deployment, however, it's not
necessary if you're not trying to run from within Eclipse and you've got
a separate build solution like ant.
There are many build solutions including pure Eclipse/non-ant, ant,
Maven, Ivy, etc. that will solve this.
This might not be very helpful, but it might be a catalyst to a solution
you come up with. I hope it helps a little.
Russ
|
|
| |
Re: Eclipse WTP Web Service, Axis2, and JAR project dependencies [message #688547 is a reply to message #688528] |
Fri, 24 June 2011 21:54 |
|
On 24-Jun-11 15:22, James Cleland wrote:
> Thank you for the reply. I read your initial comment a few times and I
> understand what you're suggesting: Don't build a JAR in one project and
> add it as a JAR in another. I will remove this and try the web app
> library suggestion that you made.
>
> I'm not sure I understand the second sentence "Or just make any update
> the JAR from the original project to the consuming one?" Let me try
> adding the JAR as a web app first and see what happens.
>
> I've looked into Deployment Assembly, but I wasn't sure it was what I
> wanted. Thank you for pointing this out, I am trying to run this from
> within Eclipse initially for debugging/testing, so maybe I can force
> that JAR to deploy here if nowhere else :)
>
> Again, I appreciate the input.
Sorry, I meant, "Or just make ANT update the JAR from..." Typing is
sometimes a lower motor skill and my brain doesn't notice what I've typed.
|
|
| |
Re: Eclipse WTP Web Service, Axis2, and JAR project dependencies [message #688739 is a reply to message #688566] |
Sat, 25 June 2011 14:57 |
|
So, there are several ways to do JARs in a web application. One is, as
you mention, to copy all of your JARs to WebContent/WEB-INF/lib. Once
you do that, however, there are two additional steps.
First, using Build Path -> Libraries -> Add (internal) JAR, you link
each JAR on that path into the project.
Second, using Preferences -> Deployment Assembly, (I think this has been
discussed) you mark all of those JARs for deployment. Otherwise, despite
that they exist in WebContent/WEB-INF/lib, they aren't deployed in the WAR.
I'm not an Axis guy, so I'll have to punt at this point and hope for
someone else to come along if the is an Axis component to this question.
Best of luck.
|
|
| |
Re: Eclipse WTP Web Service, Axis2, and JAR project dependencies [message #689363 is a reply to message #688739] |
Mon, 27 June 2011 13:54 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
On 6/25/2011 10:57 AM, Russell Bateman wrote:
> So, there are several ways to do JARs in a web application. One is, as
> you mention, to copy all of your JARs to WebContent/WEB-INF/lib. Once
> you do that, however, there are two additional steps.
>
> First, using Build Path -> Libraries -> Add (internal) JAR, you link
> each JAR on that path into the project.
>
> Second, using Preferences -> Deployment Assembly, (I think this has been
> discussed) you mark all of those JARs for deployment. Otherwise, despite
> that they exist in WebContent/WEB-INF/lib, they aren't deployed in the WAR.
>
> I'm not an Axis guy, so I'll have to punt at this point and hope for
> someone else to come along if the is an Axis component to this question.
>
> Best of luck.
These two additional steps should not be necessary for jars placed in
the WebContent/WEB-INF/lib folder of the project. The jars should
automatically get published because they are under "WebContent" and WTP
handling should automatically include them in the Java Build Path as
children of the "Web App Library" classpath container. If this isn't
happening, then there is a bug somewhere.
Cheers,
Larry
|
|
|
Re: Eclipse WTP Web Service, Axis2, and JAR project dependencies [message #689364 is a reply to message #689088] |
Mon, 27 June 2011 13:57 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
On 6/26/2011 3:31 PM, James Cleland wrote:
> Thanks again Russell, I've had luck with the Web Deployment Assembly by
> specifying my JAR project (as a Project, under Add...). The JAR file
> ends up published in the wptwebapps/<project>/WEB-INF/lib directory,
> along with all of the axis2 JARS. My current problem is the following
> exception starting Tomcat from within Eclipse:
>
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
> Caused by: java.lang.NoClassDefFoundError:
> org/apache/axis2/transport/http/AxisServlet
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClassCond(Unknown Source)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> at java.security.SecureClassLoader.defineClass(Unknown Source)
> at
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2733)
>
> at
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
>
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
>
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
>
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClassCond(Unknown Source)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> at java.security.SecureClassLoader.defineClass(Unknown Source)
> at
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2733)
>
> at
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
>
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
>
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
>
> at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
>
> at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
> at
> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350)
>
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4659)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
> at org.apache.catalina.core.StandardService.start(StandardService.java:519)
> at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
> ... 6 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.axis2.transport.http.AxisServlet
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
>
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
>
> ... 33 more
> AxisServlet is defined in axis2-kernel-1.4.1.jar and this file is in
> WEB-INF/lib, so I'm not sure why the exception. Ideas?
Unfortunately, class loading mysteries can be difficult with respect to
guessing their cause, and a bit challenging to debug. Since the JVM
doesn't know where the class will be loaded from, it makes many
different attempts to load it. If one attempt fails, it tries the next
attempt to see if that will succeed. Because the JVM doesn't know which
attempt should have succeeded when they all fail, the real problem often
gets swallowed and you are left with a generic ClassNotFoundException.
During the loading process exceptions routinely get thrown and caught
internally. As a result, your stack trace doesn't show much with
respect to useful clues. You may want to enable logging at TRACE for
"org.apache.catalina.loader.WebappClassLoader". This should give you
more clues about what is actually happening.
Cheers,
Larry
|
|
|
Re: Eclipse WTP Web Service, Axis2, and JAR project dependencies [message #689411 is a reply to message #689363] |
Mon, 27 June 2011 15:38 |
|
On 27-Jun-11 07:54, Larry Isaacs wrote:
> On 6/25/2011 10:57 AM, Russell Bateman wrote:
>> So, there are several ways to do JARs in a web application. One is, as
>> you mention, to copy all of your JARs to WebContent/WEB-INF/lib. Once
>> you do that, however, there are two additional steps.
>>
>> First, using Build Path -> Libraries -> Add (internal) JAR, you link
>> each JAR on that path into the project.
>>
>> Second, using Preferences -> Deployment Assembly, (I think this has been
>> discussed) you mark all of those JARs for deployment. Otherwise, despite
>> that they exist in WebContent/WEB-INF/lib, they aren't deployed in the
>> WAR.
>>
>> I'm not an Axis guy, so I'll have to punt at this point and hope for
>> someone else to come along if the is an Axis component to this question.
>>
>> Best of luck.
>
> These two additional steps should not be necessary for jars placed in
> the WebContent/WEB-INF/lib folder of the project. The jars should
> automatically get published because they are under "WebContent" and WTP
> handling should automatically include them in the Java Build Path as
> children of the "Web App Library" classpath container. If this isn't
> happening, then there is a bug somewhere.
>
> Cheers,
> Larry
I'm glad to hear officially what the score is. This hasn't been my
observation, but then I'd have to be able to swear to the state of a
number of things in whatever project failed to deploy and I can't do
that. It was probably some other fault on my part.
Thanks, Larry.
|
|
|
Re: Eclipse WTP Web Service, Axis2, and JAR project dependencies [message #689520 is a reply to message #689411] |
Mon, 27 June 2011 18:50 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
On 6/27/2011 11:38 AM, Russell Bateman wrote:
> On 27-Jun-11 07:54, Larry Isaacs wrote:
>> On 6/25/2011 10:57 AM, Russell Bateman wrote:
>>> So, there are several ways to do JARs in a web application. One is, as
>>> you mention, to copy all of your JARs to WebContent/WEB-INF/lib. Once
>>> you do that, however, there are two additional steps.
>>>
>>> First, using Build Path -> Libraries -> Add (internal) JAR, you link
>>> each JAR on that path into the project.
>>>
>>> Second, using Preferences -> Deployment Assembly, (I think this has been
>>> discussed) you mark all of those JARs for deployment. Otherwise, despite
>>> that they exist in WebContent/WEB-INF/lib, they aren't deployed in the
>>> WAR.
>>>
>>> I'm not an Axis guy, so I'll have to punt at this point and hope for
>>> someone else to come along if the is an Axis component to this question.
>>>
>>> Best of luck.
>>
>> These two additional steps should not be necessary for jars placed in
>> the WebContent/WEB-INF/lib folder of the project. The jars should
>> automatically get published because they are under "WebContent" and WTP
>> handling should automatically include them in the Java Build Path as
>> children of the "Web App Library" classpath container. If this isn't
>> happening, then there is a bug somewhere.
>>
>> Cheers,
>> Larry
>
> I'm glad to hear officially what the score is. This hasn't been my
> observation, but then I'd have to be able to swear to the state of a
> number of things in whatever project failed to deploy and I can't do
> that. It was probably some other fault on my part.
>
> Thanks, Larry.
On very rare occasions I've see publishing go wrong somehow, but too
infrequently to get much of a handle on what isn't right. I've wondered
if the problem is in the publishing or whether WTP has somehow gotten
the "list" of what is in the project incorrect. If "Clean..." doesn't
fix it, that would suggest the latter. If it happens more reliably for
you, I would be curious if closing and re-opening the project would
straighten out the publishing.
Cheers,
Larry
|
|
|
Goto Forum:
Current Time: Thu Sep 19 19:12:59 GMT 2024
Powered by FUDForum. Page generated in 0.04617 seconds
|