Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Could not publish to the server(Problem occurs when I try to publish my web project)
Could not publish to the server [message #1000425] Mon, 14 January 2013 18:38 Go to next message
Paulo Vitor Braga Pessoa is currently offline Paulo Vitor Braga Pessoa
Messages: 2
Registered: January 2013
Junior Member
Hi everybody,

When I try to publish one simple web project in tomcat 7 server, the wtp gives me a nullpointer with the following stacktrace:

java.lang.NullPointerException
	at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:331)
	at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:367)
	at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:367)
	at org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour.publishDir(TomcatServerBehaviour.java:348)
	at org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour.publishModule(TomcatServerBehaviour.java:268)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:1046)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1138)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:955)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
	at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3108)
	at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)


I have tried to remove server and add again, even update eclipse!

This error never happens to me before, can you help-me?

Sorry for my bad english.

Additional information:

eclipse.buildId=M20120914-1800
java.version=1.6.0_29
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=pt_BR

Re: Could not publish to the server [message #1000487 is a reply to message #1000425] Mon, 14 January 2013 21:42 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
On 1/14/2013 2:39 PM, Paulo Vitor Braga Pessoa wrote:
> Hi everybody,
>
> When I try to publish one simple web project in tomcat 7 server, the wtp
> gives me a nullpointer with the following stacktrace:
>
>
> java.lang.NullPointerException
> at
> org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:331)
>
> at
> org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:367)
>
> at
> org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:367)
>
> at
> org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour.publishDir(TomcatServerBehaviour.java:348)
>
> at
> org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour.publishModule(TomcatServerBehaviour.java:268)
>
> at
> org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:1046)
>
> at
> org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1138)
>
> at
> org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:955)
>
> at
> org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
>
> at
> org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3108)
> at
> org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
>
>
> I have tried to remove server and add again, even update eclipse!
>
> This error never happens to me before, can you help-me?
>
> Sorry for my bad english.
>
> Additional information:
>
> eclipse.buildId=M20120914-1800
> java.version=1.6.0_29
> java.vendor=Apple Inc.
> BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=pt_BR
>
>

It's not clear exactly what scenario brings about this NPE. Does
right-clicking on the Tomcat 7 server in the Servers view and executing
"Clean..." able to get past this error?

Cheers,
Larry
Re: Could not publish to the server [message #1000768 is a reply to message #1000487] Tue, 15 January 2013 12:05 Go to previous messageGo to next message
Paulo Vitor Braga Pessoa is currently offline Paulo Vitor Braga Pessoa
Messages: 2
Registered: January 2013
Junior Member
Larry Isaacs wrote on Mon, 14 January 2013 16:42


It's not clear exactly what scenario brings about this NPE. Does
right-clicking on the Tomcat 7 server in the Servers view and executing
"Clean..." able to get past this error?

Cheers,
Larry


So, when I do this, the same NPE occurs. I tried to re-build the project and clean de work directory of tomcat too. Nothing of this actions works for me.

Thank you for the answer!

Paulo
Re: Could not publish to the server [message #1002407 is a reply to message #1000768] Fri, 18 January 2013 14:17 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
On 1/15/2013 7:05 AM, Paulo Vitor Braga Pessoa wrote:
> Larry Isaacs wrote on Mon, 14 January 2013 16:42
>> It's not clear exactly what scenario brings about this NPE. Does
>> right-clicking on the Tomcat 7 server in the Servers view and
>> executing "Clean..." able to get past this error?
>>
>> Cheers,
>> Larry
>
>
> So, when I do this, the same NPE occurs. I tried to re-build the project
> and clean de work directory of tomcat too. Nothing of this actions works
> for me.
>
> Thank you for the answer!
>
> Paulo
>

I've inspected the code and I have no good guesses as to what is causing
you to encounter the NPE. It's not something I've ever seen. The stack
trace indicates that you have selected "Use Tomcat installation...". Do
you get the same behavior with "Use workspace metadata..."?

Cheers,
Larry
Re: Could not publish to the server [message #1224802 is a reply to message #1002407] Fri, 27 December 2013 20:42 Go to previous messageGo to next message
Lisias Toledo is currently offline Lisias Toledo
Messages: 1
Registered: December 2013
Junior Member
I just get this exact misbehaviour with Kepler Build id: 20130919-0819 . Stack trace belows.

It's something on the workspace? The project was being published all-right for months. without any problems. And then, for no apparent reason, this error start to popup from nowhere.

I deleted the server from workspace, recreated and no go.

I deleted org.eclipse.wst.xml.core from .metadata\.plugins . It was recreated, but no go.

I even deleted every org.eclipse.wst.* on .plugins. No go.

It appears to be a regression from https://bugs.eclipse.org/bugs/show_bug.cgi?id=219627

Should I reopen the bug?

java.lang.NullPointerException
	at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:331)
	at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:188)
	at org.eclipse.jst.server.generic.core.internal.publishers.AbstractModuleAssembler.copyModule(AbstractModuleAssembler.java:170)
	at org.eclipse.jst.server.generic.core.internal.publishers.EarModuleAssembler.assemble(EarModuleAssembler.java:45)
	at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.assembleModule(AntPublisher.java:169)
	at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.publish(AntPublisher.java:130)
	at org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour.publishModule(GenericServerBehaviour.java:82)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:1091)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1183)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:987)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
	at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3153)
	at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Re: Could not publish to the server [message #1225766 is a reply to message #1224802] Mon, 30 December 2013 18:38 Go to previous message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
On 12/28/2013 1:08 PM, Lisias Toledo wrote:
> I just get this exact misbehaviour with Kepler Build id: 20130919-0819 .
> Stack trace belows.
>
> It's something on the workspace? The project was being published
> all-right for months. without any problems. And then, for no apparent
> reason, this error start to popup from nowhere.
>
> I deleted the server from workspace, recreated and no go.
>
> I deleted org.eclipse.wst.xml.core from .metadata\.plugins . It was
> recreated, but no go.
>
> I even deleted every org.eclipse.wst.* on .plugins. No go.
>
> It appears to be a regression from
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=219627
>
> Should I reopen the bug?
>
> java.lang.NullPointerException
> at
> org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:331)
>

This is a different bug since the NPE is at a different location. The
code for your NPE is:

long mod = -1;
IFile file = (IFile) mf.getAdapter(IFile.class);
if (file != null) {
mod = file.getLocalTimeStamp();
} else {
File file2 = (File) mf.getAdapter(File.class);
mod = file2.lastModified(); // Line 331
}

The code is trying to determine the modified date of a file resource in
your project, which is why deleting things under the ".metadata" folder
didn't help. It would seem that a resource in your project that is
expected to be a file somehow isn't, or is corrupted in some way.

Unfortunately the code offers nothing in the way of diagnostic help
beyond the NPE. If you aren't able to guess which resource is the
problem, I would suggest you create a separate workspace and in that
workspace create a simple dummy plug-in project. Run this plug-in
project in debug mode and import your dynamic web project into the
workspace it creates. Set up your server and set a breakpoint on
NullPointerException. Then try to publish and hopefully you will be
able to tell from the "mf" variable what resource is causing the
problem. There might be other "normal" NPEs that occur before hitting
line 331 of PublishHelper. Source for PublishHelper can be obtained
from the the link[1] below.

Cheers,
Larry

[1]
http://git.eclipse.org/c/servertools/webtools.servertools.git/tree/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/PublishHelper.java
Previous Topic:Generating WS Client from WSDL gives faulty code
Next Topic:WYSIWYG functionality available?
Goto Forum:
  


Current Time: Fri Oct 31 07:05:38 GMT 2014

Powered by FUDForum. Page generated in 0.14915 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software