[Beginners Corner] - Wrong class when getting started.
by aleccawley
I am trying to get started with EJB3 in JBoss. I have installed JBoss4.0.4GA and patched in jboss-EJB-3.0_RC9-FD. Then I have written my first Stateless Session Bean, derived from the training course, and (after some trouble) deployed it.
I then try to access it with my Client, using the code below.
public static void main (String[] args) throws Exception
{
Properties props = new Properties () ;
props.setProperty ("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory") ;
props.setProperty ("java.naming.provider.url", "localhost:1099") ;
InitialContext ctx = new InitialContext (props) ;
Object o = ctx.lookup (CalcImpl.class.getSimpleName ()) ;
Calc calculator = (Calc) o ;
System.out.println ("1 + 1 = " + calculator.add (1, 1)) ;
System.out.println ("1 - 1 = " + calculator.subtract (1, 1)) ;
}
But the Object o returned from ctx.lookup is not, as I expect, a CalcImpl Object, but a NamingContext Object, which then causes a Class Cast error.
What am I doing wrong?
Incidentally, after patching, the JBoss startup throws this exception:
... 83 more
11:42:02,648 ERROR [MainDeployer] Could not create deployment: file:/C:/JBoss/jboss-4.0.4.GA/server/default/deploy/ejb3-entity-cache-service.xml
org.jboss.deployment.DeploymentException: No ClassLoaders found for: org.jboss.cache.TreeCache; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.cache.TreeCache)
at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:196)
at org.jboss.system.ServiceController.install(ServiceController.java:226)
Should I worry? Should I report?
Thanks for any help
Alec
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977843#3977843
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977843
19 years, 7 months
[Beginners Corner] - Re: Log Size
by jaikiran
Here's the xml configuration:
<?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
| <!-- ===================================================================== -->
| <!-- -->
| <!-- Log4j Configuration -->
| <!-- -->
| <!-- ===================================================================== -->
|
| <!-- $Id: log4j.xml,v 1.13.2.8 2003/09/23 14:16:27 slaboure Exp $ -->
|
| <!--
| | For more configuration infromation and examples see the Jakarta Log4j
| | owebsite: http://jakarta.apache.org/log4j
| -->
|
| <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
|
| <!-- ================================= -->
| <!-- Preserve messages in a local file -->
| <!-- ================================= -->
|
| <!-- A size based rolling appender -->
| <appender name="FILE" class="org.apache.log4j.FileAppender">
| <param name="File" value="D:/log/myLog.log"/>
| <param name="Append" value="false"/>
| <param name="MaxFileSize" value="50MB"/>
| <param name="MaxBackupIndex" value="100"/>
|
| <layout class="org.apache.log4j.PatternLayout">
| <param name="ConversionPattern" value="%d{ISO8601} [%X{TAPUSERNAME}] %-5p [%c] %m%n"/>
| </layout>
| </appender>
|
|
|
| <!-- ============================== -->
| <!-- Append messages to the console -->
| <!-- ============================== -->
|
| <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
| <param name="Target" value="System.out"/>
| <param name="Threshold" value="INFO"/>
|
| <layout class="org.apache.log4j.PatternLayout">
| <!-- The default pattern: Date Priority [Category] Message\n -->
| <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}] %m%n"/>
| </layout>
| </appender>
|
| <!-- ================ -->
| <!-- Limit categories -->
| <!-- ================ -->
|
|
| <category name="org.myapp">
| <priority value="DEBUG" />
| <appender-ref ref="FILE"/>
| </category>
|
|
|
|
| <!-- ======================= -->
| <!-- Setup the Root category -->
| <!-- ======================= -->
|
| <root>
| <appender-ref ref="CONSOLE"/>
| </root>
|
| </log4j:configuration>
You can set the "MaxFileSize" and "MaxBackupIndex" and any other attribute values depending on your needs
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977841#3977841
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977841
19 years, 7 months