[Beginners Corner] - Re: JNDI, JDBC & Simple Application
by AlexKomlev
Big thanks for your help. I change -ds.xml and use instead of "java:PostgresDS", "PostgresDS". In connection stage i don't have visible problems,
but on
| ResultSet rs = st.executeQuery("SELECT * FROM TestTable");
|
i see
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy2.execute(Unknown Source)
at org.ConnectFromJndi.main(ConnectFromJndi.java:36)
Caused by: java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
java.lang.ClassNotFoundException: org.postgresql.util.PSQLException (no security manager: RMI class loader disabled)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:133)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
at org.jboss.resource.adapter.jdbc.remote.StatementInterceptor.invoke(StatementInterceptor.java:58)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
... 2 more
Caused by: java.lang.ClassNotFoundException: org.postgresql.util.PSQLException (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 11 more
Maybe its my errors. After your message I am declined to not use jndi and will be limited simple JDBC to connection. It is a lot of complexities and not enough practical advantage in my case.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038550#4038550
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038550
19 years
[Installation, Configuration & Deployment] - Re: running executable on JBoss
by NasirMunir
Peter thanks a lot for your reply. I am sorry, perhaps, I didnt explain my question well.
1)Operating system is windows 2000
2)I am running JBoss manually from command prompt (run.bat)
3)System path is set for exe file and not for batch file.
4)JBoss version is 4.0.5.GA
I have develped this distributed system that can run on JBoss on my computer. I have tested that and it works fine. Now I have to deploy that on some other machine. When the execution of the program reaches where the method calls the batch file, the application stops there. There is always a command window that opens up that lists the batch file path on the title bar(top most area) and in the window it is giving me the path which is always the same and is not the full path for batch file.
I have tried using net send command in my batch file to see if it ever is called or not. It is not. Also, I am sure nothing is wrong with the batch file, because I can run the batch file by double clicking (manually), but it wont run through the program. On my computer I could do that. If it is essential, I can list the code as well.
I hope to get help here; honestly, I have no clue to move on with this. I searched on the internet and someone suggested that perhaps I need to change the file permission on JBoss, am not sure though? I hope this time I have explained my problem little better than before. If more clearity is needed, i can elaborate and explain it again. Thanks !!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038546#4038546
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038546
19 years
[JBoss Messaging] - Re: Separate log files no longer works with JBM 3.2
by chip_schoch
Judging by the tremendous number of replies I see that this is a topic of enormous interest. However, if anyone is interested I was able to effect a work around by adding another filter. Here it is in case anyone is interested. It should be placed in the chain before the TCLFilter:
package your.package;
|
|
|
| import java.security.CodeSource;
| import java.security.ProtectionDomain;
|
| import org.apache.log4j.spi.Filter;
| import org.apache.log4j.spi.LoggingEvent;
|
| /**
| * Class CSFilter<br>
| * An appender filter that evaluates log events to see if the class
| * that is specified by the loggerName has a code source that contains
| * the string specified in deployURL.<br><br>
| *
| * It is important that the logger be initialized with a class:<br>
| * Logger logger = Logger.getInstance(MyClass.class);<br><br>
| *
| * This way the loggerName will be a fully qualified class name. This filter
| * uses the thread context classloader to load the class and then obtains the
| * CodeSource via the ProtectionDomain. It checks the path of the code source
| * to see if the url specified in deployURL is contained in it. Therefore it is
| * case sensitive. This class should be used in conjunction with the TCLFilter and should
| * preced it in the chain because if a match is not found this filter returns NEUTRAL.<br><br>
| *
| * The acceptOnMatch parameter is only applied when a match is found. If it is true then a match
| * returns ACCEPT otherwise when it is false a match returns DENY.
| */
|
| public class CSFilter extends Filter
| {
|
| /** The deployment URL string fragment to match against */
|
| private String deployURL;
|
| /** Whether a match should return ACCEPT or DENY */
|
| private boolean acceptOnMatch = true;
|
| /**
| * Method: decide
| *
| *
| * @param event
| *
| * @return
| */
|
| @Override public int decide (LoggingEvent event)
| {
| int result = Filter.NEUTRAL;
|
| if (isMatchingCS (event))
| result = acceptOnMatch ? Filter.ACCEPT : Filter.DENY;
|
| return result;
| }
|
| /**
| * Method: getDeployURL
| *
| *
| * @return
| */
|
| public String getDeployURL ()
| {
| return deployURL;
| }
|
| /**
| * Method: isAcceptOnMatch
| *
| *
| * @return
| */
|
| public boolean isAcceptOnMatch ()
| {
| return acceptOnMatch;
| }
|
| /**
| * Method: isMatchingCS
| *
| *
| * @param event
| *
| * @return
| */
|
| private boolean isMatchingCS (LoggingEvent event)
| {
| boolean match = false;
| try
| {
| ClassLoader cl = Thread.currentThread ().getContextClassLoader ();
| Class clazz = cl.loadClass (event.getLoggerName ());
|
| ProtectionDomain pd = clazz.getProtectionDomain ();
| CodeSource clazzCS = pd.getCodeSource ();
|
| if (clazzCS != null)
| {
| String path = clazzCS.getLocation ().getPath ();
| match = path.contains (deployURL);
| }
| }
| catch (Exception e)
| {
| // Not much to do in this event
| }
|
| return match;
| }
|
| /**
| * Method: setAcceptOnMatch
| *
| *
| * @param acceptOnMatch
| */
|
| public void setAcceptOnMatch (boolean acceptOnMatch)
| {
| this.acceptOnMatch = acceptOnMatch;
| }
|
| /**
| * Method: setDeployURL
| *
| *
| * @param deployURL
| */
|
| public void setDeployURL (String deployURL)
| {
| this.deployURL = deployURL;
| }
| }
|
Example from log4j.xml
<filter class="your.package.CSFilter">
| <param name="AcceptOnMatch" value="true"/>
| <param name="DeployURL" value="YourService.sar"/>
| </filter>
| <filter class="org.jboss.logging.filter.TCLFilter">
| <param name="AcceptOnMatch" value="true"/>
| <param name="DeployURL" value="YourService.sar"/>
| </filter>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038543#4038543
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038543
19 years