[SNMP4J] cannot find symbol Re: agenpro-mvn-task log4j error

Frank Fock fock at agentpp.com
Sat Mar 3 17:49:15 CET 2012


Hi,

I am not sure what could be causing the specific error you
are getting below, but an important detail to keep in mind
is the following:

In the agenpro-mvn-task\pom.xml the order of dependencies
has to be changed, if you use newer versions of SNMP4J
or SNMP4J-Agent than those that came with your AgenPro
release. Thus, in general it is better to change the order
as follows:

<dependencies>
<dependency>
<groupId>org.snmp4j</groupId>
<artifactId>snmp4j</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>org.snmp4j</groupId>
<artifactId>snmp4j-agent</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>com.oosnmp.agenpro.maven.plugins</groupId>
<artifactId>agenpro-plugin</artifactId>
<version>3.1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>

I will update the pom.xml for the next plugin release (coming up soon).

Best regards,
Frank


Am 03.03.2012 03:58, schrieb agenpro log4j:
> In case anyone can easily see what i am doing wrong, i am getting
> "cannot find symbol" using the agenpro-mvn-task\pom.xml :
>
> ...oosnmp\agenpro\Agent.java:[186,20] cannot find symbol
> symbol : constructor
> DefaultMOQuery(org.snmp4j.agent.DefaultMOContextScope,bool
> ean,com.oosnmp.agenpro.Agent)
>
> usually i thought the<dependencies>  in pom.xml automate into class paths
> when compiling the generated files with Agent.java, to resolve symbols from
> jar files.
>
> Are others getting the example pom.xml (with version fixes) working?  Or is
> it easier to try a different way to build an Agent from files generated
> from agenpro3?
>
> On Wed, Feb 29, 2012 at 9:00 AM, agenpro log4j<agenprolog4j at gmail.com>wrote:
>
>> I guess I am just too new to maven...but it turns out that the
>> -DgeneratePom=true
>> for the manual install step of agenpro-plugin does not figure out its
>> dependencies.
>> So I jar -xf agenpro-plugin.jar and found some maven dependencies in
>> plugin.xml that i copied and pasted into the agenpro-plugin-3.0.5.pom.
>> After fixing the agenpro  dependency to version 3.1.2, I am now
>> getting father down the build.
>>
>> So, does the instructions in AgenProManual.pdf need updating, or was i
>> reading it wrong?  In general, is there a better way to fix
>> agenpro-plugin dependency issues?
>>
>> On 2/28/12, agenpro log4j<agenprolog4j at gmail.com>  wrote:
>>> Hi, I am trying out the agenpro 3.1.2 installation's example with maven
>>> agenpro-plugin 3.0.5 as described in AgenProManual.pdf procedure to build
>>> an snmp4j agent.  After fixing the agenpro-mvn-task\pom.xml for the
>> current
>>> jar versions, I ran:
>>> e:mvn.bat clean install
>>> But i am getting the following error:
>>> [INFO] --- agenpro-plugin:3.0.5:agenpro (default) @ snmp4j-agenpro-agent
>>> ---
>>> Feb 28, 2012 7:20:03 PM org.sonatype.guice.bean.reflect.LoadedClass
>>> WARNING: Error injecting: com.oosnmp.agenpro.maven.plugins.AgenMojo
>>> java.lang.NoClassDefFoundError: org/apache/log4j/Appender
>>> at java.lang.Class.getDeclaredConstructors0(Native Method)
>>> at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>> at java.lang.Class.getDeclaredConstructors(Class.java:1836)
>>> at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.
>>> java:243)
>>> ...
>>> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Appender
>>> at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
>>> SelfFirstStrategy.java:50)
>>>
>>> Is the current  agenpro-mvn-task\pom.xml example supposed to work?
>>>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231




More information about the SNMP4J mailing list