This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 200132
Collapse All | Expand All

(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java (-2 / +34 lines)
Lines 156-161 Link Here
156
                // dom4j.jar library for JBoss Application Server 4.0.5
156
                // dom4j.jar library for JBoss Application Server 4.0.5
157
                domFile = new File(domainRoot, JBPluginUtils.LIB + "dom4j.jar"); // NOI18N
157
                domFile = new File(domainRoot, JBPluginUtils.LIB + "dom4j.jar"); // NOI18N
158
            }
158
            }
159
160
            String sep = File.separator;
161
            if (!domFile.exists() && "7".equals(JBVer.getMajorNumber())) {
162
                domFile = new File(serverRoot, JBPluginUtils.MODULES + "org" + sep + "dom4j" + sep + "main" + sep + "dom4j-1.6.1.jar"); // NOI18N
163
            }
159
            if (!domFile.exists()) {
164
            if (!domFile.exists()) {
160
                domFile = null;
165
                domFile = null;
161
                LOGGER.log(Level.INFO, "No dom4j.jar availabale on classpath"); // NOI18N
166
                LOGGER.log(Level.INFO, "No dom4j.jar availabale on classpath"); // NOI18N
Lines 179-185 Link Here
179
                urlList.add(domFile.toURI().toURL());
184
                urlList.add(domFile.toURI().toURL());
180
            }
185
            }
181
186
182
            if  (version5Above) {
187
            if ("7".equals(JBVer.getMajorNumber())) {
188
               
189
                File org = new File(serverRoot, JBPluginUtils.MODULES + "org");
190
                File jboss = new File(org, "jboss");
191
                File as = new File(jboss, "as");
192
                String versionString = JBVer.getMajorNumber()+"."+JBVer.getMinorNumber()+"."+JBVer.getMicroNumber()+"."+JBVer.getUpdate();
193
                
194
                if (domFile.exists()) {
195
                    urlList.add(domFile.toURI().toURL());
196
                }
197
                
198
                urlList.add(new File(serverRoot, "jboss-modules.jar").toURI().toURL());
199
                urlList.add(new File(serverRoot, "bin"+sep+"client"+sep+"jboss-client.jar").toURI().toURL());
200
                urlList.add(new File(jboss, "logging" + sep + "main" + sep + "jboss-logging-3.1.0.GA.jar").toURI().toURL());
201
                urlList.add(new File(jboss, "threads" + sep + "main" + sep + "jboss-threads-2.0.0.GA.jar").toURI().toURL());
202
                urlList.add(new File(jboss, "remoting3" + sep + "main" + sep + "jboss-remoting-3.2.3.GA.jar").toURI().toURL());
203
                urlList.add(new File(jboss, "xnio" + sep + "main" + sep + "xnio-api-3.0.3.GA.jar").toURI().toURL());
204
                urlList.add(new File(jboss, "msc" + sep + "main" + sep + "jboss-msc-1.0.2.GA.jar").toURI().toURL());
205
                urlList.add(new File(as, "ee" + sep + "deployment" + sep + "main" + sep + "jboss-as-ee-deployment-" + versionString + ".jar").toURI().toURL());
206
                urlList.add(new File(as, "naming" + sep + "main" + sep + "jboss-as-naming-" + versionString + ".jar").toURI().toURL());
207
                urlList.add(new File(as, "controller-client" + sep + "main" + sep + "jboss-as-controller-client-" + versionString + ".jar").toURI().toURL());
208
                urlList.add(new File(as, "protocol" + sep + "main" + sep + "jboss-as-protocol-" + versionString + ".jar").toURI().toURL());
209
            } else if (version5Above) {
183
                // get lient class path for Jboss 5.0
210
                // get lient class path for Jboss 5.0
184
                List<URL> clientClassUrls = JBPluginUtils.getJB5ClientClasspath(
211
                List<URL> clientClassUrls = JBPluginUtils.getJB5ClientClasspath(
185
                        serverRoot);
212
                        serverRoot);
Lines 274-282 Link Here
274
                    jbossFactory = (DeploymentFactory) FACTORIES_CACHE.get(ip);
301
                    jbossFactory = (DeploymentFactory) FACTORIES_CACHE.get(ip);
275
                }
302
                }
276
                if (jbossFactory == null) {
303
                if (jbossFactory == null) {
304
                    Version version = JBPluginUtils.getServerVersion(new File(jbossRoot));
277
                    URLClassLoader loader = (ip != null) ? getJBClassLoader(ip) : createJBClassLoader(jbossRoot, domainRoot);
305
                    URLClassLoader loader = (ip != null) ? getJBClassLoader(ip) : createJBClassLoader(jbossRoot, domainRoot);
278
                    jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.deployment.spi.factories.DeploymentFactoryImpl").newInstance();//NOI18N
279
306
307
                    if (version != null && "7".equals(version.getMajorNumber())) { // NOI18N
308
                        jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.as.ee.deployment.spi.factories.DeploymentFactoryImpl").newInstance(); // NOI18N
309
                    } else {
310
                        jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.deployment.spi.factories.DeploymentFactoryImpl").newInstance(); // NOI18N
311
                    }
280
                    
312
                    
281
                    if (ip != null) {
313
                    if (ip != null) {
282
                        FACTORIES_CACHE.put(ip, jbossFactory);
314
                        FACTORIES_CACHE.put(ip, jbossFactory);
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentManager.java (-8 / +22 lines)
Lines 78-83 Link Here
78
import javax.naming.NamingException;
78
import javax.naming.NamingException;
79
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginProperties;
79
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginProperties;
80
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils;
80
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils;
81
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version;
81
82
82
/**
83
/**
83
 *
84
 *
Lines 177-184 Link Here
177
                System.setProperty(JAVA_SEC_AUTH_LOGIN_CONF, securityConf.getAbsolutePath()); // NOI18N
178
                System.setProperty(JAVA_SEC_AUTH_LOGIN_CONF, securityConf.getAbsolutePath()); // NOI18N
178
            }
179
            }
179
180
180
            // Gets naming context
181
            Version version = props.getServerVersion();
181
            ctx = new InitialContext(env);
182
            if(version == null || !"7".equals(version.getMajorNumber())) { // NOI18N
183
                // Gets naming context
184
                ctx = new InitialContext(env);
185
            }
182
186
183
            //restore java.security.auth.login.config system property
187
            //restore java.security.auth.login.config system property
184
            if (oldAuthConf != null) {
188
            if (oldAuthConf != null) {
Lines 189-211 Link Here
189
193
190
            MBeanServerConnection rmiServer = null;
194
            MBeanServerConnection rmiServer = null;
191
            try {
195
            try {
192
                conn = JMXConnectorFactory.connect(new JMXServiceURL(
196
                JMXServiceURL url;
193
                        "service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi"));
197
                if(version != null && "7".equals(version.getMajorNumber())) { // NOI18N
198
                    // using management-native port
199
                    url = new JMXServiceURL(
200
                            System.getProperty("jmx.service.url","service:jmx:remoting-jmx://localhost:9999")); // NOI18N
201
                } else {
202
                    url = new JMXServiceURL(
203
                            "service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi"); // NOI18N
204
                }
205
                conn = JMXConnectorFactory.connect(url);
194
206
195
                rmiServer = conn.getMBeanServerConnection();
207
                rmiServer = conn.getMBeanServerConnection();
196
            } catch (IOException ex) {
208
            } catch (IOException ex) {
197
                LOGGER.log(Level.FINE, null, ex);
209
                LOGGER.log(Level.FINE, null, ex);
198
            }
210
            }
199
211
200
            if (rmiServer == null) {
212
            if (rmiServer == null && ctx != null) {
201
                // Lookup RMI Adaptor
213
                // Lookup RMI Adaptor
202
                rmiServer = (MBeanServerConnection) ctx.lookup("/jmx/invoker/RMIAdaptor"); // NOI18N
214
                rmiServer = (MBeanServerConnection) ctx.lookup("/jmx/invoker/RMIAdaptor"); // NOI18N
203
            }
215
            }
204
216
205
            JBoss5ProfileServiceProxy profileService = null;
217
            JBoss5ProfileServiceProxy profileService = null;
206
            Object service = ctx.lookup("ProfileService"); // NOI18N
218
            if (ctx != null) {
207
            if (service != null) {
219
                Object service = ctx.lookup("ProfileService"); // NOI18N
208
                profileService = new JBoss5ProfileServiceProxy(service);
220
                if (service != null) {
221
                    profileService = new JBoss5ProfileServiceProxy(service);
222
                }
209
            }
223
            }
210
224
211
            return action.action(rmiServer, profileService);
225
            return action.action(rmiServer, profileService);
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBOutputSupport.java (-2 / +3 lines)
Lines 309-318 Link Here
309
                    || line.indexOf("Starting JBossAS") > -1) { // JBoss 6.0 message // NOI18N
309
                    || line.indexOf("Starting JBossAS") > -1) { // JBoss 6.0 message // NOI18N
310
                LOGGER.log(Level.FINER, "STARTING message fired"); // NOI18N
310
                LOGGER.log(Level.FINER, "STARTING message fired"); // NOI18N
311
                //fireStartProgressEvent(StateType.RUNNING, createProgressMessage("MSG_START_SERVER_IN_PROGRESS")); // NOI18N
311
                //fireStartProgressEvent(StateType.RUNNING, createProgressMessage("MSG_START_SERVER_IN_PROGRESS")); // NOI18N
312
            } else if ((line.indexOf("JBoss (MX MicroKernel)") > -1 // JBoss 4.x message // NOI18N
312
            } else if ( ((line.indexOf("JBoss (MX MicroKernel)") > -1 // JBoss 4.x message // NOI18N
313
                    || line.indexOf("JBoss (Microcontainer)") > -1 // JBoss 5.0 message // NOI18N
313
                    || line.indexOf("JBoss (Microcontainer)") > -1 // JBoss 5.0 message // NOI18N
314
                    || line.indexOf("JBossAS") > -1) // JBoss 6.0 message // NOI18N
314
                    || line.indexOf("JBossAS") > -1) // JBoss 6.0 message // NOI18N
315
                    && line.indexOf("Started in") > -1) { // NOI18N
315
                    && line.indexOf("Started in") > -1) 
316
                    || line.indexOf("JBoss AS") > -1 && line.indexOf("started in") > -1) { // NOI18N
316
                LOGGER.log(Level.FINER, "STARTED message fired"); // NOI18N
317
                LOGGER.log(Level.FINER, "STARTED message fired"); // NOI18N
317
318
318
                synchronized (JBOutputSupport.this) {
319
                synchronized (JBOutputSupport.this) {
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java (-3 / +13 lines)
Lines 79-84 Link Here
79
import org.openide.util.Utilities;
79
import org.openide.util.Utilities;
80
import org.openide.util.lookup.Lookups;
80
import org.openide.util.lookup.Lookups;
81
import org.openide.windows.InputOutput;
81
import org.openide.windows.InputOutput;
82
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version;
82
83
83
/**
84
/**
84
 *
85
 *
Lines 100-107 Link Here
100
101
101
    private final static String STARTUP_SH = File.separator + 
102
    private final static String STARTUP_SH = File.separator + 
102
            "bin" + File.separator + "run.sh";          // NOI18N
103
            "bin" + File.separator + "run.sh";          // NOI18N
104
    private final static String STANDALONE_SH = File.separator + 
105
            "bin" + File.separator + "standalone.sh";          // NOI18N
103
    private final static String STARTUP_BAT = File.separator + 
106
    private final static String STARTUP_BAT = File.separator + 
104
            "bin" + File.separator + RUN_FILE_NAME;     // NOI18N
107
            "bin" + File.separator + RUN_FILE_NAME;     // NOI18N
108
    private final static String STANDALONE_BAT = File.separator + 
109
            "bin" + File.separator + "standalone.bat";     // NOI18N
105
                             
110
                             
106
    private final static String CONF_BAT = File.separator + 
111
    private final static String CONF_BAT = File.separator + 
107
            "bin" + File.separator + CONF_FILE_NAME;    // NOI18N
112
            "bin" + File.separator + CONF_FILE_NAME;    // NOI18N
Lines 316-322 Link Here
316
321
317
        final String instanceName = ip.getProperty(JBPluginProperties.PROPERTY_SERVER);
322
        final String instanceName = ip.getProperty(JBPluginProperties.PROPERTY_SERVER);
318
        String args = ("all".equals(instanceName) ? "-b 127.0.0.1 " : "") + "-c " + instanceName; // NOI18N
323
        String args = ("all".equals(instanceName) ? "-b 127.0.0.1 " : "") + "-c " + instanceName; // NOI18N
319
        return new NbProcessDescriptor(serverRunFileName, args);
324
        return new NbProcessDescriptor(serverRunFileName, isJBoss7()? "" : args);
320
    }
325
    }
321
    
326
    
322
    private String getRunFileName( InstanceProperties ip, String[] envp ){
327
    private String getRunFileName( InstanceProperties ip, String[] envp ){
Lines 351-363 Link Here
351
            Logger.getLogger("global").log(Level.INFO, null, ioe);
356
            Logger.getLogger("global").log(Level.INFO, null, ioe);
352
357
353
            final String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR);
358
            final String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR);
354
            final String serverRunFileName = serverLocation + (Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH);
359
            final String serverRunFileName = serverLocation + (isJBoss7() ? Utilities.isWindows() ? STANDALONE_BAT : STANDALONE_SH : Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH);
355
            fireStartProgressEvent(StateType.FAILED, createProgressMessage("MSG_START_SERVER_FAILED_PD", serverRunFileName));
360
            fireStartProgressEvent(StateType.FAILED, createProgressMessage("MSG_START_SERVER_FAILED_PD", serverRunFileName));
356
361
357
            return null;
362
            return null;
358
        }
363
        }
359
    }
364
    }
360
    
365
    
366
    private boolean isJBoss7() {
367
        Version serverVersion = dm.getProperties().getServerVersion();
368
        return serverVersion!=null && "7".equals(serverVersion.getMajorNumber());
369
    }
370
    
361
    private InputOutput openConsole() {
371
    private InputOutput openConsole() {
362
        InputOutput io = UISupport.getServerIO(dm.getUrl());
372
        InputOutput io = UISupport.getServerIO(dm.getUrl());
363
        if (io == null) {
373
        if (io == null) {
Lines 414-420 Link Here
414
            String serverLocation = getProperties().getProperty(
424
            String serverLocation = getProperties().getProperty(
415
                    JBPluginProperties.PROPERTY_ROOT_DIR);
425
                    JBPluginProperties.PROPERTY_ROOT_DIR);
416
            String serverRunFileName = serverLocation + 
426
            String serverRunFileName = serverLocation + 
417
                (Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH);
427
                    (isJBoss7() ? Utilities.isWindows() ? STANDALONE_BAT : STANDALONE_SH : Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH);
418
            if ( needChange ){
428
            if ( needChange ){
419
                String contentRun = readFile(serverRunFileName);
429
                String contentRun = readFile(serverRunFileName);
420
                String contentConf = readFile(serverLocation + CONF_BAT);
430
                String contentConf = readFile(serverLocation + CONF_BAT);
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java (-14 / +26 lines)
Lines 75-80 Link Here
75
import javax.management.MBeanServerConnection;
75
import javax.management.MBeanServerConnection;
76
import org.netbeans.modules.j2ee.jboss4.JBRemoteAction;
76
import org.netbeans.modules.j2ee.jboss4.JBRemoteAction;
77
import org.netbeans.modules.j2ee.jboss4.JBoss5ProfileServiceProxy;
77
import org.netbeans.modules.j2ee.jboss4.JBoss5ProfileServiceProxy;
78
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version;
78
import org.openide.util.NbBundle;
79
import org.openide.util.NbBundle;
79
import org.netbeans.modules.j2ee.jboss4.nodes.Util;
80
import org.netbeans.modules.j2ee.jboss4.nodes.Util;
80
81
Lines 249-270 Link Here
249
250
250
                        @Override
251
                        @Override
251
                        public Void action(MBeanServerConnection connection, JBoss5ProfileServiceProxy profileService) throws Exception {
252
                        public Void action(MBeanServerConnection connection, JBoss5ProfileServiceProxy profileService) throws Exception {
252
                            Object serverName = Util.getMBeanParameter(connection, "ServerName", "jboss.system:type=ServerConfig"); //NOI18N
253
                            Object serverName = null;
253
                            Object serverHome = Util.getMBeanParameter(connection, "ServerHomeLocation", "jboss.system:type=ServerConfig"); //NOI18N
254
                            Object serverHome = null;
254
                            boolean isJBoss6 = serverHome != null;
255
                            Version version = dm.getProperties().getServerVersion();
255
                            if (!isJBoss6) {
256
                            if (version != null && "7".equals(version.getMajorNumber())) { // NOI18N
256
                                serverHome = Util.getMBeanParameter(connection, "ServerHomeDir", "jboss.system:type=ServerConfig"); //NOI18N
257
                                serverHome = Util.getMBeanParameter(connection, "baseDir", "jboss.as:core-service=server-environment"); //NOI18N
257
                            }
258
                                serverName = Util.getMBeanParameter(connection, "launchType", "jboss.as:core-service=server-environment"); //NOI18N
258
                            try {
259
                                if (serverName != null) {
259
                                if (serverHome != null) {
260
                                    serverName = serverName.toString().toLowerCase();
260
                                    if (isJBoss6) {
261
                                }
261
                                        serverHome = new File(((URL) serverHome).toURI()).getAbsolutePath();
262
                            } else {
262
                                    } else {
263
                                serverName = Util.getMBeanParameter(connection, "ServerName", "jboss.system:type=ServerConfig"); //NOI18N
263
                                        serverHome = ((File) serverHome).getAbsolutePath();
264
                                serverHome = Util.getMBeanParameter(connection, "ServerHomeLocation", "jboss.system:type=ServerConfig"); //NOI18N
265
                                boolean isJBoss6 = serverHome != null;
266
                                if (!isJBoss6) {
267
                                    serverHome = Util.getMBeanParameter(connection, "ServerHomeDir", "jboss.system:type=ServerConfig"); //NOI18N
268
                                }
269
                                try {
270
                                    if (serverHome != null) {
271
                                        if (isJBoss6) {
272
                                            serverHome = new File(((URL) serverHome).toURI()).getAbsolutePath();
273
                                        } else {
274
                                            serverHome = ((File) serverHome).getAbsolutePath();
275
                                        }
264
                                    }
276
                                    }
277
                                } catch (URISyntaxException use) {
278
                                    LOGGER.log(Level.WARNING, "error getting file from URI: " + serverHome, use); //NOI18N
265
                                }
279
                                }
266
                            } catch (URISyntaxException use) {
267
                                LOGGER.log(Level.WARNING, "error getting file from URI: " + serverHome, use); //NOI18N
268
                            }
280
                            }
269
281
270
                            if (serverName == null || serverHome == null) {
282
                            if (serverName == null || serverHome == null) {
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStopRunnable.java (-3 / +14 lines)
Lines 77-83 Link Here
77
    private static final Logger LOGGER = Logger.getLogger(JBStopRunnable.class.getName());
77
    private static final Logger LOGGER = Logger.getLogger(JBStopRunnable.class.getName());
78
    
78
    
79
    private static final String SHUTDOWN_SH = "/bin/shutdown.sh"; // NOI18N
79
    private static final String SHUTDOWN_SH = "/bin/shutdown.sh"; // NOI18N
80
    private static final String JBOSS_CLI_SH = "/bin/jboss-cli.sh"; // NOI18N
80
    private static final String SHUTDOWN_BAT = "/bin/shutdown.bat"; // NOI18N
81
    private static final String SHUTDOWN_BAT = "/bin/shutdown.bat"; // NOI18N
82
    private static final String JBOSS_CLI_BAT = "/bin/jboss-cli.bat"; // NOI18N
81
83
82
    private static final int TIMEOUT = 300000;
84
    private static final int TIMEOUT = 300000;
83
    
85
    
Lines 89-94 Link Here
89
        this.startServer = startServer;
91
        this.startServer = startServer;
90
    }
92
    }
91
    
93
    
94
    private boolean isJBoss7() {
95
        JBPluginUtils.Version serverVersion = dm.getProperties().getServerVersion();
96
        return serverVersion!=null && "7".equals(serverVersion.getMajorNumber());
97
    }
98
    
92
    private String[] createEnvironment() {
99
    private String[] createEnvironment() {
93
        
100
        
94
        JBProperties properties = dm.getProperties();
101
        JBProperties properties = dm.getProperties();
Lines 120-126 Link Here
120
        String serverName = ip.getProperty(InstanceProperties.DISPLAY_NAME_ATTR);
127
        String serverName = ip.getProperty(InstanceProperties.DISPLAY_NAME_ATTR);
121
128
122
        String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR);
129
        String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR);
123
        String serverStopFileName = serverLocation + (Utilities.isWindows() ? SHUTDOWN_BAT : SHUTDOWN_SH);
130
        String serverStopFileName = serverLocation + (isJBoss7() ? Utilities.isWindows() ? JBOSS_CLI_BAT : JBOSS_CLI_SH :Utilities.isWindows() ? SHUTDOWN_BAT : SHUTDOWN_SH);
124
131
125
        File serverStopFile = new File(serverStopFileName);
132
        File serverStopFile = new File(serverStopFileName);
126
        if (!serverStopFile.exists()){
133
        if (!serverStopFile.exists()){
Lines 131-136 Link Here
131
        JBProperties properties = dm.getProperties();
138
        JBProperties properties = dm.getProperties();
132
        StringBuilder additionalParams = new StringBuilder(32);
139
        StringBuilder additionalParams = new StringBuilder(32);
133
        int jnpPort = JBPluginUtils.getJnpPortNumber(ip.getProperty(JBPluginProperties.PROPERTY_SERVER_DIR));  
140
        int jnpPort = JBPluginUtils.getJnpPortNumber(ip.getProperty(JBPluginProperties.PROPERTY_SERVER_DIR));  
141
        NbProcessDescriptor pd;
142
        if(isJBoss7()) {
143
            pd = new NbProcessDescriptor(serverStopFileName, "--connect --command=:shutdown"); // NOI18N
144
        } else {
134
        if (dm.getProperties().getServerVersion().compareTo(JBPluginUtils.JBOSS_6_0_0) < 0) {
145
        if (dm.getProperties().getServerVersion().compareTo(JBPluginUtils.JBOSS_6_0_0) < 0) {
135
            additionalParams.append(" -s jnp://localhost:").append(jnpPort); // NOI18N
146
            additionalParams.append(" -s jnp://localhost:").append(jnpPort); // NOI18N
136
        } else {
147
        } else {
Lines 150-158 Link Here
150
161
151
        /* 2008-09-10 The usage of --halt doesn't solve the problem on Windows; it even creates another problem
162
        /* 2008-09-10 The usage of --halt doesn't solve the problem on Windows; it even creates another problem
152
                        of NB Profiler not being notified about the fact that the server was stopped */
163
                        of NB Profiler not being notified about the fact that the server was stopped */
153
        NbProcessDescriptor pd = new NbProcessDescriptor(
164
            pd = new NbProcessDescriptor(
154
                serverStopFileName, "--shutdown " + additionalParams); // NOI18N
165
                serverStopFileName, "--shutdown " + additionalParams); // NOI18N
155
166
        }
156
        Process stoppingProcess = null;
167
        Process stoppingProcess = null;
157
        try {
168
        try {
158
            String envp[] = createEnvironment();
169
            String envp[] = createEnvironment();
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/Bundle.properties (-2 / +2 lines)
Lines 56-64 Link Here
56
56
57
LBL_BrowseButton=Br&owse...
57
LBL_BrowseButton=Br&owse...
58
58
59
MSG_InvalidServerLocation=Provide a valid JBoss Application Server 6, 5 or 4 Location
59
MSG_InvalidServerLocation=Provide a valid JBoss Application Server 7, 6, 5 or 4 Location
60
60
61
MSG_SpecifyServerLocation=Please specify JBoss Application Server 6, 5 or 4 Location
61
MSG_SpecifyServerLocation=Please specify JBoss Application Server 7, 6, 5 or 4 Location
62
62
63
LBL_ChooserName=Choose JBoss Server Location
63
LBL_ChooserName=Choose JBoss Server Location
64
64
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBInstantiatingIterator.java (-4 / +7 lines)
Lines 146-160 Link Here
146
        Set result = new HashSet();
146
        Set result = new HashSet();
147
        
147
        
148
        String displayName =  (String)wizard.getProperty(PROP_DISPLAY_NAME);
148
        String displayName =  (String)wizard.getProperty(PROP_DISPLAY_NAME);
149
        
149
        JBPluginUtils.Version version = JBPluginUtils.getServerVersion(new File(installLocation));
150
        String url = JBDeploymentFactory.URI_PREFIX + host + ":" + port;    // NOI18N
150
        String url = JBDeploymentFactory.URI_PREFIX;
151
        if(version != null && "7".equals(version.getMajorNumber())){
152
            url += "//"+host + ":" + port+"?targetType=as7&serverPort="+port;    // NOI18N
153
        } else {
154
            url += host + ":" + port;    // NOI18N
155
        }
151
        if (server != null && !server.equals(""))                           // NOI18N
156
        if (server != null && !server.equals(""))                           // NOI18N
152
            url += "#" + server;                                            // NOI18N
157
            url += "#" + server;                                            // NOI18N
153
        url += "&"+ installLocation;                                        // NOI18N
158
        url += "&"+ installLocation;                                        // NOI18N
154
      
159
      
155
        try {
160
        try {
156
            JBPluginUtils.Version version = JBPluginUtils.getServerVersion(new File(installLocation));
157
158
            Map<String, String> initialProperties = new HashMap<String, String>();
161
            Map<String, String> initialProperties = new HashMap<String, String>();
159
            initialProperties.put(JBPluginProperties.PROPERTY_SERVER, server);
162
            initialProperties.put(JBPluginProperties.PROPERTY_SERVER, server);
160
            initialProperties.put(JBPluginProperties.PROPERTY_DEPLOY_DIR, deployDir);
163
            initialProperties.put(JBPluginProperties.PROPERTY_DEPLOY_DIR, deployDir);
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java (-10 / +84 lines)
Lines 98-103 Link Here
98
98
99
    public static final String LIB = "lib" + File.separator;
99
    public static final String LIB = "lib" + File.separator;
100
100
101
    public static final String MODULES = "modules" + File.separator;
102
101
    public static final String CLIENT = "client" + File.separator;
103
    public static final String CLIENT = "client" + File.separator;
102
104
103
    public static final String COMMON = "common" + File.separator;
105
    public static final String COMMON = "common" + File.separator;
Lines 195-200 Link Here
195
        return domainRequirements6x;
197
        return domainRequirements6x;
196
    }
198
    }
197
199
200
    private static List<String> domainRequirements7x;
201
202
    private static synchronized List<String> getDomainRequirements7x() {
203
        if (domainRequirements7x == null) {
204
            domainRequirements7x = new ArrayList<String>(11);
205
            Collections.addAll(domainRequirements7x,
206
                    "configuration", // NOI18N
207
                    "deployments", // NOI18N
208
                    "lib" // NOI18N
209
                    );
210
        }
211
        return domainRequirements7x;
212
    }
213
214
198
    //--------------- checking for possible server directory -------------
215
    //--------------- checking for possible server directory -------------
199
    private static List<String> serverRequirements4x;
216
    private static List<String> serverRequirements4x;
200
217
Lines 249-254 Link Here
249
        return serverRequirements5And6x;
266
        return serverRequirements5And6x;
250
    }
267
    }
251
268
269
    private static List<String> serverRequirements7x;
270
    private static synchronized List<String> getServerRequirements7x() {
271
        if (serverRequirements7x == null) {
272
            serverRequirements7x = new ArrayList<String>(6);
273
            Collections.addAll(serverRequirements7x,
274
                    "bin", // NOI18N
275
                    "modules", // NOI18N
276
                    "jboss-modules.jar"); // NOI18N
277
        }
278
        return serverRequirements7x;
279
    }
280
252
    //------------  getting exists servers---------------------------
281
    //------------  getting exists servers---------------------------
253
    /**
282
    /**
254
     * returns Hashmap
283
     * returns Hashmap
Lines 262-275 Link Here
262
        File serverDirectory = new File(serverLocation);
291
        File serverDirectory = new File(serverLocation);
263
292
264
        if (isGoodJBServerLocation(serverDirectory)) {
293
        if (isGoodJBServerLocation(serverDirectory)) {
265
           File file = new File(serverLocation + File.separator + "server");  // NOI18N
294
            Version version = getServerVersion(serverDirectory);            
266
295
            File file;
267
            String[] files = file.list(new FilenameFilter(){
296
            String[] files;
297
            if("7".equals(version.getMajorNumber())) {
298
                files = new String[]{"standalone", "domain"};
299
                file = serverDirectory;
300
            } else {
301
                file = new File(serverLocation + File.separator + "server");  // NOI18N
302
                files = file.list(new FilenameFilter(){
303
                    @Override
268
                public boolean accept(File dir, String name){
304
                public boolean accept(File dir, String name){
269
                    if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true;
305
                    if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true;
270
                    return false;
306
                    return false;
271
                }
307
                }
272
            });
308
            });
309
            }
273
310
274
            for(int i = 0; i<files.length; i++) {
311
            for(int i = 0; i<files.length; i++) {
275
                String path = file.getAbsolutePath() + File.separator + files[i];
312
                String path = file.getAbsolutePath() + File.separator + files[i];
Lines 319-337 Link Here
319
        return isGoodJBInstanceLocation(candidate, getDomainRequirements6x());
356
        return isGoodJBInstanceLocation(candidate, getDomainRequirements6x());
320
    }
357
    }
321
358
359
    private static boolean isGoodJBInstanceLocation7x(File serverDir, File candidate){
360
        return isGoodJBInstanceLocation(candidate, getDomainRequirements7x());
361
    }
362
322
    public static boolean isGoodJBInstanceLocation(File serverDir, File candidate){
363
    public static boolean isGoodJBInstanceLocation(File serverDir, File candidate){
323
        Version version = getServerVersion(serverDir);
364
        Version version = getServerVersion(serverDir);
324
        if (version == null || (!"4".equals(version.getMajorNumber())
365
        if (version == null || (!"4".equals(version.getMajorNumber())
325
                && !"5".equals(version.getMajorNumber()) // NOI18N
366
                && !"5".equals(version.getMajorNumber()) // NOI18N
326
                && !"6".equals(version.getMajorNumber()))) { // NOI18N
367
                && !"6".equals(version.getMajorNumber()) // NOI18N
368
                && !"7".equals(version.getMajorNumber()))) { // NOI18N
327
            return JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)
369
            return JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)
328
                    || JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)
370
                    || JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)
329
                    || JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate);
371
                    || JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)
372
                    || JBPluginUtils.isGoodJBInstanceLocation7x(serverDir, candidate);
330
        }
373
        }
331
374
332
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)) // NOI18N
375
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)) // NOI18N
333
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)) // NOI18N
376
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)) // NOI18N
334
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)); // NOI18N
377
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)) // NOI18N
378
                || ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation7x(serverDir, candidate)); // NOI18N
335
    }
379
    }
336
380
337
    private static boolean isGoodJBServerLocation(File candidate, List<String> requirements){
381
    private static boolean isGoodJBServerLocation(File candidate, List<String> requirements){
Lines 372-390 Link Here
372
        return isGoodJBServerLocation(candidate, getServerRequirements5And6x());
416
        return isGoodJBServerLocation(candidate, getServerRequirements5And6x());
373
    }
417
    }
374
418
419
    private static boolean isGoodJBServerLocation7x(File candidate){
420
        return isGoodJBServerLocation(candidate, getServerRequirements7x());
421
    }
422
375
    public static boolean isGoodJBServerLocation(File candidate) {
423
    public static boolean isGoodJBServerLocation(File candidate) {
376
        Version version = getServerVersion(candidate);
424
        Version version = getServerVersion(candidate);
377
        if (version == null || (!"4".equals(version.getMajorNumber())
425
        if (version == null || (!"4".equals(version.getMajorNumber())
378
                && !"5".equals(version.getMajorNumber())
426
                && !"5".equals(version.getMajorNumber())
379
                && !"6".equals(version.getMajorNumber()))) { // NOI18N
427
                && !"6".equals(version.getMajorNumber())
428
                && !"7".equals(version.getMajorNumber()))) { // NOI18N
380
            return JBPluginUtils.isGoodJBServerLocation4x(candidate)
429
            return JBPluginUtils.isGoodJBServerLocation4x(candidate)
381
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
430
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
382
                    || JBPluginUtils.isGoodJBServerLocation6x(candidate);
431
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
432
                    || JBPluginUtils.isGoodJBServerLocation7x(candidate);
383
        }
433
        }
384
434
385
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n
435
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n
386
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N
436
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N
387
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)); // NOI18N
437
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)) // NOI18N
438
                || ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation7x(candidate)); // NOI18N
388
    }
439
    }
389
440
390
    public static boolean isJB4(JBDeploymentManager dm) {
441
    public static boolean isJB4(JBDeploymentManager dm) {
Lines 435-440 Link Here
435
     *
486
     *
436
     */
487
     */
437
    public static String getDeployDir(String domainDir){
488
    public static String getDeployDir(String domainDir){
489
        Version version = JBPluginUtils.getServerVersion(new File(JBPluginProperties.getInstance().getInstallLocation()));
490
        if("7".equals(version.getMajorNumber())) {
491
            return domainDir + File.separator + "deployments"; //NOI18N
492
        }
438
        return domainDir + File.separator + "deploy"; //NOI18N
493
        return domainDir + File.separator + "deploy"; //NOI18N
439
        //todo: get real deploy path
494
        //todo: get real deploy path
440
    }
495
    }
Lines 659-665 Link Here
659
        assert serverPath != null : "Can't determine version with null server path"; // NOI18N
714
        assert serverPath != null : "Can't determine version with null server path"; // NOI18N
660
715
661
        File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N
716
        File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N
662
        return getVersion(systemJarFile);
717
        Version version = getVersion(systemJarFile);
718
        if(version == null) {
719
            // check for JBoss AS 7
720
            File serverDir = new File(serverPath, "modules/org/jboss/as/server/main");
721
            for (File jarFile : serverDir.listFiles(new JarFileFilter())) {
722
                version = getVersion(jarFile);
723
                if(version != null) {
724
                    break;
725
    }
726
            }
727
        }
728
        return version;
729
    }
730
731
    static class JarFileFilter implements FilenameFilter {
732
733
        @Override
734
        public boolean accept(File dir, String name) {
735
            return name.endsWith(".jar");
736
        }
663
    }
737
    }
664
738
665
    private static Version getVersion(File systemJarFile) {
739
    private static Version getVersion(File systemJarFile) {

Return to bug 200132