Skip to content

How to Fix NetBeans GlassFish Errors — Server Not Starting

DodaTech Updated 2026-06-24 1 min read

In this tutorial, you'll learn about How to Fix NetBeans GlassFish Errors. We cover key concepts, practical examples, and best practices.

The Problem

GlassFish fails to start from NetBeans:

GlassFish Server: start-domain failed.

or:

Port 4848 is already in use.

Quick Fix

Step 1: Check for port conflicts

sudo lsof -i :4848  # Admin port
sudo lsof -i :8080  # HTTP port
sudo lsof -i :8181  # HTTPS port

If ports are in use, change them in GlassFish:

asadmin set configs.config.server-config.network-config.network-listeners.network-listener.admin-listener.port=4949

Step 2: Register GlassFish with NetBeans

Services > Servers > Add Server > GlassFish Server

Point to the GlassFish installation directory.

Step 3: Create a new domain

asadmin create-domain --portbase 5000 mydomain

Then register the new domain in NetBeans.

Step 4: Fix deployment failures

Clean the build and redeploy:

Right-click project > Clean and Build
Services > Servers > GlassFish > Start
Right-click project > Deploy

Step 5: Increase GlassFish memory

asadmin create-jvm-options -Xmx2048m

Prevention

  • Stop GlassFish from NetBeans before shutting down the IDE.
  • Use unique port bases for multiple GlassFish instances.
  • Monitor GlassFish logs in glassfish/domains/domain1/logs/.

Common Mistakes with glassfish

  1. Forgetting deriving (Show, Eq) on custom data types needed for debugging
  2. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
  3. Using head and tail instead of pattern matching, causing runtime errors on empty lists

These mistakes appear frequently in real-world NETBEANS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the difference between GlassFish and Payara?

Payara is a fork of GlassFish with additional features and patches. Most NetBeans instructions work for both.

How do I reset the GlassFish admin password?

asadmin change-admin-password

You will be prompted for the old password (default is blank).

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro