Archiwa tagu: netbeans

Netbeans nie aktualizuje aplikacji www

Pracując przy aplikacji webowej (napisanej w Javie) natknęłam się na problem nieaktualizowania aplikacji przez Netbeans. Proces kompilacji udawał się, jednak na serwerze nadal była stara zawartość. Z jakiegoś powodu nie udało się zaktualizować kodu.

Rozwiązaniem było ręczne usunięcie folderu web/web-inf/classes. Po usunięciu katalogu i przebudowaniu projektu Netbeans aktualizował zawartość plików.

How to debug remote application on Tomcat

Some time ago I wrote about a situation when starting of Tomcat from Netbeans failed. Of course when someone follows with steps prepared in this article, debugging is more complicated. But there is one nice feature in Tomcat – we can debug remote servers.

First thing to do is to enable debugging applications deployed on Tomcat, start Tomcat by this way:

Tomcat/bin/catalina.bat jpda start

By default, Tomcat is listening on port 8000 (changing default port is possible in some configuration files).

In second step we should connect from Netbeans to our application. Sources in IDE (in my case: Netbeans) must be identical with classes deployed on Tomcat! If there are any differences, some breakpoints will be unavailable and debugging will not working properly.

Go to Debug menu and fill forms:

Debugger: Java Debugger (JPDA)
Connector: SocketAttach
Host: 127.0.0.1
Port: 8000

and click OK. After a while, breakpoints should be available. Look into console. There are info about enabling each breakpoint.

Starting of Tomcat failed

Some day I had problem with deploying project from Netbeans to Tomcat (you may look to similar discussion on StackOverflow: Starting of Tomcat failed from Netbeans 7.3). Unfortunatelly, any of suggestion didn’t help, so I wrote my own deployer in Windows batch.

Some code:


ECHO AutoDeploy to Tomcat

SET tomcat_path=C:\TOMCAT
SET build_path=D:\SVN\SMOK_ELTE\JAVA\amfgw\build\web\WEB-INF\classes

::Stop Tomcat
echo Stop Tomcat, press any key to continue...
pause

netstat -a -n | findstr :8080 > NUL
if %errorlevel%==0 ( goto :stoptomcat ) else ( goto :next )
:stoptomcat
echo Closing Tomcat.
call %tomcat_path%\bin\shutdown.bat
goto :next
:next

::Copy compiled classes from Netbeans to Tomcat
XCOPY %build_path% "%tomcat_path%\webapps\ROOT\WEB-INF\classes" /E /C /R /I /K /Y

::Run Tomcat
CALL %tomcat_path%\bin\catalina.bat jpda start

But I wanted more – let Netbeans run this script after building my application.

Edit build.xml file, located in project directory, by putting these lines:
<target name="-post-compile">
<exec dir="." executable="cmd">
<arg line="/c D:\scriptLocation\deployOnTomcat.bat"/>
</exec>
</target>

Netbeans doesn’t start

Sometimes after installation new plugins to Netbeans, if plugins are not compatible, Netbeans can’t run.  Unfortunatelly, deleting these new files from Netbeans directory didn’t helps. So what can we do?

One thing is to open configuration file and disable new plugin.

In Windows7, go to location:

{drive}:\Users\{yourUserName}\AppData\Roaming\NetBeans\{versionNumber}\config\Modules

and find this file, for example:

org-netbeans-modules-websvc-axis2.xml

Try to disable this plugin by putting „false” in tags:

<param name="autoload">false</param>
<param name="eager">false</param>
<param name="enabled">false</param>

If disabling plugins didn’t helps, try to delete all Netbeans configuration by deleting directories (before deleting, you can make a copy of these files):

{drive}:\Users\{yourUserName}\AppData\Roaming\NetBeans\{versionNumber}\
{drive}:\Users\{yourUserName}\AppData\Local\NetBeans\Cache\{versionNumber}\

Unfortunatelly, this operation removes all configurations (servers, loaded projects and other).