Solved

Java can't find logon configuration when running application from command promt

Posted on 2010-09-05
5
553 Views
Last Modified: 2012-05-10
My application works fine from netbeans, but when running from the command line i get an exception. I have done some research on google on this and the problem seemed to be related to not setting the path to the login.config file, but i have.

This is what i type: java -jar java application3.jar -Djava.security.auth.login.config=.\appclientlogin.conf

If i do not have -the Djava.security.auth.login.config=.\appclientlogin.conf set under properties - run - VM Options i will get the same error message.

Thank you for taking the time to read this.

The Main.java file for the application

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package demo;

import javax.annotation.security.RolesAllowed;
import javax.ejb.Stateless;

/**
 *
 * @author js
 */
@Stateless
public class SB3 implements SB3Remote {

    @Override @RolesAllowed("DummyUsers")
    public String Hello(String name) {
        return ("Hello 2 " + name);
    }     
}

Open in new window

2010-sep-05 19:23:45 com.sun.appserv.security.ProgrammaticLogin login
ALLVARLIG: Programmatic login failed: java.lang.SecurityException: Det gÕr
inte att hitta nÕgon inloggningskonfiguration
Exception in thread "main" java.lang.ClassFormatError: Absent Code attribut
e in method that is not native or abstract in class file javax/security/jac
c/PolicyContextException
        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 java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at com.sun.enterprise.security.SSLUtils.<clinit>(SSLUtils.java:102)

        at com.sun.enterprise.iiop.IIOPSSLSocketFactory.<init>(IIOPSSLSocke
tFactory.java:182)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Me
thod)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown So
urce)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknow
n Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at com.sun.corba.ee.impl.orb.ParserTable$4.operate(ParserTable.java
:700)
        at com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserA
ction.java:58)
        at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.jav
a:81)
        at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java
:81)
        at com.sun.corba.ee.impl.orb.ORBDataParserImpl.<init>(ORBDataParser
Impl.java:482)
        at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:587)
        at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:70
1)
        at org.omg.CORBA.ORB.init(Unknown Source)
        at com.sun.enterprise.util.ORBManager.initORB(ORBManager.java:546)
        at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:278)
        at com.sun.enterprise.naming.SerialInitContextFactory.getInitialCon
text(SerialInitContextFactory.java:178)
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)

        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.init(Unknown Source)
        at javax.naming.InitialContext.<init>(Unknown Source)
        at demo.Main.main(Main.java:40)

Open in new window

appclientlogin.conf file located under C:\Sun\AppServer\lib\appclient


default {
	com.sun.enterprise.security.auth.login.ClientPasswordLoginModule required debug=false;
};

certificate {
	com.sun.enterprise.security.auth.login.ClientCertificateLoginModule required debug=false;
};

Open in new window

0
Comment
Question by:endasil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 33608188
sounds like you're running it with incompatible jars
0
 

Author Comment

by:endasil
ID: 33609869
After that comment i checked my jars, and i have a javaee.jar that is only 1 kb. Apparantly that one can only be used for building but not running. Copying j2ee.jar from C:\sun\appserver\lib into my dist\lib directory removes the error about Absent code attribute. Still have problem with that it can not find the logon configuration.

2010-sep-06 11:25:39 com.sun.appserv.security.ProgrammaticLogin login
ALLVARLIG: Programmatic login failed: java.lang.SecurityException: Det gÕr
inte att hitta nÕgon inloggningskonfiguration
javax.naming.NamingException: ejb ref resolution error for remote business
interfacedemo.SB3Remote [Root exception is java.rmi.AccessException: CORBA
NO_PERMISSION 0 No; nested exception is:
        org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trac
e----------
org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No
        at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.han
dle_null_service_context(SecServerRequestInterceptor.java:407)
        at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.rec
eive_request(SecServerRequestInterceptor.java:429)
        at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServ
erInterceptorIntermediatePoint(InterceptorInvoker.java:627)
        at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPII
ntermediatePoint(PIHandlerImpl.java:530)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.
getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.
dispatch(CorbaServerRequestDispatcherImpl.java:224)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
questRequest(CorbaMessageMediatorImpl.java:1846)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
quest(CorbaMessageMediatorImpl.java:1706)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleIn
put(CorbaMessageMediatorImpl.java:1088)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2
.callback(RequestMessage_1_2.java:223)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
quest(CorbaMessageMediatorImpl.java:806)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch
(CorbaMessageMediatorImpl.java:563)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(C
orbaMessageMediatorImpl.java:2567)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerTh
read.run(ThreadPoolImpl.java:555)

----------END server-side stack trace----------  vmcid: 0x0  minor code: 0
 completed: No]
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:
425)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInst
ance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)

        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.jav
a:414)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at demo.Main.main(Main.java:43)
Caused by: java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested excep
tion is:
        org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trac
e----------
org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No
        at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.han
dle_null_service_context(SecServerRequestInterceptor.java:407)
        at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.rec
eive_request(SecServerRequestInterceptor.java:429)
        at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServ
erInterceptorIntermediatePoint(InterceptorInvoker.java:627)
        at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPII
ntermediatePoint(PIHandlerImpl.java:530)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.
getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.
dispatch(CorbaServerRequestDispatcherImpl.java:224)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
questRequest(CorbaMessageMediatorImpl.java:1846)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
quest(CorbaMessageMediatorImpl.java:1706)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleIn
put(CorbaMessageMediatorImpl.java:1088)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2
.callback(RequestMessage_1_2.java:223)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
quest(CorbaMessageMediatorImpl.java:806)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch
(CorbaMessageMediatorImpl.java:563)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(C
orbaMessageMediatorImpl.java:2567)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerTh
read.run(ThreadPoolImpl.java:555)

----------END server-side stack trace----------  vmcid: 0x0  minor code: 0
 completed: No
        at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Ut
il.java:277)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl
.privateInvoke(StubInvocationHandlerImpl.java:205)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl
.invoke(StubInvocationHandlerImpl.java:152)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(
BCELStubBase.java:225)
        at com.sun.ejb.codegen._GenericEJBHome_Generated_DynamicStub.create
(com/sun/ejb/codegen/_GenericEJBHome_Generated_DynamicStub.java)
        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 com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:
372)
        ... 5 more
Caused by: org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack t
race----------
org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No
        at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.han
dle_null_service_context(SecServerRequestInterceptor.java:407)
        at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.rec
eive_request(SecServerRequestInterceptor.java:429)
        at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServ
erInterceptorIntermediatePoint(InterceptorInvoker.java:627)
        at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPII
ntermediatePoint(PIHandlerImpl.java:530)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.
getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.
dispatch(CorbaServerRequestDispatcherImpl.java:224)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
questRequest(CorbaMessageMediatorImpl.java:1846)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
quest(CorbaMessageMediatorImpl.java:1706)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleIn
put(CorbaMessageMediatorImpl.java:1088)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2
.callback(RequestMessage_1_2.java:223)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRe
quest(CorbaMessageMediatorImpl.java:806)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch
(CorbaMessageMediatorImpl.java:563)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(C
orbaMessageMediatorImpl.java:2567)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerTh
read.run(ThreadPoolImpl.java:555)

----------END server-side stack trace----------  vmcid: 0x0  minor code: 0
 completed: No
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Me
thod)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown So
urce)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknow
n Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase.getSys
temException(MessageBase.java:913)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage_1_2.g
etSystemException(ReplyMessage_1_2.java:131)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.getSyste
mExceptionReply(CorbaMessageMediatorImpl.java:685)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.
processResponse(CorbaClientRequestDispatcherImpl.java:472)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.
marshalingComplete(CorbaClientRequestDispatcherImpl.java:363)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(Co
rbaClientDelegateImpl.java:222)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl
.privateInvoke(StubInvocationHandlerImpl.java:192)
        ... 13 more

Open in new window

0
 

Author Comment

by:endasil
ID: 33610044
Should add that the i get the first error listed above:  "Programmatic login failed: java.lang.SecurityException: Det gÕr
inte att hitta nÕgon inloggningskonfiguration" error happens when i attemt to do a pm.login(user, "dummy");

The second error appears when i try to do a ctx = new InitialContext(env);
javax.naming.NamingException: ejb ref resolution error for remote business
interfacedemo.SB3Remote
0
 

Author Comment

by:endasil
ID: 33610861
I solved the problem with not finding logon configuration by typing -java -djava... -jar appname instead of -java -jar appname -djava... apparantly everything written after -jar is seen as commands for the application.

The policy exception was a problem with the wrong jar file and was solved thanks to your comment about incompatible jars and replacing the  j2ee.jar with another worked. Thanks.
0
 

Author Closing Comment

by:endasil
ID: 33610868
I solved the problem with not finding logon configuration by typing -java -djava... -jar appname instead of -java -jar appname -djava... apparantly everything written after -jar is seen as commands for the application.

The policy exception was a problem with the wrong jar file and was solved thanks to your comment about incompatible jars and replacing the  j2ee.jar with another worked. Thanks.
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question