[JNDI and Naming] - JNDI binding and NameNotFoundException
by David Bailey
David Bailey [http://community.jboss.org/people/edwardpig] created the discussion
"JNDI binding and NameNotFoundException"
To view the discussion, visit: http://community.jboss.org/message/641151#641151
--------------------------------------------------------------
I'm an EJB-newbie, so please bear with me. I'm running JBoss 5.1.0, and I'm trying to define/deploy/access a stateless session bean. It's my understanding that JBoss 5.1.0 conforms to EJB 3.0, and so I can do the whole thing with annotations, without the need for a ejb-jar.xml or jboss.xml file.
After much Googling, I have tried a number of different ways to do things, most recently the following. In my bean class, I added a no-args constructor and the following annotation and interface:
{code}
@Stateless
public class ScoreComputer implements IScoreComputer
{code}
I defined an IScoreComputer class which declares the methods I want to have available, and put the following annotation on it:
{code}
@Local
public interface IScoreComputer
{code}
In my server code, I try to obtain a reference to my ScoreComputer as follows:
{code}
IScoreComputer computer;
InitialContext ejbContext = new InitialContext();
computer = (IScoreComputer)ejbContext.lookup("ScoreComputer/local");
{code}
When this code executes, a NameNotFoundException is thrown with the message 'IScoreComputer not bound'. I know I'm not doing the JNDI binding correctly, because I've looked in the JMX console for JBoss, and no binding is listed containing the string 'Score'. But try as I might, I am unable to find instructions telling me the correct way to do the binding.
I am using the Spring DispatcherServlet as my servlet, and for a while I thought that might be what is causing the problem, and it may well be. But I replaced that in my web.xml with a simple class which extends HttpServlet, and got the same behavior. I have also tried injecting my bean using the @EJB annotation, e.g.
{code}
@EJB
protected IScoreComputer computer;
{code}
but that fails when JBoss attempts to deploy the .ear file, with a message "Resolution should not happen via injection container".
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/641151#641151]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 1 month
[JBoss Remoting] - Jboss Remoting 2.5.1 in Jboss 5.1.0GA and potential memory leak
by mravi
mravi [http://community.jboss.org/people/mravi] created the discussion
"Jboss Remoting 2.5.1 in Jboss 5.1.0GA and potential memory leak"
To view the discussion, visit: http://community.jboss.org/message/641578#641578
--------------------------------------------------------------
Hi Guys,
we use jboss 5.1.0 and default jboss-remoting that comes with it (2.5.1). We have some OutOfMemoryExceptions and the issue seems to be coming from BiSocketServerInvoker. here is the info from Eclipse MAT
7,084 instances of "org.jboss.remoting.transport.bisocket.BisocketServerInvoker", loaded by "org.jboss.classloader.spi.base.BaseClassLoader @ 0x14d385a8" occupy 56,080,264 (11.62%) bytes. These instances are referenced from one instance of "java.util.TimerTask[]", loaded by "<system class loader>"
Keywords
java.util.TimerTask[]
org.jboss.remoting.transport.bisocket.BisocketServerInvoker
org.jboss.classloader.spi.base.BaseClassLoader @ 0x14d385a8
7084 of those objects which does not look normal. I think this number is growing when we have our web based UI running with is written in RichFaces.
Let me know if you need any more information about the environment.
To me it looks like a memory leak originating in jboss-remoting. Could anyone help resolving the issue?
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/641578#641578]
Start a new discussion in JBoss Remoting at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 1 month
[Beginner's Corner] - Enable logging on Jboss 6.0
by rosanero4ever
rosanero4ever [http://community.jboss.org/people/rosanero4ever] created the discussion
"Enable logging on Jboss 6.0"
To view the discussion, visit: http://community.jboss.org/message/641471#641471
--------------------------------------------------------------
Hi all,
I use Jboss AS 6.0 and i would like enable logging for my little web application that uses ejb3 and hibernate 2.0 as persistence provider. I read many posts about enabling hibernate logging but actually i can't see any log :-( I create a log4j.properties file and I put it in the root folder of my Netbeans project. I put also log4j library in the classpath of the project. My log4j.properties s the following:
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L – %m%n
log4j.rootLogger=debug, stdout
log4j.logger.org.hibernate=info
### log just the SQL
log4j.logger.org.hibernate.SQL=debug
### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=info
### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=info
### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug
### log cache activity ###
log4j.logger.org.hibernate.cache=info
### log transaction activity
#log4j.logger.org.hibernate.transaction=debug
### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug
Why can't I see the log informations? I would like see values in sql WHERE clauses or in INSERT statements (actually I see only some '?') I read some articles about jboss-logging.xml but I don't know I should set it.
I hope somebody can help me. Thanks in advance
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/641471#641471]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 1 month
[JBoss Web Services] - Re: Jboss 6.0 WebService Client with SSL (Saaj)
by Fabiano Oss
Fabiano Oss [http://community.jboss.org/people/fabiano.oss] created the discussion
"Re: Jboss 6.0 WebService Client with SSL (Saaj)"
To view the discussion, visit: http://community.jboss.org/message/604247#604247
--------------------------------------------------------------
protected ByteArrayOutputStream sendMessage(URL urlWSDL, QName qService, QName qPort, String soapMessage) throws Exception {
MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage message;
MimeHeaders header = new MimeHeaders();
header.addHeader("Content-Type", "application/soap+xml");
message = factory.createMessage(header, new ByteArrayInputStream(soapMessage.toString().getBytes()));
Service service = Service.create(urlWSDL, qService);
Dispatch<SOAPMessage> dispatch = service.createDispatch(qPort, SOAPMessage.class,Service.Mode.MESSAGE);
setSecurity(dispatch);
SOAPMessage res = dispatch.invoke(message);
ByteArrayOutputStream out = new ByteArrayOutputStream();
res.writeTo(out);
return out;
}
private void setSecurity(Dispatch<SOAPMessage> dispatch) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException, InvalidKeyException, InvalidKeySpecException, UnrecoverableKeyException {
Client client = ((org.apache.cxf.jaxws.DispatchImpl) dispatch).getClient();
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
setProxy(security, http, httpClientPolicy);
http.setClient(httpClientPolicy);
TLSClientParameters tlsParams = new TLSClientParameters();
TrustManager[] trustMgr = addTrustManagers(security);
KeyManager[] keyMgr = addCertificado(security);
tlsParams.setKeyManagers(keyMgr);
tlsParams.setTrustManagers(trustMgr);
http.setTlsClientParameters(tlsParams);
}
private void setProxy(SegurancaDES security, HTTPConduit http,
HTTPClientPolicy httpClientPolicy) {
httpClientPolicy.setProxyServer("192.168.1.1");
httpClientPolicy.setProxyServerPort("3128");
http.getProxyAuthorization().setUserName("proxyUser");
http.getProxyAuthorization().setPassword("proxyPassword);
}
private KeyManager[] addCertificado(SegurancaDES security)
throws KeyStoreException, IOException, NoSuchAlgorithmException,
CertificateException, FileNotFoundException,
UnrecoverableKeyException {
KeyStore ks1;
ks1 = KeyStore.getInstance("PKCS12");
ks1.load(new FileInputStream(new File("file path")),"password".toCharArray());
KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyFactory.init(ks1, "password".toCharArray());
KeyManager[] keyMgr = keyFactory.getKeyManagers();
return keyMgr;
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/604247#604247]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 1 month
[Javassist] - How to add dependencies to bytecode?
by pteichmann
pteichmann [http://community.jboss.org/people/pteichmann] created the discussion
"How to add dependencies to bytecode?"
To view the discussion, visit: http://community.jboss.org/message/640587#640587
--------------------------------------------------------------
Hi there,
I am just working on an instrumentation project. Target is to instrument android applications. I know its a different VM, but I found a way that works :-).
I do the instrumentation, after the sources are compiled to bytecode, so I have real Java Bytecode. This I can manipulate with javassist. After this the normal way of the android build process runs. All is controlled by ant scripts. The package (apk) is built without errors.
Instrumentation works good so far, but when I try to run the application on a device, I get an exception, calling "Method not found" or similiar.
I instrument something that uses a java.util.Set. When I run the application, the above mentioned exception is thrown. I gues, this is because the javasssit compiler knows about the java.util.set, cause I added the package to the classpool. but somehow it is no longer available, when the javassist process is done.
my question:
is there any possibility to put all needed dependencies, occured in javassist to the bytecode, produced by the javacompiler?
If you don't understand my problem, I can try to describe it a different way. But if you understand it, I would be nice to help ma in any way.
Thanks a lot in advance.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/640587#640587]
Start a new discussion in Javassist at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 1 month