You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Imesh Damith <im...@rezgateway.com> on 2013/04/10 12:45:46 UTC

Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

Hi,

I'm trying to use UDP server to log my messages. For this I use LOG4J2.
But I got below error in the server side.

ClassNotFoundException Error : java.lang.ClassNotFoundException:
org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy


Below is my server side code.


ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
ObjectInputStream obj = new ObjectInputStream(bis);
LogEvent logEvent = (LogEvent) obj.readObject();

System.out.println(logEvent.toString());


Below is my pom.xml file dependency.

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.0-beta4</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0-beta4</version>
</dependency>




Thanks in advance,
Imesh

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

Posted by Remko Popma <re...@yahoo.com>.
Imesh,
Does the server-side code (the process that is receiving UDP messages) have both the log4j-api and the log4j-core jar files in the classpath?

I've attached your files to the Jira ticket. Would you mind if we follow up on this issue by commenting on Jira?

https://issues.apache.org/jira/browse/LOG4J2-228


Sent from my iPhone

On 2013/04/30, at 14:46, Imesh Damith <im...@rezgateway.com> wrote:

> Hi Gary,
> 
> This is happening in while running. In my TCP server class. below is snipt.
> 
> private void someMethod() throws IOException{
>            DatagramSocket socket = new DatagramSocket(9092);
> 
> 
>            byte[] buf = new byte[100000];
>            DatagramPacket packet = new DatagramPacket(buf, buf.length);
> 
>            socket.receive(packet);
> 
>            ReadPacket(packet.getData());
> 
> }
> public static String ReadPacket(byte[] recievedPakets){
> 
> 
>        String retvals = "";
>        ByteArrayInputStream bis = new ByteArrayInputStream(recievedPakets);
> 
>        LogEvent logEvent = null;
>        ObjectInputStream obj = null;
>        try {
> 
>            bis = new ByteArrayInputStream(recievedPakets);
>            obj = new ObjectInputStream(bis);
>            logEvent = (LogEvent) obj.readObject();
>            System.out.println(logEvent.toString());
> 
> 
>        } catch (IOException e1) {
>            System.out.println(" IOException Error : "+e1);
>            e1.printStackTrace();
>        } catch (ClassNotFoundException e1) {
>            System.out.println(" ClassNotFoundException Error : "+e1);
>            e1.printStackTrace();
> 
> 
> 
> 
>        }finally{
>            try {bis.close(); } catch (Exception e2) {}
> 
>        }
> 
>        return retvals;
> 
>    }
> 
> 
> 
> 
> Thanks,
> Imesh
> 
> On Monday 29 April 2013 05:20 PM, Gary Gregory wrote:
>> Does the error happen from maven or your IDE?
>> 
>> Gary
>> 
>> On Apr 29, 2013, at 7:43, Remko Popma<re...@yahoo.com>  wrote:
>> 
>>> Imesh,
>>> 
>>> It is hard to see what could be the problem based on your description.
>>> I created this JIRA ticket for the issue you describe:
>>> https://issues.apache.org/jira/browse/LOG4J2-228
>>> 
>>> 
>>> Would it be possible for you to attach a test program that demonstrates the issue to that JIRA ticket?
>>> 
>>> Kind regards,
>>> Remko
>>> 
>>> 
>>> ________________________________
>>> From: Imesh Damith<im...@rezgateway.com>
>>> To: log4j-user@logging.apache.org
>>> Sent: Monday, April 29, 2013 3:47 PM
>>> Subject: Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>> 
>>> 
>>> Hi All,
>>> 
>>> Reminding !!, Can anyone help me please?
>>> 
>>> 
>>> Regards,
>>> Imesh
>>> 
>>> On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
>>>> Hi,
>>>> 
>>>> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
>>>> But I got below error in the server side.
>>>> 
>>>> ClassNotFoundException Error : java.lang.ClassNotFoundException:
>>>> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>>> 
>>>> 
>>>> Below is my server side code.
>>>> 
>>>> 
>>>> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
>>>> ObjectInputStream obj = new ObjectInputStream(bis);
>>>> LogEvent logEvent = (LogEvent) obj.readObject();
>>>> 
>>>> System.out.println(logEvent.toString());
>>>> 
>>>> 
>>>> Below is my pom.xml file dependency.
>>>> 
>>>> <dependency>
>>>> <groupId>org.apache.logging.log4j</groupId>
>>>> <artifactId>log4j-api</artifactId>
>>>> <version>2.0-beta4</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.apache.logging.log4j</groupId>
>>>> <artifactId>log4j-core</artifactId>
>>>> <version>2.0-beta4</version>
>>>> </dependency>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Thanks in advance,
>>>> Imesh
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 

Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

Posted by Imesh Damith <im...@rezgateway.com>.
Hi Gary,

This is happening in while running. In my TCP server class. below is snipt.

private void someMethod() throws IOException{
             DatagramSocket socket = new DatagramSocket(9092);


             byte[] buf = new byte[100000];
             DatagramPacket packet = new DatagramPacket(buf, buf.length);

             socket.receive(packet);

             ReadPacket(packet.getData());

}
public static String ReadPacket(byte[] recievedPakets){


         String retvals = "";
         ByteArrayInputStream bis = new 
ByteArrayInputStream(recievedPakets);

         LogEvent logEvent = null;
         ObjectInputStream obj = null;
         try {

             bis = new ByteArrayInputStream(recievedPakets);
             obj = new ObjectInputStream(bis);
             logEvent = (LogEvent) obj.readObject();
             System.out.println(logEvent.toString());


         } catch (IOException e1) {
             System.out.println(" IOException Error : "+e1);
             e1.printStackTrace();
         } catch (ClassNotFoundException e1) {
             System.out.println(" ClassNotFoundException Error : "+e1);
             e1.printStackTrace();




         }finally{
             try {bis.close(); } catch (Exception e2) {}

         }

         return retvals;

     }




Thanks,
Imesh

On Monday 29 April 2013 05:20 PM, Gary Gregory wrote:
> Does the error happen from maven or your IDE?
>
> Gary
>
> On Apr 29, 2013, at 7:43, Remko Popma<re...@yahoo.com>  wrote:
>
>> Imesh,
>>
>> It is hard to see what could be the problem based on your description.
>> I created this JIRA ticket for the issue you describe:
>> https://issues.apache.org/jira/browse/LOG4J2-228
>>
>>
>> Would it be possible for you to attach a test program that demonstrates the issue to that JIRA ticket?
>>
>> Kind regards,
>> Remko
>>
>>
>> ________________________________
>> From: Imesh Damith<im...@rezgateway.com>
>> To: log4j-user@logging.apache.org
>> Sent: Monday, April 29, 2013 3:47 PM
>> Subject: Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>
>>
>> Hi All,
>>
>> Reminding !!, Can anyone help me please?
>>
>>
>> Regards,
>> Imesh
>>
>> On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
>>> Hi,
>>>
>>> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
>>> But I got below error in the server side.
>>>
>>> ClassNotFoundException Error : java.lang.ClassNotFoundException:
>>> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>>
>>>
>>> Below is my server side code.
>>>
>>>
>>> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
>>> ObjectInputStream obj = new ObjectInputStream(bis);
>>> LogEvent logEvent = (LogEvent) obj.readObject();
>>>
>>> System.out.println(logEvent.toString());
>>>
>>>
>>> Below is my pom.xml file dependency.
>>>
>>> <dependency>
>>> <groupId>org.apache.logging.log4j</groupId>
>>> <artifactId>log4j-api</artifactId>
>>> <version>2.0-beta4</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.logging.log4j</groupId>
>>> <artifactId>log4j-core</artifactId>
>>> <version>2.0-beta4</version>
>>> </dependency>
>>>
>>>
>>>
>>>
>>> Thanks in advance,
>>> Imesh
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

Posted by Gary Gregory <ga...@gmail.com>.
Does the error happen from maven or your IDE?

Gary

On Apr 29, 2013, at 7:43, Remko Popma <re...@yahoo.com> wrote:

> Imesh,
>
> It is hard to see what could be the problem based on your description.
> I created this JIRA ticket for the issue you describe:
> https://issues.apache.org/jira/browse/LOG4J2-228
>
>
> Would it be possible for you to attach a test program that demonstrates the issue to that JIRA ticket?
>
> Kind regards,
> Remko
>
>
> ________________________________
> From: Imesh Damith <im...@rezgateway.com>
> To: log4j-user@logging.apache.org
> Sent: Monday, April 29, 2013 3:47 PM
> Subject: Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>
>
> Hi All,
>
> Reminding !!, Can anyone help me please?
>
>
> Regards,
> Imesh
>
> On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
>> Hi,
>>
>> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
>> But I got below error in the server side.
>>
>> ClassNotFoundException Error : java.lang.ClassNotFoundException:
>> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>
>>
>> Below is my server side code.
>>
>>
>> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
>> ObjectInputStream obj = new ObjectInputStream(bis);
>> LogEvent logEvent = (LogEvent) obj.readObject();
>>
>> System.out.println(logEvent.toString());
>>
>>
>> Below is my pom.xml file dependency.
>>
>> <dependency>
>> <groupId>org.apache.logging.log4j</groupId>
>> <artifactId>log4j-api</artifactId>
>> <version>2.0-beta4</version>
>> </dependency>
>> <dependency>
>> <groupId>org.apache.logging.log4j</groupId>
>> <artifactId>log4j-core</artifactId>
>> <version>2.0-beta4</version>
>> </dependency>
>>
>>
>>
>>
>> Thanks in advance,
>> Imesh
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

Posted by Remko Popma <re...@yahoo.com>.
Hi Imesh,

I'll take a look, thank you. 
I'll attach the files to the Jira when I get home.

About Jira, I think anyone can create an account. Maybe for next time... :-)

Remko

Sent from my iPhone

On 2013/04/30, at 14:40, Imesh Damith <im...@rezgateway.com> wrote:

> Hi Remko,
> 
> Sorry, I do not have access to your JIRA. (User name pwd).
> 
> Here with I have attached relevant files. My whole program needs to configure but within these classes you should be able to understand.
> 
> 
> client code (Logs_test.java class) send the debug log and TCPServer_test.java class receive it.  
> 
> But there is an error catching in line 111 ( class not found). 
> 
> 
> 
> Let me know if I miss any jar file. My pom.xml file also attached.
> 
> 
> Regards,
> Imesh
> 
> 
> On Monday 29 April 2013 05:12 PM, Remko Popma wrote:
>> 
>> Imesh,
>> 
>> It is hard to see what could be the problem based on your description.
>> I created this JIRA ticket for the issue you describe:
>> https://issues.apache.org/jira/browse/LOG4J2-228
>> 
>> 
>> Would it be possible for you to attach a test program that demonstrates the issue to that JIRA ticket?
>> 
>> Kind regards,
>> Remko
>> 
>> 
>> ________________________________
>>  From: Imesh Damith <im...@rezgateway.com>
>> To: log4j-user@logging.apache.org 
>> Sent: Monday, April 29, 2013 3:47 PM
>> Subject: Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>  
>> 
>> Hi All,
>> 
>> Reminding !!, Can anyone help me please?
>> 
>> 
>> Regards,
>> Imesh
>> 
>> On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
>>> Hi,
>>> 
>>> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
>>> But I got below error in the server side.
>>> 
>>> ClassNotFoundException Error : java.lang.ClassNotFoundException:
>>> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>> 
>>> 
>>> Below is my server side code.
>>> 
>>> 
>>> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
>>> ObjectInputStream obj = new ObjectInputStream(bis);
>>> LogEvent logEvent = (LogEvent) obj.readObject();
>>> 
>>> System.out.println(logEvent.toString());
>>> 
>>> 
>>> Below is my pom.xml file dependency.
>>> 
>>> <dependency>
>>> <groupId>org.apache.logging.log4j</groupId>
>>> <artifactId>log4j-api</artifactId>
>>> <version>2.0-beta4</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.logging.log4j</groupId>
>>> <artifactId>log4j-core</artifactId>
>>> <version>2.0-beta4</version>
>>> </dependency>
>>> 
>>> 
>>> 
>>> 
>>> Thanks in advance,
>>> Imesh
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> <TCPServer_test.java>
> <Logs_test.java>
> <log4j2.xml>
> <pom.xml>

Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

Posted by Remko Popma <re...@yahoo.com>.
Imesh,

It is hard to see what could be the problem based on your description.
I created this JIRA ticket for the issue you describe:
https://issues.apache.org/jira/browse/LOG4J2-228


Would it be possible for you to attach a test program that demonstrates the issue to that JIRA ticket?

Kind regards,
Remko


________________________________
 From: Imesh Damith <im...@rezgateway.com>
To: log4j-user@logging.apache.org 
Sent: Monday, April 29, 2013 3:47 PM
Subject: Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
 

Hi All,

Reminding !!, Can anyone help me please?


Regards,
Imesh

On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
> Hi,
>
> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
> But I got below error in the server side.
>
> ClassNotFoundException Error : java.lang.ClassNotFoundException:
> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>
>
> Below is my server side code.
>
>
> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
> ObjectInputStream obj = new ObjectInputStream(bis);
> LogEvent logEvent = (LogEvent) obj.readObject();
>
> System.out.println(logEvent.toString());
>
>
> Below is my pom.xml file dependency.
>
> <dependency>
> <groupId>org.apache.logging.log4j</groupId>
> <artifactId>log4j-api</artifactId>
> <version>2.0-beta4</version>
> </dependency>
> <dependency>
> <groupId>org.apache.logging.log4j</groupId>
> <artifactId>log4j-core</artifactId>
> <version>2.0-beta4</version>
> </dependency>
>
>
>
>
> Thanks in advance,
> Imesh


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

Posted by Imesh Damith <im...@rezgateway.com>.
Hi All,

Reminding !!, Can anyone help me please?


Regards,
Imesh

On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
> Hi,
>
> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
> But I got below error in the server side.
>
> ClassNotFoundException Error : java.lang.ClassNotFoundException:
> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>
>
> Below is my server side code.
>
>
> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
> ObjectInputStream obj = new ObjectInputStream(bis);
> LogEvent logEvent = (LogEvent) obj.readObject();
>
> System.out.println(logEvent.toString());
>
>
> Below is my pom.xml file dependency.
>
> <dependency>
> <groupId>org.apache.logging.log4j</groupId>
> <artifactId>log4j-api</artifactId>
> <version>2.0-beta4</version>
> </dependency>
> <dependency>
> <groupId>org.apache.logging.log4j</groupId>
> <artifactId>log4j-core</artifactId>
> <version>2.0-beta4</version>
> </dependency>
>
>
>
>
> Thanks in advance,
> Imesh


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org